Hi,
keyedsurface does not work properly. I have tried to solve it using breakpoints and I found out that D3DCOLOR c = surface[ x+y * width]
gets wrong pixel color.
I also tried different colors and different pics. Nothing worked.
There are other ways how to aplly transparency but I want to solve why this doesnt work.
Thank you for help.
Code attached below.
KeyedSurface
-
- Posts: 33
- Joined: July 27th, 2012, 12:48 pm
KeyedSurface
- Attachments
-
- Platformer.rar
- (1.99 MiB) Downloaded 132 times
-
- Posts: 33
- Joined: July 27th, 2012, 12:48 pm
Re: KeyedSurface
OK, got it. Can somebody tell me why it does not work with d3dcolor but with D3DCOLOR_XRGB(255, 0, 255) does?
Re: KeyedSurface
most prolly because you're loading a 24-bit image, so gdiplus sets the alpha channel to 255
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
-
- Posts: 33
- Joined: July 27th, 2012, 12:48 pm
Re: KeyedSurface
And what is what? I dont know much about this issue.
Re: KeyedSurface
I couldn't really find where exactly the problem comes up, but I'm assuming that you are talking about the purple stuff around your tiles showing up. You also say that the problem goes away when you put "D3DCOLOR_XRGB(255, 0, 255) " somewhere.
Assumptions: The purple stuff is your problem. the color just so happens to be R:255 B:0 G:255, so it probably fixes it because you are telling the program to not draw any pixels of the image that have that color (purple) there fore it solves the problem because you are not drawing the purple pixels. That's keyed surface.
Assumptions: The purple stuff is your problem. the color just so happens to be R:255 B:0 G:255, so it probably fixes it because you are telling the program to not draw any pixels of the image that have that color (purple) there fore it solves the problem because you are not drawing the purple pixels. That's keyed surface.
ʕ •ᴥ•ʔ
Re: KeyedSurface
hmm, i get it now, since that color (which is magenta btw) is used mostly for transparency (hardly ever used color haha) he just thought it would just make it transparent automatically (since some programs handle that color to be like that)
but yea it doesn't work that way, since that color is like Lux said R:255 G:0 B:255 and A:255 (if you want to include alpha channel lol)
but yea it doesn't work that way, since that color is like Lux said R:255 G:0 B:255 and A:255 (if you want to include alpha channel lol)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --