I had a look once more at the docs and found out that the SDL_BlitSurface function doesn't copy the alpha values from the source to the destination; then I wrote a function that copies pixel pixel from the source to the destination, including alpha values, and it works.
The problem is not that blitting on the surface doesn't work properly, but that the surface created with SDL_CreateRGBSurface is black and opaque if amask is 0 or remains completely transparent (even if I blit something on it) if amask is 0xFF000000.
What I would like to do is creating a transparent surface (I mean that all pixels are transparent, not that the per-surface alpha is transparent).
to make all the pixels transparent, but the per-pixel alpha doesn't change, while the color does (if I change the values of RGB the black rectangle becomes a colored rectangle).
It's a short piece of code , so I'll just post it here... Thanks for your interest
This is inside a class; frameWidth and frameHeight are the values of the size of the image; I've skipped the part where I blit images on the surface created because there is a lot of code there to choose which image blit and how to do it, but I'm pretty sure the problem is not there, because when I do it outside from this function on an image not made with SDL_CreateRGBSurface (such as the window) I don't have any problem.
I'm having a problem still with transparency: when I use the function SDL_CreateRGBSurface to create an empty surface, how can I make it completely transparent? I tried changing the mask values: giving an alpha mask value of 0xFF000000 as suggested by the documentation creates an empty and transparent surface, but when I blit anything on it the surface remains empty.
I'm having a problem still with transparency: when I use the function SDL_CreateRGBSurface to create an empty surface, how can I make it completely transparent? I tried changing the mask values: giving an alpha mask value of 0xFF000000 as suggested by the documentation creates an empty and transparent surface, but when I blit anything on it the surface remains empty.
It would be much better than the current one, especially the possibility of choosing license, author and art type on the left column
Problem solved (at least I think so...)
I had a look once more at the docs and found out that the SDL_BlitSurface function doesn't copy the alpha values from the source to the destination; then I wrote a function that copies pixel pixel from the source to the destination, including alpha values, and it works.
Thank you for your help.
The problem is not that blitting on the surface doesn't work properly, but that the surface created with SDL_CreateRGBSurface is black and opaque if amask is 0 or remains completely transparent (even if I blit something on it) if amask is 0xFF000000.
What I would like to do is creating a transparent surface (I mean that all pixels are transparent, not that the per-surface alpha is transparent).
I've tried this:
Uint32 background = SDL_MapRGBA(result->format, 0,0,0,SDL_ALPHA_TRANSPARENT);
SDL_FillRect(result, &result->clip_rect, background);
to make all the pixels transparent, but the per-pixel alpha doesn't change, while the color does (if I change the values of RGB the black rectangle becomes a colored rectangle).
Sorry if I can't explain this very well...
Thank you for your interest anyway
It's a short piece of code , so I'll just post it here... Thanks for your interest
This is inside a class; frameWidth and frameHeight are the values of the size of the image; I've skipped the part where I blit images on the surface created because there is a lot of code there to choose which image blit and how to do it, but I'm pretty sure the problem is not there, because when I do it outside from this function on an image not made with SDL_CreateRGBSurface (such as the window) I don't have any problem.
SDL_Surface* image(){
SDL_Surface* result = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, frameWidth, frameHeight, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
//Here I just blit an image on the surface...
return result;
}
I'm having a problem still with transparency: when I use the function SDL_CreateRGBSurface to create an empty surface, how can I make it completely transparent? I tried changing the mask values: giving an alpha mask value of 0xFF000000 as suggested by the documentation creates an empty and transparent surface, but when I blit anything on it the surface remains empty.
I'm having a problem still with transparency: when I use the function SDL_CreateRGBSurface to create an empty surface, how can I make it completely transparent? I tried changing the mask values: giving an alpha mask value of 0xFF000000 as suggested by the documentation creates an empty and transparent surface, but when I blit anything on it the surface remains empty.
Well, I made this picture almost randomly, playing with myPaint, so the hat just came out... I know it's strange, but I liked it.
And yes, you're right, probably it looks like a priest rather than a shaman... But the name shouldn't make a lot of difference
Very nice work!
OK
Is it ok if I enter the challenge with art that was posted before the challenge started?
Pages