RGB Color conversion issue?

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
Neoblast
DC Developer
DC Developer
Posts: 312
Joined: Sat Dec 01, 2007 8:51 am
Has liked: 0
Been liked: 0

RGB Color conversion issue?

Post by Neoblast » Fri May 11, 2012 1:29 pm

I'm finishing a game port, only a few pieces left to get it working nicely.

In order to get more performance I had to tune down the colors to 16 bit mode, it was in 32 before.
It's a sdl port, the problem is some tiles and pixels color suddenly changed, probably with some conflict with the colorkey for transparencies.

I managed to fix most of them by changing one of the parameters of the surfaces to hardware mode

( from SWSURFACE to HWSURFACE )

Thing is there's still one thing whose color has changed, the function that handles string drawing, where it should be white ( 255, 255, 255 ) it prints what appear to be cyan ( rgb 0, 255 , 255 I think.. ).

Could anyone help me with these?
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: RGB Color conversion issue?

Post by PH3NOM » Sun May 13, 2012 1:18 pm

Can you post a screen-shot so we can see what its doing wrong?
User avatar
Neoblast
DC Developer
DC Developer
Posts: 312
Joined: Sat Dec 01, 2007 8:51 am
Has liked: 0
Been liked: 0

Re: RGB Color conversion issue?

Post by Neoblast » Sun May 13, 2012 1:41 pm

It's fixed now but thank you Ph3N0M

One of the issues was fixed by using SDL_HWSURFACE ( it had to do with the alpha and changin from 32 to 16 bit mode )

and the other one, related to the strings the game I just released prints, they appeared cyan instead of white, Indiket helped me out with this ;)

This is how it was:
SDL_Color color = { c >> 16, c >> 8, c }; For 32 Bit mode
And how it gets fixed:
SDL_Color color = { c >> 8, c >> 4, c }; For 16 bit mode
Post Reply