FLTK logo

[fltk.general] Re: fl_rotate

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: fl_rotate "holm.h... Nov 26, 2021  
 

Thanks again Ian,

works like a charm !

Håvard


fredag 26. november 2021 kl. 09:49:39 UTC+1 skrev Ian MacArthur:
On Friday, 26 November 2021 at 08:17:49 UTC Håvard wrote:

Hello,

I have the following code :
    fl_push_matrix();
    fl_rotate(40);
    fl_arc(10, 10 , 400, 100, 0, 360);
    fl_pop_matrix();
 

The fl_rotate seems to have no effect.

What have I missed ?

That fl_arc is a (so-called) "fast shape" drawing method, rather than a complex shape method. Quoting the docs about "fast shapes":

Drawing Fast Shapes

These functions are used to draw almost all the FLTK widgets. They draw on exact pixel boundaries and are as fast as possible. Their behavior is duplicated exactly on all platforms FLTK is ported. It is undefined whether these are affected by the transformation matrix, so you should only call these while the matrix is set to the identity matrix (the default).

The crux being the "It is undefined whether these are affected by the transformation matrix" part here, of course.

So, rather than fl_arc (int params) what you want is the not-at-all confusingly named fl_arc (double params) - this works, of course, because C++ is happy having multiple functions of the "same name" if their parameters differ and so they have a unique signature.

Note also that the two fl_arc variants take different parameters - the "fast" version takes (int x, int y, int w, int h, double a1, double a2) which is basically the bounding box and the start/end angles; whereas the "complex" one takes (double x, double y, double r, double start, double end) which is basically the centre and radius and the start/end angles...

 

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/2a23ce72-81b7-4796-8f04-d2561eb4277dn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.