Home > Software engineering >  VB in picture controls what is the quickest way to draw a solid circle? The circle is too slow
VB in picture controls what is the quickest way to draw a solid circle? The circle is too slow

Time:09-19

VB in picture controls what is the quickest way to draw a solid circle? The circle is too slow
Picture1. FillColor=RGB (0, 255)
Picture1. Circle (200, 200, 100, vbBlue
Disposable draw less a line still, when a one-time to draw tens of thousands of speed is very slow
What can quickly draw a solid circle method, thank you

CodePudding user response:

Consider the OpenGL or DirectDraw,

CodePudding user response:

In advance with ImageList control to save images with different diameter solid round square (best tangent to each side of the circle, to determine its location and position), copied to the Picture with PaintPicture method controls,

CodePudding user response:

In fact, is the state of each pixel images, with the method of circle and fill, is to generate real-time calculation and processing of the pixel, and calculate the two rounds (circle and fill), if have, according to the real-time change is more slow,

Using off-the-shelf solid circle, is ready beforehand pixel matrix, and directly put into,

In the process, it is best to Picture control is set to visible=False,

CodePudding user response:

I the color of each circle is different, and updated in real time, such as update 15 1 second, 10000 round have to update

CodePudding user response:

reference 4 floor wuganxiu response:
I the color of each circle is different, and updated in real time, such as update 15 1 second, 10000 round have to update the

What on earth are you doing? It is necessary to do this...

Really want to do this, I'm afraid only with DX or OpenGL interface to do,

CodePudding user response:

I want to do a collection GIF image pixels, such as collecting 10000 pixels, and then to display these 10000 pixels into the picture, display pixel cannot too small, and shows the speed to keep up with the GIF image change, namely while gathering, according to the basic changes to GIF synchronization, acquisition can use GetDIBits, pixel coordinates, and then extract the want is according to this, with a picture. The circle is too slow, do you have any good Suggestions, thank you

CodePudding user response:

Update 15 1 second, 10000 round have to update? !
To give who see?
Who can see clearly?
You said you "update 15 1 second, 10000 round update". I said you "update only 10 1 second, 10000 round update only 1000", who is going to prove that I was right about you? How to prove?
Leather is only suitable for blow, obsess really is.

CodePudding user response:

Just a few questions: so many circles, so high refresh rate, give, see who? He will count how many times have you refresh every circle? Draw a few loops, less to refresh a few times he can see? You gave him so many loops share clear which is which? The more than ten thousand circle circle scene showed him? Did he scold you?

CodePudding user response:

This requirement does not need to consider the technical implementation, is a demand, you use DX or OpenGL what done, use look at it that you changed, can't use, advise you to confirm the demand first,

CodePudding user response:

Each circle color is different, there are ten thousand, you how is this ten thousand colours match? See how people tell ten thousand colors?

CodePudding user response:

Tens of thousands of solid round every time, 15 times per second refresh.

I think you or give you ultimately need to do something to say, you this requirement is not reasonable.

CodePudding user response:

Yes, I do things actually very simple, I use GetDIBits function first gathers the RGB values of a video, or animation and then extracted with 10000 points RGB (30 k data stored in the pixels. Bin file, the process is correct, at a rate of 100000 points can do 25 frames per second, there is no problem, the process of acquisition in Timer1_Timer (r) control and perform
LRTN=GetDIBits (DC, iBitmap, 0 & amp; , iHeight, Bits1 (0, 0, 0), bi24BitInfo, 0 & amp;)
ReleaseDC 0, DC
Dim r As Integer
Dim g As Integer
Dim As Integer b
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

Dim i2 As Long

For I=0 To 99
For j=0 To 99
Bits2 (2, I, j)=Bits1 (2, a2 (I), b2 (j)) 'a2 (I), b2 (I) is to collect the coordinates of the
Bits2 (1, I, j)=Bits1 (1 a2 (I), b2 (j))
Bits2 (0, I, j)=Bits1 (0, a2 (I), b2 (j))
'Bits1 (2, I, j)=255
'Bits1 (1, I, j)=0
'Bits1 (0, I, j)=0
Next j
Next I
'For x=0 To ik

Open "d: \ 1. Bin" For Binary As # 1
Put # 1, k, Bits2
K=k + 30000 (each 30 k data, extract the 30 k data saved to the bin file)
Close # 1

Moreover, after the acquisition, to view the acquisition effect how, so I'm going to put the above 1. Bin file according to the picture control to
For example I collected 10000 points, 10000 points in the picture shown above control
Dim Buff (0 to 29999) As Byte '10000 data of 30 k
Open "d: \ 1. Bin" For Binary Open As # 1 '1. Bin file
For i1=1 To 100 'collected 100 frames, have To refresh the 100 times, read 100 times data
Get # 1, wei, Buff 'extraction of 30 k data in the Buff, wei read for each position, the initial value of 1
Wei wei + 30000=
Picture1. Cls
Picture1. Picture=LoadPicture ()

For I=0 To 99
For j=0 To 99
Wei1=I * j + j 'calculation of circle with the data collected by the corresponding coordinates
Picture1. FillColor=RGB (Buff (wei1) * 2, Buff (wei1 + 1) * 2, Buff (wei1 + 2) * 2) 'to fill color circle
Picture1. Circle (a1 (I), b1 (j)), 100, vbBlue Circle '
Next j
Next I
Picture1. Picture=Picture1. Image

Next i1
Close # 1


The problem is now display the brush frame time is too slow, when thousands of some pretty fast, is the Picture1. Circle (a1 (I), b1 (j)), 100, vbBlue 'Circle here too time-consuming, display a few pictures, ha ha




CodePudding user response:

Is the pixels into a round display

CodePudding user response:

Yes, that's pixels to zoom in

CodePudding user response:

First of all, it is not necessary to draw circles, because the actual pixels is not round,
Second, even if it's should be displayed as the Circle, it is not necessary to use Circle statement one by one Circle, draw a Circle on a small Picture, reoccupy PaintPicture the small Picture on the big Picture should be slightly faster than using Circle statements, disrelish PaintPicture still not fast enough, still can use API BitBlt
Finally, the invisible part of the window, of course, there's no need to draw,

In addition, please refer to the software: https://docs.microsoft.com/zh-cn/sysinternals/downloads/zoomit

CodePudding user response:

In the imagelist, texture directly

CodePudding user response:

I tried this, 10000 a circle handle around 70 ms, about the same time as the 15 frames
Set the picturebox autoredraw properties efficiency obviously, and look at the building code scalmode seems is the default twip suggested use Pixel
Use the code below, form a picturebox is put inside a button is a timer can
Use the timer may be fun, I'm just in order to save trouble, can use to deal with,
In addition, if just for the demo interface, actually really don't mind to jump a few frames

 
Option Explicit
Private Declare Function GetTickCount Lib "kernel32 () As" Long


Dim r As Double
Const rad 3.14/360=
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related