Git Product home page Git Product logo

Comments (5)

nopnop2002 avatar nopnop2002 commented on May 26, 2024

Is it possible to draw everything in a frame buffer and then paint the screen at once?

What is a frame buffer?
Do you mean all Pixel data?

If you want to partially rewrite the text on the screen, write the same text in the same color as the background and it will disappear.

uint16_t color;
lcdFillScreen(dev, BLACK);
uint8_t ascii[20];

color = RED;
strcpy((char *)ascii, "Direction=0");
lcdDrawString(dev, fx, 0, 60, ascii, color);

.
.
.
.

color = BLACK;
strcpy((char *)ascii, "Direction=0");
lcdDrawString(dev, fx, 0, 60, ascii, color); // text is disappear.

from esp-idf-st7789.

unre4l avatar unre4l commented on May 26, 2024

Do you mean all Pixel data?

Kind of. My goal is to have:

Frame 1     ->   Frame 2
| text A |       | text B  |  

But what is possible is:

(draw text)      (draw clearing rect)       (draw text)
Frame 1     ->   Frame 2               ->   Frame 3
| text A |       |        |                 | text B  |  

If you want to partially rewrite the text on the screen, write the same text in the same color as the background and it will disappear.

Thanks for the example, but unfortunately it wont solve the problem. The frame inbetween the text draw calls has to be a black rectangle (or black text) to clear the previous text. So there is always one frame before new text can appear.
If one could write all pixel data in a buffer[screen_x][screen_y] and swap all pixel in one draw call, a refresh frame to clear old data wont be necessary, because one can clear and draw on the buffer and flush at once to the screen so no intermediate frame would be visible.

from esp-idf-st7789.

nopnop2002 avatar nopnop2002 commented on May 26, 2024

If one could write all pixel data in a buffer[screen_x][screen_y] and swap all pixel in one draw call,

There is lcdDrawMultiPixels().
You will draw RED square.

uint16_t PixelData[16][16];

for (int x=0;x<16;x++);
  for (int y=0;y<16;y++);
    PixelData[x][y] = RED;
  }
}

for (int y=0;y<16,y++) {
  lcdDrawMultiPixels(&dev, 0, y, 16, PixelData[[0][y]);
}

The generator for text bitmaps is GetFontx().

from esp-idf-st7789.

unre4l avatar unre4l commented on May 26, 2024

The lcdDrawMultiPixels solves my problem. Thanks!
I scrolled through your code and found an even simpler solution.

//if (dev->_font_fill) lcdDrawPixel(dev, xx, yy, dev->_font_fill_color);
This line does exactly what i was looking for. Although refreshing is slower, there is no flickering! 👍

from esp-idf-st7789.

nopnop2002 avatar nopnop2002 commented on May 26, 2024

This is done if _font_fill is valid:

if (dev->_font_fill) lcdDrawFillRect(dev, x0, y0, x1, y1, dev->_font_fill_color);

from esp-idf-st7789.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.