@Phaelax:
I'm going to answer Baxslash since you're offline. But if you had
something different or even more efficient in mind, let us know!
@Baxslash:
Basically, you'd convert this:
SetMemblockByte(mem, d, 255)
SetMemblockByte(mem, d+1, 255)
SetMemblockByte(mem, d+2, 255)
SetMemblockByte(mem, d+3, 150)
To this:
SetMemblockInt(mem, d, color)
In order to utilize the above, you'd also need a function to convert
the individual RGBA components into the composite RGBA value that
can be fed into SetMemBlockInt.
So, here's an example of such a function:
function rgba_to_int(Red, Green, Blue, Alpha)
// Declare local variables
v_iRGBA as integer
// Combine color components
v_iRGBA = Red
v_iRGBA = v_iRGBA + (Green << 8)
v_iRGBA = v_iRGBA + (Blue << 16)
v_iRGBA = v_iRGBA + (Alpha << 24)
// Return the composite value to caller
endfunction v_iRGBA
Also, we need to fix createBoxImage declaration so that it includes
the color values as parameters:
function createBoxImage(width, height, BorderColor, CenterColor)
Now, when calling "createBoxImage", you'd call...
BorderColor = rgba_to_int(255, 255, 255, 240)
CenterColor = rgba_to_int(255, 255, 255, 150)
NewBox = createBoxImage(width, height, BorderColor, CenterColor)
The idea is, that you can keep the BorderColor and CenterColor
values for later use.. so if you make multiple calls to "createBoxImage"
using the same values, then you only need to create the value with
"rgba_to_int" once - and createBoxImage will be more efficient due to
the 32-bit write operations, when it does "SetMemblockInt(mem, d, color)",
instead of 4 separate byte writes.
Cheers,
AgentSam