Hi,
for my new CAD/CAM program I use a lot of sprites,
1) Create windowed screen
2) I create sprites
3) Draw all the stuff on it, also some images in .PNG (icons) with Alpha channel.
4) I display the toolbars on the screen
5) on the screen I add the cross cursor (mouse posX and mouse posY)
All works fine if I do the follow:
1) DisplayTransparentSprite(ToolBar1, 100, 100, 80)
2) DisplayTransparentSprite(ToolBar2, 100, 150, 80)
3) DisplayTransparentSprite(ToolBar3, 100, 200, 80)
4) DisplaySprite(Mouse1, MouseX, MouseY)
If mouse is on a toolbar (example toolbar2)
2) DisplayTransparentSprite(ToolBar2, 100, 150, 255)
to highlight the toolbar and change the cross cursor in pointer cursor.
works fine if I use
4) DisplaySprite(Mouse2, MouseX, MouseY)
If I use:
4) DisplayTransparentSprite(Mouse2, MouseX, MouseY, 255)
I have the following problem
the cursor is no more alpha blended on the screen
is it OR alpha blended
OR transparent
What must I do to make the cursor transparent and alpha blended ?
Thanks,
marco
Sprite on screen transparency problem ...
Sprite on screen transparency problem ...
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
PS: sorry for my english I speak flemish ...
Re: Sprite on screen transparency problem ...
difficult to say without some code, but here are some points:
you are probaly using TransparentSpriteColor() for that sprite to have the transparency working?
but on mouseover you are using DisplayTransparentSprite(), which needs the sprite to be created with the #PB_Sprite_AlphaBlending flag and the alpha channel to be prepared correctly. I had some problems once if used TransparentSpriteColor() in combination with an alpha channel. try the following:
- always create the sprite with the #PB_Sprite_AlphaBlending flag
- don't use TransparentSpriteColor() on the sprite
- before drawing on the sprite clear the alpha channel:- always display the sprite using DisplayTransparentSprite(..., alpha).
Code: Select all
4) DisplaySprite(Mouse2, MouseX, MouseY)
but on mouseover you are using DisplayTransparentSprite(), which needs the sprite to be created with the #PB_Sprite_AlphaBlending flag and the alpha channel to be prepared correctly. I had some problems once if used TransparentSpriteColor() in combination with an alpha channel. try the following:
- always create the sprite with the #PB_Sprite_AlphaBlending flag
- don't use TransparentSpriteColor() on the sprite
- before drawing on the sprite clear the alpha channel:
Code: Select all
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, w, h, $00000000)
DrawingMode(#PB_2DDrawing_AlphaBlend)
...
Re: Sprite on screen transparency problem ...
Hi #NULL,
I did al kinds of tests with DrawingMode() and mixing these modes.
with the same results.
So, I do my png drawings with GIMP.
end export these to png with alpha channel.
I go to look this side ...
maybe the alpha channel is not correct ?
thanks,
Marc
I did al kinds of tests with DrawingMode() and mixing these modes.
with the same results.
So, I do my png drawings with GIMP.
end export these to png with alpha channel.
I go to look this side ...
maybe the alpha channel is not correct ?
thanks,
Marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
PS: sorry for my english I speak flemish ...
- netmaestro
- PureBasic Bullfrog
- Posts: 8435
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Sprite on screen transparency problem ...
What would help the most is if you could post a working snippet and a couple of images used by it that shows the problem. If you can do that someone will find a way to solve it pretty quick. As it is your request is too vague to get results imho.
BERESHEIT