SRL Archive - General Botting Help

smartImage.drawBitmap can't draw black?


Spaceblow

2014-08-21 20:27:46

Here am I again, asking help in this section. I made some graphics for my script. When I tested it out, it didn't turn out like I wanted it to be.

How it should be:

How it draws on SMART:

Why does it mess up? I've spend a fair amount of time on those graphics and it would be a shame if it wouldn't work. It looks like it can't draw the black pixels. I already experienced something when I was trying out clBlack for drawText. If you go to that link you see on the second line of that pic I try out clBlack on a font. The black somehow doesn't show, only the shadow. Am I the only one experiencing this problem or is this supposed to happen? I think, if this problem can't be fixed, the solution would be to use a very dark colour, almost as dark as black, but not black, right? Thanks in advance! :)

Asides from the problem, how are my graphics? I'm actually pretty proud of it. :)

Brandon

2014-08-21 20:52:32

From: Spaceblow
Here am I again, asking help in this section. I made some graphics for my script. When I tested it out, it didn't turn out like I wanted it to be.

Why does it mess up? I think, if this problem can't be fixed, the solution would be to use a very dark colour, almost as dark as black, but not black, right?



RS3 or Oldschool? This is sorta one of the things.. we look past/ignore..


It is true that SMART by default cannot and will not draw black. You can set the transparent colour for SMART to magenta and it'd draw black but not magenta. This doesn't work for plugins though because SMART doesn't export an interface for plugins to retrieve the transparent colour. Though.. it's easy to do.

This CAN be a problem because of the way Simba is made. I personally mentioned it multiple times that Simba is structured bad in that it doesn't handle images with an alpha channel. Instead, it treats all images as 24-bit bitmaps and as such, it throws away the alpha channel.. It actually requires more work to throw it away (it makes a copy to a 24-bit RGB structure in order to save it – see the links below).

Thus SMART has to simulate the alpha channel by treating a specific colour as "transparent". That colour by default is black/noire RGB(0, 0, 0).

If you changed the colour to RGB(0, 0, 1) or RGB(1, 0, 0) or RGB (0, 1, 0) it'd draw it and you won't notice the difference to the human eye at all.

I had the same problem in OpenGL and DirectX when drawing Simba's bitmaps. I had to decide on what colour should be considered "transparent" because Simba blatantly disregards the alpha channel.

It reads 24-bit bitmaps into a 32-bit structure anyway so I don't know why it doesn't handle the alpha channel (treats all pixels as RGB) tbh..


TLDR:
So again, just set any of the RGB channels to 1 byte (instead of 0) and it'll work and won't be noticeable to the human eye.


You can see here how Simba throws away the alpha channel ("CorrectData"): https://github.com/MerlijnWajer/Simba/blob/master/Units/MMLCore/bitmaps.pas#L758

You can see how SMART emulates transparency here: https://github.com/BenLand100/SMART/blob/master/src/Client.java#L371

and how plugins emulate transparency here: https://github.com/Brandon-T/Pascal-DX/blob/master/smartplugin.pas#L160

Olly

2014-08-21 22:30:25

Or.. Change your black color to 1, rather than 0. It should work!

Spaceblow

2014-08-22 06:24:36

From: Brandon
RS3 or Oldschool? This is sorta one of the things.. we look past/ignore..


It is true that SMART by default cannot and will not draw black. You can set the transparent colour for SMART to magenta and it'd draw black but not magenta. This doesn't work for plugins though because SMART doesn't export an interface for plugins to retrieve the transparent colour. Though.. it's easy to do.

This CAN be a problem because of the way Simba is made. I personally mentioned it multiple times that Simba is structured bad in that it doesn't handle images with an alpha channel. Instead, it treats all images as 24-bit bitmaps and as such, it throws away the alpha channel.. It actually requires more work to throw it away (it makes a copy to a 24-bit RGB structure in order to save it – see the links below).

Thus SMART has to simulate the alpha channel by treating a specific colour as "transparent". That colour by default is black/noire RGB(0, 0, 0).

If you changed the colour to RGB(0, 0, 1) or RGB(1, 0, 0) or RGB (0, 1, 0) it'd draw it and you won't notice the difference to the human eye at all.

I had the same problem in OpenGL and DirectX when drawing Simba's bitmaps. I had to decide on what colour should be considered "transparent" because Simba blatantly disregards the alpha channel.

It reads 24-bit bitmaps into a 32-bit structure anyway so I don't know why it doesn't handle the alpha channel (treats all pixels as RGB) tbh..


TLDR:
So again, just set any of the RGB channels to 1 byte (instead of 0) and it'll work and won't be noticeable to the human eye.


You can see here how Simba throws away the alpha channel ("CorrectData"): https://github.com/MerlijnWajer/Simba/blob/master/Units/MMLCore/bitmaps.pas#L758

You can see how SMART emulates transparency here: https://github.com/BenLand100/SMART/blob/master/src/Client.java#L371

and how plugins emulate transparency here: https://github.com/Brandon-T/Pascal-DX/blob/master/smartplugin.pas#L160
Thank you very much for your extensive answer, I've learned a few things when I was reading your reply, I appreciate it a lot. :)

From: Olly
Or.. Change your black color to 1, rather than 0. It should work!
I did what you and Brandon suggested, here's the outcome, I'm very happy with it. :)




EDIT: Brandon, I'm using RS3 with the DirectX plugin if you're wondering.