Jump to content
  • Advertisement


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


Colorfill seems to ignore destination rectangle...

This topic is 5655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why? here's the code
colorRect(RECT *pRectDst,int w,int h,unsigned short c)
   if(pRectDst == 0 || 
      w < 0      || 
      h < 0      || 
      c < 0      ||
      w > 640    ||
      h > 480) // this is all to limit the range of the surface we can color

   ddbfx.dwFillColor = c;
   RECT rc = {1280-w,1280-h,1280,1280}; // the surface we're about to color is 1280x1280, so to get the bottom right corner rect of width w and height h, the left and top are just 1280 minus the width and height

   pS2->Blt(&rc,0,0,DDBLT_COLORFILL,&ddbfx); // HERE IS THE PROBLEM. i'm telling it to fill with the color just the destination rect but it fills the whole freaking surface

   pS1->Blt(pRectDst,pS2,&rc,DDBLT_KEYDESTOVERRIDE,&ddbfx); // now we blit the colored rect from ps2 to ps1 (the back buffer) using destination color keying (so only white is written to). this SHOULD give the effect of making any white pixels in the destination rectangle on the back buffer the same color as the rect we filled with color c on surface ps2. But NOOO it doesn't want to do that.

The reason i'm doing all of that (make a rect fill it with color, blit that rect on top of something else to fill in white spaces with the color) is because when i tried doing this sort of thing in one blit call (colorfill and destcolorkey at the same time) it just filled in the entire backbuffer with the color. Like it still does now. Is there something really obvious I'm missing here? This is driving me insane and has for months now. If i don't solve it i think spontaneous combustion is imminent. save yourselves. save me. you're my only hope. *edit* i even made a graphical description of what I'm talking about: [edited by - Irrelevant on March 31, 2003 11:23:50 PM]

Share this post

Link to post
Share on other sites
I fixed it (sort of)!
I had to set the fill color back to 0 after I set it to the fill color initially.
So, I''ll leave this up in the event that someone, someday, has the same difficulty as I.
The Irrelevant Method is what I''ll call it.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!