Mojo1 to Mojo2

Just going through some of my modules now to upgrade them to Mojo2

completed so far
1) Display class
2) ImageFont
3) Buttons - Mojo2 introduces Image9p to make my buttons better
4) Particles - Mojo2 brings me a lot more BlendModes

starting was slow to begin with but now its getting a lot quicker now im used some of the differences (ie Canvas's, SetColor 0<1)
Next on my list is my very basic SVG class


Bitmap class converted
The big gotcha here was the differnce between mojo1 and mojo2 for WritePixels.
in Mojo2, pixel data is premultiplied alpha data, which means the RGB values have been altered based on the Alpha channel.
More blurb here...
Assuming that the pixel color is expressed using straight (non-premultiplied) RGBA tuples, a pixel value of (0, 0.7, 0, 0.5) implies a pixel that has 70% of the maximum green intensity and 50% opacity. If the color were fully green, its RGBA would be (0, 1, 0, 0.5).
However, if this pixel uses premultiplied alpha, all of the RGB values (0, 0.7, 0) are as though they were scaled for occlusion by 0.5 and then the alpha is appended to the end to yield (0, 0.35, 0, 0.5). In this case, the 0.35 value for the G channel actually indicates 70% green emission intensity (with 50% occlusion)
just remember ...
1) pixel RGBA data is 0<255 in the data buffer and not a fraction.
2) pixel datain mojo2 is BGRA and not ARGB like mojo1 pixel:int[]
Top Bottom