SuperSpeed access to pixels by DirectX
Posted on 2004-04-25
I want to get about 500 squares with different size from a bitmap and stretch them into 40 x 40 squares. and also READ and WRITE pixels very fast. count them and so (Access them snappy ;)
Can you give me some code to do it using DirectX because I need to know this fast method very fast too. Much faster than Scanline. at least converting a 320 x 240 bitmap to grayscale in less than 50 milliseconds (converting 100 times in 50 ms).
Look at this code:
for i:=0 to 100 do begin
for x:=0 to bitmap.Height-1 do begin
for y:=0 to bitmap.Width-1 do begin
if (p[y*3+2]>200) and (p[y*3+2]<255) then begin
In this code I looked for 200<redvalue<255 for 100 times. it takes about 32~47 milliseconds by an ATi Radeon 7000 64MB. and 450 milliseconds for 1000 scans.
I want it more than 50 times faster. DirectX can do this for sure. but how. I use DirectX to capture images from a ccd, now I have a bitmap assigned to the current frame. how can I access bitmap.pixels? (Please answer with codes, I don't want to be lazy but ...)