Jump to content
  • Advertisement


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

Anyone used PgBlt?

This topic is 5503 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

Has anyone ever got PgBlt(..) to work. It is supposed to draw a bitmap inside a polygon, specifically a rhombus. But I have never been able to get it to work. One of the arguments is a mono-bitmap for masking. Has anyone got an example of this function actually working?

Share this post

Link to post
Share on other sites
the problem why this (and some other blit functions) dont work most of the time is that they need hardware support. i think with GetDeviceCaps you can check if your hardware supports the blit.
My voodoo3 doesnt support anything other then BitBlt

My Homepage

Share this post

Link to post
Share on other sites
My solution is to write my own PgBlt function to draw a DIB in a polygon with A being the top-left point B the top-tight and C the bottom left point of the polygon:

void PgBlt(TDC *source, TDC *dest, TPoint pA,TPoint pB, TPoint pC){
//get pointer to data of DIB

//get pointer to data of output DIB

//or something like that similar.

int a=pA.x, b=pB.x, c=pC.x;
int A=pA.y, B=pB.y, C=pC.y;

if( PixelIsInPolygon(i,j,pA,pB,pC) ){
//find the co-ordinates of the soure bitmap to use

int bit =pixX + pixY * dib.Width();
int bit2=i + j * dib2.Width();
//set the RGB components of the output

data2[bit2*3+0] = data[bit*3+0];
data2[bit2*3+1] = data[bit*3+1];
data2[bit2*3+2] = data[bit*3+2];


Or something like that. On a 500Mhz computer I think this would be fast enough for simple applications such as displaying a rotating bitmap. I haven't tried it yet. If someone wants to try it, and see if I made any mistakes here. You could try it with GetPixel() and SetPixel() but I have found them to be extremely slow.

[edited by - paulbird on April 28, 2003 1:15:45 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!