Minor bug in Graphics.drawImage()

Posted on
  • Hi!
    I've just tried to write an image to my famous clock :) and found a bug with transparent color.

    var image={ width:9 , height:13 , bpp:24 ,
      buffer:Uint24Array(
    [
      0x0,0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,
      0x0,0x100,0x200,0x400,0x800,0x1000,0x2000,0x4000,0x8000,
      0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,
      0x0,0x10000,0x20000,0x40000,0x80000,0x100000,0x200000,0x400000,0x800000,
    ]),
      transparent: 0x1,
    };
    gt.drawImage(image, 5, 1);
    neopixel.write(pin, gt.buffer);
    
    

    I expect transparent point is in first image line (I can find it even if image is mirrored because there is second color line near) but it is actually in last one. If I set transparent to 0x10000 I see transparent point in first line while expect it in last one.

  • Ahh - I believe this may be related to how multi-byte pixels are interpreted in images. I think they're big endian while the Uint24Array is little endian?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Minor bug in Graphics.drawImage()

Posted by Avatar for SergeP @SergeP

Actions