Blend mode not working Properly for me

BlitzMax Forums/BlitzMax Beginners Area/Blend mode not working Properly for me

Rico(Posted 2010) [#1]
Hi i had this problem once before, and i'm not sure if i ever solved it. I wanted to display some images with the black being black pixels overwriting whats on the screen rather than being transparent. So i did SetBlend(SOLIDBLEND) but it made a light coloured line appear on one side of each image when it is drawn. Can anyone help? am i doing something wrong?

Thank you


ImaginaryHuman(Posted 2010) [#2]
Does your image have alpha information in it by any chance? Not that it should matter in solidblend. Can you post a screenshot?


Rico(Posted 2010) [#3]
i don't know if it has alpha info in it, i just drew it an art package called Promotion and saved it as a png. i don't think it should?

I had 2 ladder blocks which were just yellow rungs with black spaces inbetween. And when they are drawn in SolidBlend mode they appear just as yellow blocks.

ok i will try and take a screenshot so you can see. thank you


ImaginaryHuman(Posted 2010) [#4]
Mmm. Oh. Sometimes graphics software will save the `values` of pixels along with alpha data. This works fine if you are drawing in ALPHABLEND, but in solidblend you will actually see all of the pixel values for the pixels which weren't originally visible in the graphics editor. Usually the apps give you an option of whether you want to save values from transparent pixels - you'd want to say NO in order for it to output 0's for black instead of yellow + zero alpha.

I'm guessing you filled the block with yellow then did something to cause the shapes around it to go black, but it is preserving the yellow pixel data?


Rico(Posted 2010) [#5]
Hi I suppose its possible. but the slopes all have have a double thick yellow line in SOLIDBLEND mode too. i can remember drawing them and i just drew the one line. I was wondering if it could be a mix up with bitmap depth? i checked the project settings in the art package and its says 8 bits per pixel. i has my graphics depth set on 3. I did just set it to 8 and then 32 but it made no difference.

Sorry i haven't worked out how to take a screenshot yet.


Rico(Posted 2010) [#6]


You can see here the slopes all have double thick line and the ladders are yellow blocks when drawn on the bar at top of screen in SOLIDBLEND mode, but when drawn in Alphablend mode below are fine.

These are just temporary graphics btw. This is a map editor i am writing, so you choose the shapes from the selection at the top and then draw on the screen, is unfinished so far - just started.


ImaginaryHuman(Posted 2010) [#7]
I don't know, man, if you're drawing in alphablend and it looks right but when you don't use alphablend it looks wrong then I can only suggest it must be what I said before - otherwise where would it be getting the extra yellow pixels from to fill in between the rungs of the ladder? It's not as if yellow just happens to be stored in all images or anything, you MUST have yellow pixel data stored in all pixels of the image and it must need alphablend to properly hide the ones you don't want to see. So you probably
either need to make a change in your graphics software so that it doesn't save values from transparency, or use different software, or just always draw in alphablend mode. If you want your ladder to be black on yellow always with no transparent parts then save it as RGB not RGBA ie no alpha.


Rico(Posted 2010) [#8]
ok i wil try and look. Its just that it has done someting similar to the slopes - it has increased the thickness to 2 pixels of the edge of the slope. You can see by the one which has been drawn in alphablend on the main screen. I'm sure i just drew them with a single line and never erased anything and started again. But yes its possible. I will check into the art package's settings and see whether i can find an alpha component.

Thank you for your help.


Rico(Posted 2010) [#9]
its done it to the diamond too - there's an extra blue line all the way round the edge thats not there when its drawn in alphablend mode. I will see if its the alpha settings.


ImaginaryHuman(Posted 2010) [#10]
The extra thickness could be accounted for by antialiasing done in the graphics editor which also stores the full pixel value separately from the alpha value.