The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_shape help
brianhj


Joined: 17 Jan 2010
Posts: 14
Hi,
I'm trying to use SDL_shape, which to my understanding allows you to create a "shaped" window, or one that allows parts of the window to be transparent - is this correct? SDL_SetWindowShape is returning SDL_INVALID_SHAPE_ARGUMENT which, according to the source, is only returned when shape (a surface) == NULL. I'm checking for a NULL value and my surface is definitely not NULL. Has anyone been able to get this to work properly?

Thanks
Brian
brianhj


Joined: 17 Jan 2010
Posts: 14
SDL_SetWindowShape is now returning 0 (success) but I'm not seeing a window at all when the program runs. It's entirely invisible.

Things I've tried:
-PNG and BMP
-Alpha channel + 32-bit images
-2-bit images (black and white)
-SDL_SetColorKey on surface
-Different settings for SDL_WindowShapeMode and SDL_WindowShapeParams

SDL_SetWindowShape always returns 0 but the window is invisible. If I take out the word "Shaped" in SDL_CreateShapedWindow and ignore the SDL_SetWindowShape failure the window appears fine (but not shaped, of course).

Here's my code: http://pastebin.com/H52S1stC

Any ideas?
brianhj


Joined: 17 Jan 2010
Posts: 14
I've also pored over this example: https://hg.libsdl.org/SDL/file/f0645cd8fd39/test/testshape.c

I've got a black and white image as my shape surface, with a black circle in the middle filled in.

I've tried saving it as PNG and BMP and I've primarily focused on using ColorKey as opposed to alpha channels. I set the color key to black and I also tried white.

Evil or Very Mad