Jump to content

  • Log In with Google      Sign In   
  • Create Account


Transparency Question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Qoy   Members   -  Reputation: 127

Like
Likes
Like

Posted 16 December 1999 - 02:32 PM

I am implementing a bitmapped text function for my game, and it works alright so far, but I am having one problem. This doesn't just occur with the text. I am using source color keying, with RGB(0,0,0) as the color key for transparency. Whenever I use Blt or BltFast to blit the rectangle containing a letter to the back buffer, some of the pixels don't show up transparent, instead, they show up black (I have the backBuffer filled gray, so I can see where it't not working). It seems to do this on pixels that are directly to the right of pixels of different colors (non-black). But it only does this sometimes. I am using the DDLoadBitmap function from ddutil.cpp to load the bitmap, and am using the DirectX 5 headers/libs. I am using Paint Shop Pro 6 to make the graphics, so I don't know if it's a problem in the bitmap format... My surface is 32 bit, and all my bitmaps are 24 bit.
Does anybody know what the problem could be?

------------------
http://qoy.tripod.com



Sponsor:

#2 Alastair   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 1999 - 04:26 PM

Check you've turned off anti-aliasing in PSP. It may be that some pixels that you intend to be black are not precisely RGB(0,0,0).


#3 Qoy   Members   -  Reputation: 127

Like
Likes
Like

Posted 13 December 1999 - 06:45 PM

I was having that problem before, but I turned it off, and I have exhaustively checked the perimeters of the text objects to make sure they are indeed (0,0,0) and they are... And just to be sure, I used the "Count Colors" function in PSP, and there are 4 colors used in the picture. That's just enough, because I have 2 colors of text, 1 color of template lines, and then the (0,0,0).
I just don't know if this is a problem with the color keying (I used the DDSetColorKey function from ddutil.cpp to set it) or with the bitmap format (I doubt that) or with, I don't know what...

HELP!!!


#4 Qoy   Members   -  Reputation: 127

Like
Likes
Like

Posted 14 December 1999 - 03:07 PM

Here is exactly what's happening:
If I make a change from ANY color to the transparent color (meaning if one pixel is not transparent, and the next few are, the next pixel to the right (or maybe 2 pixels, I cant really tell) show up as black on the screen. I don't know if they are actually showing up as RGB(0,0,0) or something very close, but I know they are (0,0,0) in the bitmap file. I don't know if it's a problem saving the bitmap, loading it to a surface, or blitting it (it happens with both Blt and BltFast).

please help... I'm gonna have a heart attack soon if this doesn't get fixed

[This message has been edited by Qoy (edited December 14, 1999).]


#5 frizb   Members   -  Reputation: 122

Like
Likes
Like

Posted 15 December 1999 - 12:04 PM


Cool, I thought it was just me. I've been saving Poser models into bitmap form on a black background, but the models always end up with a black outline when they are blt/bltfast.

------------------
Still Learning...


#6 Qoy   Members   -  Reputation: 127

Like
Likes
Like

Posted 15 December 1999 - 03:09 PM

I talked on #gamedev on Afternet last night to some people, and they said it was probably a problem with my card in 32 bit color modes. They suggested I change the bit depth to 16 bits. Does anybody think the problem could be anything else? I am now trying to convert the game to run in 16 bits, but am having trouble converting the bitmaps, and simply even displaying colors to the screen. Does anybody know where I can find an example of converting a 24 bit bitmap to 16 bits, or of building up a 16 bit RGB value?
I'll post some of my code so people can see if it's really convoluted, and see if they know what my problem is...

Here is my code for checking the pixel format:

code:

// check the pixel format (555 or 565)
gMask = desc.ddpfPixelFormat.dwGBitMask;
// check the 27th bit from the right in the mask (bit number 26)
// if it's 1, then it's 565, else it's 555
// it's the 27th bit because it's the 3rd from the beginning of the first byte,
// but gMask is 4 bytes
// 2^26 = 67108864
if(gMask | 67108864)
pixelFormat = 565;
else
pixelFormat = 555;

Here is my code for building up a 16 bit rgb value:

code:

#define RGB555(r,g,b) ((b % 32) + ((g % 32) << 6) + ((r % 32) << 11))
#define RGB565(r,g,b) ((b % 32) + ((g % 64) << 5) + ((r % 32) << 11))

I can probably handle the converting the bitmap if I can just get this stuff working...


#7 TANSTAAFL   Moderators   -  Reputation: 1152

Like
Likes
Like

Posted 16 December 1999 - 12:33 AM

here's a thought...

you said this was a bitmapped lettering system, correct? does this mean that there are essentially two colors in your bitmap(black and the letter's color)?

if so, then you may as well design your letters on a monochrome bitmap.

if there's actually a pattern(more than just the two colors), then thats another story.


#8 Qoy   Members   -  Reputation: 127

Like
Likes
Like

Posted 16 December 1999 - 02:32 PM

Well, the letters are just two colors, but this stuff has to work for other bitmaps too




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS