Jump to content

Blinking image on a graph


ForTest

Recommended Posts

Good morning
I'd like to make the following thing:
- Draw a graph (it's ok)
- Show an image (or a box containing a fixed value or text)
- The image should blink on the graph until another graph start

For example i want to see the image on "example1.jpg" , after few seconds "example2.jpg", after few seconds "example1.jpg" , etc..

Obviously the problem is the redrawing of the graph

I think that the best way is to store the graph points then draw the image and redraw the missing points until the box is blinking


I'd like to have suggests if there are better ways to do what i want or if i'm taking a wrong way
Thank you very much and congratulations for the support that you bring to every user

 

 

P.S.

i can't use pixmap module because i can't include it with makefile

others modules works properly

example1.jpg

example2.jpg

Edited by ForTest
Link to comment
Share on other sites

Provided you only have one plotted y point for each x value (as per your diagram) you can store the y values for each x value in a simple array. This would make it easy to redraw.

A similar strategy is used by the gaudio oscilloscope demo. That demo creates a custom gwin control that uses the above strategy to get smooth updating of the oscilloscope. 

Once you have stored values it is easy to get your widget to redraw when the covering box is removed.

Link to comment
Share on other sites

I'd like to point out that the proper way of doing this is to implement your own custom widget. You can use the existing graph window as part of the widget or implement everything from scratch. In either way, your custom widget will contain a list of the points that need to be redrawn. Under certain conditions this can be optimized as @inmarket mentioned.

You can find a guide that explains how to implement custom widgets here: http://wiki.ugfx.org/index.php/Creating_a_widget
If you have any questions, please don't hesitate to ask. We are happy to help wherever we can and we'll improve the documentation where needed to clear things up.

 

6 hours ago, ForTest said:

i can't use pixmap module because i can't include it with makefile

The only reason why you can use pixmaps is when you are using the single-file build mechanism. If you're using the makefile build system (or manually compiling each file) you should be able to use the pixmaps without any issues. There's no action required to use the pixmaps when you're using the makefile.

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...