Jump to content

Draw Pixel to Container before visible


MobileWill

Recommended Posts

When a widget that was hidden becomes visible it needs to be redrawn. For this, the GWIN module calls the currently assigned rendering routine of that widget.
The container doesn't keep track of the internal state. It has no idea of what happens in its client area. This means that when you draw a pixel in the to the container (which is really discouraged, see below!) it will not know about it and the next time it redraws itself it won't redraw that pixel. As an opposite example: The console widget has an internal buffer that keeps track of the text that's shown. That way it can redraw the text when the window needs to be redrawn.

A window doesn't  keep state of your drawing operations. It would take tremendous amount of RAM to do that and as every other widget is based upon that window it would not be very suitable for embedded applications. This means that you can draw to the window but as soon as the window gets redrawn by GWIN it will be cleared again and you have to redo the painting.

There's one simple and very recommended solution to your problem: Use Pixmaps. That is the most proper way to handle this. You can draw anything into the pixmap as it behaves like a real display. It even gives you access to the direct pixel values if you need to do some wizard magic. You can assign a pixmap as a background to a container using two different ways:

  1. Use gwinBlitArea() to dump the content of the pixmap to the container. This means that you will have to manually maintain the redrawing.
  2. Use the image rendering routine for the container widget and assign the pixmap image as the used image. That way it will take care of redrawing automatically. Use gdispPixmapGetMemoryImage() for that.


 

Link to comment
Share on other sites

Did you follow our guide on how to use the ChibiStudio? There's a step-by-step guide that leads you through the process - it starts with downloading the appropriate Java version: http://wiki.ugfx.org/index.php/Using_ChibiStudio

And if you don't like to use that very simplified Makefile we provide then follow the exact same guide but use the Makefile supplied by ChibiOS and modify it according to this guide: http://wiki.ugfx.org/index.php/Using_ChibiOS/RT

Link to comment
Share on other sites

I did follow that guide and didn't get it working other than a few of the demos. I couldn't get an other headers to be included. But as my other comment mentioned I make progress with Embitz and the make system. So this weekend I should be able to get hopefully my project working and then try pixmaps. 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...