How to shift surface?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to shift surface?

Göran Hasse
Hello!

I am trying to write a gtk + Cairo application that mimics the animation in
wikipedias sine graph.

https://en.wikipedia.org/wiki/File:Circle_cos_sin.gif

I want to draw a point and then shift the surface to the left, and then draw a new point,
and shift again. I have done this with pixmaps, but I cant figure it out with Cairo.

Is offset the way to go?

cairo_surface_set_device_offset (surface, offset_x, offset_y);

/gh

--
Göran Hasse
Raditex Control AB
Boo 229
715 91 ODENSBACKEN
http://www.rscada.se
OrgNr: 556611-8773
email: [hidden email]
tel: 019-450105
mob: 070-5530148
Lat:  59.18805083 Long: 15.50300449
URL: http://alturl.com/3e6hf
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: How to shift surface?

Stefan Salewski-2
On Mon, 2018-06-11 at 08:29 +0100, Göran Hasse wrote:
> Hello!
>
> I am trying to write a gtk + Cairo application that mimics the
> animation in
> wikipedias sine graph.
>
> https://en.wikipedia.org/wiki/File:Circle_cos_sin.gif
>
>

There was posted an example some time ago -- in multiple versions.
First one did only clear and redraw -- which gave high CPU load. An
improved version of Uli Schlachter used shifting of display to reduce
load. A Nim version of first simple redraw is available here:

https://github.com/StefanSalewski/gintro

Various C codes you may find in this thread, I think first Uli
Schlachter post has a link to the most advanced C version.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: How to shift surface?

Stefan Salewski-2
On Mon, 2018-06-11 at 16:11 +0200, Stefan Salewski wrote:
> Various C codes you may find in this thread, I think first Uli
> Schlachter post has a link to the most advanced C version.

Ah -- forgot to copy that link:

https://lists.cairographics.org/archives/cairo/2016-October/027791.html

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: How to shift surface?

Göran Hasse
Tanks...

I was looking for something like this. I will investigate.

/gh


Den 2018-06-11 kl. 15:24, skrev Stefan Salewski:
> On Mon, 2018-06-11 at 16:11 +0200, Stefan Salewski wrote:
>> Various C codes you may find in this thread, I think first Uli
>> Schlachter post has a link to the most advanced C version.
>
> Ah -- forgot to copy that link:
>
> https://lists.cairographics.org/archives/cairo/2016-October/027791.html
>

--
Göran Hasse
Raditex Control AB
Boo 229
715 91 ODENSBACKEN
http://www.rscada.se
OrgNr: 556611-8773
email: [hidden email]
tel: 019-450105
mob: 070-5530148
Lat:  59.18805083 Long: 15.50300449
URL: http://alturl.com/3e6hf
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list