How do I draw a single point or pixel?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 1:37 AM
Hi,
I'm trying to build my own graph widget, because the one provided slows down with bigger numbers. Now I want to speed it up by not having lines from one to the next datapoint but simply draw the pixels into the graph. Is this an appropriate approach to speed things up?
If so, how do I draw single points on the screen? All I've found are functions like lineTo() which can draw lines. Is there a way to directly write single points to the frameBuffer to speed things up?
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 11:56 AM
you should be able to draw a shape with the size of '1' on each direction but that seems like a cumbersome way to go..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 1:22 PM
The form of the frame buffer surely shouldn't be that hard to establish and write pixels/bitmaps into.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 11:28 PM
Yeah, I thought about using AbstractShape but as you say this doesn't seem like the best or quickest solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 11:32 PM
I worked out from other widget examples, that you can write to the framebuffer this way:
uint16_t *framebuffer = touchgfx::HAL::getInstance()->lockFrameBuffer();
framebuffer[x + y* touchgfx::HAL::DISPLAY_WIDTH] = 0xFFFF /*pixel value*/;
however nothing appears on screen. Furthermore I am not using the advantages of DMA and when trying to set a lot of pixels this way the application seems to freeze, because it is not doing anything else than writing to the buffer.
