c++ - Faster than GetPixel()? -
how replace getpixel()
faster?
currently using:
temp = getpixel(hmonitor, 1, 1); if (pixelarray[0] != temp) { pixelarray[0] = temp; counter++; }
above code simplified example.
this contained in loop pixels on display. compares 1 pixel (temp) against previous array's pixel (pixelarray). if has changed, replace it. how-ever finding using getpixel() every pixel on display takes long time.
i have been reading other questions of similar nature such as:
fastest method of screen capturing
get pixel color fastest way?
...but not sure method improve such gdi or directx nor how implement said methods.
update: windows gdi (using getobject) array of pixels needed, give thanks you. much, much faster getpixel().
i suggest retrieve pointer bitmap's pixel info (assuming have hbitmap handle).
this done via getobject(), should homecoming bitmap structure. field interested in:
bmbits: pointer location of bit values bitmap. bmbits fellow member must pointer array of character (1-byte) values.
then can run checking logic per pixel on buffers. way faster using getpixel.
c++ windows directx gdi
No comments:
Post a Comment