<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to drawColorBitmap on M5STACK Core2 in Arduino IDE &#x2F; PlatformIO?]]></title><description><![CDATA[<p dir="auto">Hello everyone</p>
<p dir="auto">I'm playing with my new Core2 and i saw the pretty display of the factory default.<br />
Now i want to create my own Output on the LCD. I would like to drawColorBitmap like in the clock example of the factory default.</p>
<pre><code>TFT_eSprite DisClockbuff = TFT_eSprite(&amp;M5.Lcd);

void clockSetup()
{
    DisClockbuff.createSprite(164,101);
    DisClockbuff.drawJpg(clockImage,18401,0,0,163,101);
}

void clockFlush()
{
    uint16_t posx[6] = { 4, 28, 66, 90, 127, 144 };

    // colon between the numbers
    DisClockbuff.fillRect(0, 20, 162, 50, DisClockbuff.color565(0x1a, 0x11, 0x00));
    DisClockbuff.fillRect(0, 25, 2  , 45, DisClockbuff.color565(0xff, 0x9c, 0x00));

    DisClockbuff.fillRect(56,35, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
    DisClockbuff.fillRect(56,54, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));

    DisClockbuff.fillRect(118,40, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
    DisClockbuff.fillRect(118,57, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));

    M5.Rtc.GetTime(&amp;sytState.Rtctime);
    
    // digits
    DisClockbuff.drawColorBitmap(posx[0],26,24,42,
                        DigNumber[ sytState.Rtctime.Hours / 10 ],
                        0xff9c00,
                        0x1a1100);
    DisClockbuff.drawColorBitmap(posx[1],26,24,42,
                        DigNumber[ sytState.Rtctime.Hours % 10 ],
                        0xff9c00,
                        0x1a1100);
    DisClockbuff.drawColorBitmap(posx[2],26,24,42,
                        DigNumber[ sytState.Rtctime.Minutes / 10 ],
                        0xff9c00,
                        0x1a1100);
    DisClockbuff.drawColorBitmap(posx[3],26,24,42,
                        DigNumber[ sytState.Rtctime.Minutes % 10 ],
                        0xff9c00,
                        0x1a1100);
    DisClockbuff.drawColorBitmap(posx[4],33,18,35,
                        DigNumber_35px[ sytState.Rtctime.Seconds / 10 ],
                        0xff9c00,
                        0x1a1100);
    DisClockbuff.drawColorBitmap(posx[5],33,18,35,
                        DigNumber_35px[ sytState.Rtctime.Seconds % 10 ],
                        0xff9c00,
                        0x1a1100);
    
    sytState.clockCount ++;
    sytState.clockCount %= 6;

    // this i don't know what it's for
    DisClockbuff.drawColorBitmap(0,0,164,17,
                            rectptrBuff[sytState.clockCount],
                            0xff9c00,
                            0x000000);

    // maybe this code will actually display the created image?
    DisClockbuff.pushSprite(72,4);
}
</code></pre>
<p dir="auto">And yes, i know there is some more code for Image representation needed. I've added this to ask how it's working.</p>
<p dir="auto">First i tried to remove a single digit. Then i registered that the code won't run on the device.<br />
Can somebody please explain how this code is working?<br />
Why can't i remove a single digit?<br />
What is the minimum requirement to draw a single digit?</p>
]]></description><link>https://community.m5stack.com/topic/2977/how-to-drawcolorbitmap-on-m5stack-core2-in-arduino-ide-platformio</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 12:38:05 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2977.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Feb 2021 13:26:31 GMT</pubDate><ttl>60</ttl></channel></rss>