Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am assuming that when you say "the latest SDL/GFX libs on Fedora 10," you mean the SDL and SDL_gfx libraries. To properly display PNG images with transparency, ensure that you also have <a href="http://www.libsdl.org/projects/SDL_image" rel="nofollow noreferrer">SDL_image</a> installed; you will need it, unless you have a different library that can load a PNG image into a SDL_Surface.</p> <p>You should not need to use a color key for transparency (unless, of course, you <em>want</em> to use one). As for your problem with using a color key, note that the SDL documentation recommends setting the color key before calling SDL_DisplayFormat():</p> <blockquote> <p>"If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function."</p> </blockquote> <p>You might also want to try using SDL_DisplayFormatAlpha() instead of SDL_DisplayFormat(), like so:</p> <pre><code>SDL_Rect imagePosition = { 50, 50, 0, 0 }; SDL_Surface *image = IMG_Load("example.png"); if (image != NULL) { image = SDL_DisplayFormatAlpha(image); } </code></pre> <p>Later, in your rendering loop, you can then rotate the source image by some floating point <code>angle</code> on to some SDL_Surface <code>screen</code>:</p> <pre><code>if (image != NULL) { SDL_Surface *rotation = rotozoomSurface(image, angle, 1, 1); SDL_BlitSurface(rotation, NULL, screen, &amp;imagePosition); SDL_FreeSurface(rotation); } </code></pre> <p>The above code will properly blit a PNG with transparency, assuming your PNG has proper transparency.</p> <p>Make sure to link with <code>-lSDL_image</code> for the SDL_image library and <code>-lSDL_gfx</code> for the SDL_gfx library, assuming you are using g++ on your Fedora 10 installation. You can also use <code>sdl-config --libs</code> for the required g++ arguments for SDL itself.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload