Reading The Pixels' Color By DirectX

Nakedsense

Newcomer
Joined
Oct 7, 2010
Hello,
I Am Recently Writing A Program That Reads The Color Of Each Pixel In A Picture.

But It Doesn't Took A Short Time. Because, I Must Read Them One By One From CPU.

I Think If I Use My GPU for That Process, It Will Take Much Lesser.

But I Am Not Sure If I Can Use DirectX or OpenGL to Get Color Value Of A Pixel.

If I Can, Just Let Me Know That And If You Have A Documentation, Please Share It.

Thank You
Fatih BAKIR
 

snarfblam

Ultimate Contributor
Joined
Jun 10, 2003
Location
USA
You want to examine pixels in a Bitmap?

Keep in mind that plenty of software manipulates images without the assistance of the GPU and runs at a more-than-reasonable speed. I'm guessing that your approach involves something along the lines of the GetPixel function, which is terribly slow.

A better method is to copy all of the image data into an array of bytes or integers, which is very fast to access. This allows you to quickly scan through the data. Bob Powell posted a good article about this.
 
Top Bottom