Archived

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

Changing a pixel color in a surface

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

I''m using Directdraw in directx7. I have a surface that has my game font on it. The font is white on a background of my transparent color. I''d like to be able to color this font, but I dunno how to go about doing it aside from locking the buffer and stepping through it. I''d rather not do this as I prefer to keep all the surfaces in vid mem if at all possible. I looked into trying to use DestColorKeys, but my HW doesn''t support it. I have a GeForce3 Ti 200, and it seems to me that if my G3 doesn''t support it most other cards won''t either. Especially since most cards are still using the same 2-D core they have been for awhile now.... The one thing I haven''t looked into too deeply yet is creating the font surface as a paletted surface. That way I could just change the color index in the palette, but I''m not sure how well that will work with 16 and 32 bit primary surfaces.... I can think of a dozen ways to do it in Direct3d but I don''t want to implement a d3d core just to draw text... So, any ideas?? -Nate

Share this post


Link to post
Share on other sites
you do realize that geforce3 has crappy 2d support? the ati rage pro, a MUCH older card i might add, supports more 2d functionality then geforce3 does (including dest/src color keying). just because a card does 3d stuff well does not mean that it can do 2d well. the fact is that video cards are using crappy 2d cores. the manufactures are concentrating on 3d cores so they support the bare minium in the 2d department.

with that out of the way, you are pretty low on options. best bet would be create and store all the colored text you will need. this can be then loaded and onloaded from vidmem as needed. a palleted surface is stupid unless you are using 8bit color as your primary surface (since YOU will have to convert to whatever surface you blit to if its not the same). are you needing text of many colors often?

this is really easier to do using d3d (vertex colors, but you know this). you may really consider using dx8 since you want to keep everything in vid memory anyway. this means yoou probally are just using blits for tiles and such. its painlesss to convert to dx8 for something like this espeically with all the info on this board and site. jsut think as an added bonus you get bilinear filtering on all your tiles and sprites, and alpha blending for basically free.

Share this post


Link to post
Share on other sites
Originally I was going to go d3d for the primary core, but have a fall back option of DDraw when d3d is not available. But after thinking about it I decided that all d3d would really add is some visual eye candy and thats about it. My group members didn''t really care either (There artists, what do you expect) so I decided to write it with the 2d core first, and then maybe return later and implement d3d. The way my program is structured re-writing the gfx sys is a sinch, in fact half of it already supports d3d as I had written it before I decided to post-pone doing d3d.

I probably will go the route of loading each color as a seperate surface and limiting the number of colors to like 8 or something. I only really want color to make reading chat windows etc. easier.

Thx

-Nate

Share this post


Link to post
Share on other sites