Re: Rotating pixmap



Hmm...

If I were you I would be worried about the other arguments :)
But here it is: (I didn't try it, but I'm sure I'm right)

  GdkPoint* points;
  points = (GdkPoint*)malloc(nr_pts * sizeof(GdkPoint));
  // init points, e.g.
  for (i = 0; i < nr_pts; i++) {
     init_point(points + i);
  }
  gdk_draw_polygon(drawable, gc, 1 /*filled*/, points, nr_pts);

I think you don't have to give it points for a closed polygon (normally
it should close the polygon, i.e. for a rectangle you give it 4 points,
not 5 -- the fifth would be the first).


Good luck!

PS: better consider using libtool for vector drawing

/*   -*- Mishoo -*-         In the beginning there was nothing,
 *  mishoo websci ro      which exploded.   (The Big Bang Theory)  */

On Fri, 11 May 2001, Marco Quezada wrote:

Thanks all for your input.

Well, unfortunately I can't animate it before hand because the arrow's heading
must be updated in realtime as the user flies a simulated aircraft.

I was thinking about drawing it as just a couple of lines. I figured the
easiest way to do this was to define a set of points and use gdk_draw_polygon
but I have been unsuccesful with it. Does anyone have or know of an example on
using this function? How must the *points argument be declared? is it an array?

Thanks.

Mihai BAZON wrote:

You can use ImageMagick (www.imagemagick.org) -- highly portable, can do
many transformations on a bitmap, knows many file formats, etc.

However, I think it's too much to require users of your program to have
imagemagick installed, only for this problem.  If your animation does
not depend on user (i.e. you already know that it will spin like a
compass) -- why not render it before, and when the program runs only
draw it (avoid useless computations)?

Cheers,

/*   -*- Mishoo -*-         In the beginning there was nothing,
 *  mishoo websci ro      which exploded.   (The Big Bang Theory)  */

On 10 May 2001, Havoc Pennington wrote:


Marco Quezada <mquezada nlxcorp com> writes:

I have a defined a draing area inside which I display a small icon (an
arrow). The icon is a pixmap which gets loaded with
gdk_pixmap_create_from_xpm_d and such. The XPM of the arrow shows the
arrow pointing to the right. I would like to show the arrow rotating
like a compass. Is it possible to rotate the pixmap when drawing it onto
the drawing area?


No. (That is, GTK provides no way. You can write your own code, but
it's not trivial.)

Havoc

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
Marco Quezada
Aerospaceo Engineero
NLX Corporation
22626 Sally Ride Dr.
Sterling, VA, 20164
mquezada nlxcorp com
703-234-2100 x1028
http://www.nlxcorp.com








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]