Problems with transparency

Previous topic - Next topic

msx

When I add a background image with LOADBMP Command the black area of the Sprites are displayed transparents (I use the DRAWSPRITE Command). Does anyone know what happens?.  :doubt:

Ian Price

Check that your bitmap is in 24 Bit format or created in an image editor that doesn't use the proper image foramt standard. There were issues a long while back with 32Bit colour (I thought this was sorted, but it might still be a problem).

If in doubt, post a single image here and we'll have a look at it.
I came. I saw. I played.

msx

sprites and background are 24-bit BMP format . This problem occurs only in IPhone, it works correctly in windows.

Ian Price

Post the image (or something made in the same art package that does the same) so that we can see the problem directly - without seeing for ourselves it's just guesswork.
I came. I saw. I played.

msx

It will be difficult  because as I said  only happens in the  iPhone, and capture an image showing clearly the fault is complicated.

Ian Price

I meant post the actual image (or a derivitive) so that we can test on OUR iPhones.

If you post the image we can see if it is an image fault, a GLBasic bug or a problem with your code.


Help us to help you.
I came. I saw. I played.

msx

You can to check this code on an iPhone. I attached examples BMP files.

Code (glbasic) Select
   
LOADSPRITE "sprite.bmp",0
DRAWRECT 0,0,32,32, RGB(255,0,128)
DRAWSPRITE 0,0,0
GRABSPRITE 1,0,0,32,32

LOADBMP "background.bmp"
DRAWSPRITE 1,100,100


[attachment deleted by admin]

Kitty Hello

oh. Try DRAWRECT 0,0,1000,1000,0 before you draw the background image.

instead of grabsprite I'd do that with createscreen and drawsprite on that screen then.

msx

There is a sample game with the CREATESCREEN Command? I need to see some code.

Thank you.

msx

Quote from: Kitty Hello on 2011-Jan-01
oh. Try DRAWRECT 0,0,1000,1000,0 before you draw the background image.

Not work  :'(

msx

I add an  example, only you have to  compile for iphone. Note that the sprite containing  the black.

[attachment deleted by admin]

Kitty Hello

I have no idea why it doesn't work. But that might work:

Code (glbasic) Select


SETCURRENTDIR("Media") // seperate media and binaries?

LOADSPRITE "sprite.bmp",0

CREATESCREEN 7, 1, 32, 32
USESCREEN 7
// DRAWRECT 0,0,32,32, RGB(255,0,128)
DRAWSPRITE 0, 0,0
USESCREEN -1


//DRAWRECT 0,0,32,32, RGB(255,0,128)
//DRAWSPRITE 0,0,0
//GRABSPRITE 1,0,0,32,32

LOADBMP "background.bmp"
DRAWSPRITE 1,100,100
SHOWSCREEN
MOUSEWAIT


ampos

Quote from: Ocean on 2011-Jan-02
Show us your code that doesn't work - you might get help faster that way.

Instead of BMPs, use PNGs. And if the "pink" background still do not work, cut the image in PSD as a layer, remove background and save as PNG. THEY WORK, I can promise it to you.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

msx

Thanks, I've finally replaced the  RGB (0,0,0) for RGB  (1,1,1) in the sprites, so  it already works well.

The problem is that I do not know how to use CREATESCREEN to generate motion with several sprites.

As always, I hope you excuse my English

msx

Quote from: ampos on 2011-Jan-05
Quote from: Ocean on 2011-Jan-02
Show us your code that doesn't work - you might get help faster that way.

Instead of BMPs, use PNGs. And if the "pink" background still do not work, cut the image in PSD as a layer, remove background and save as PNG. THEY WORK, I can promise it to you.

ampos el problema es que el negro me lo convierte en trasparente, ya he probado con PNG y BMP de varios formatos y nada. El rosa funciona como debiera.