More Bitmap Questions

new topic     » goto parent     » topic index » view thread      » older message » newer message

EU>Hello,
EU>I have a question about putting a bitmap(1st) on another bitmap.  I have a
EU>background bitmap and then a smaller bitmap(2nd) on the bitmap.  The
EU>background color of the 2nd bitmap is black.  How can I stop the background
EU>of the second bitmap from appearing when I display the images on screen?
EU>I have looked at some demos I downloaded from the Official Euphoria Page but
EU>I don't understand.

Well, I don't work in euphoria, I just like to see that other languages
than C have some problems too. But I will tell you how I would solve
this problem in C. I would set up a color that would be considered
transparent. (It would probably be 0, concerning that we are in mode
0x13 or some other 256 color mode, on color less won't make any
difference to the user if he is to recognize.) Then in the poloting
routine for the bitmap I would make something like

void DrawPixel (int x, int y, int color)
{
   if (color !=0)    // if color is not zero...
      putpixel(x, y, color);
}

void DrawBitMap(int BMHeight, int BMWidht, char *BMP)
/*
   BMHeight specifies the height of a bitmap
   BMWidth specifies the width of a bitmap
   BMP is a pointer of chars (0-255 values) to the bitmap image
*/
{
   int i, j;

   for (j=0; j<BMHeight; j++)  // for each line...
        for (i=0; i<BMWidth; i++) // draw a column...
           PutPixel(i, j, BMP[j*BMHeight+i]);
}


Well, maybe this will help you all. Just don't send me a hate mail for
not writing this in euphoria please. Thanks.
slayer at bbs.infima.cz

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu