Archived

This topic is now archived and is closed to further replies.

shadowarts

Pixel Shading DDraw with HDC problem

Recommended Posts

Basically what I am trying to do is make sprites that have different color of ugly pink be able to be set to a specific rgb value before they are loaded as a surface into direct draw, this just saves me time so I only have to draw one set of sprites, I wrote something like this for vb and it worked, but I don''t see whats wrong here, this is called in ddutil in the function DDCopyBitmap() right after it calls: GetObject(hbm, sizeof(bm), &bm); dx = dx == 0 ? bm.bmWidth : dx; dy = dy == 0 ? bm.bmHeight : dy; Just to give you an idea of where this is in the code. There are no compiler errors, however when I run the program it never shades the bitmap, its probally something stupid so please help me: (btw if it is something stupid you can make fun of me) for(int y = 0; y >= bm.bmHeight; y++) { for(int x = 0; x >= bm.bmWidth; x++) { if(GetPixel(hdcImage,x,y) == (COLORREF)RGB(255,0,255)) { SetPixel(hdcImage, x, y, RGB(r, g, b)); } else if(GetPixel(hdcImage,x,y) == RGB(200,0,200)) { SetPixel(hdcImage, x, y, RGB(r - 40, g - 40, b - 40)); } else if(GetPixel(hdcImage,x,y) == RGB(255,100,255)) { SetPixel(hdcImage, x, y, RGB(r + 60, g + 60, b + 60)); } } } The GetPixel() doesnt seem to work, I tried putting message boxes inside the if() if they were to be set off, but they never came up.

Share this post


Link to post
Share on other sites
When posting code on these forums use the [ s o u r c e ] and [ / s o u r c e ] tags (minus all those spaces) to insert a code box. Sorry I can''t help you with your problem .

Share this post


Link to post
Share on other sites