Re: About rotation of an icon, and drawing

В Втр, 29/11/2005 в 20:43 +0900, hhamu пишет:
> Hi.
> Please let me know about drawing of the icon after affine conversion.
> I have drawn the icon by the following methods now.
> ------------------
> GdkPixmap* icon[100];  //icon(reading)
> GdkBitmap* iconmask[100]; //mask(reading)
> GdkPixmap* jpgimage;   //drawing area
> void draw_icon(int symbol_no)
> {
>  GtkWidget *draw_area=lookup_widget(GTK_WIDGET(gl_main_wnd),"draw_area");
>  GdkGC   *gc=gdk_gc_new((GdkDrawable*)draw_area->window);
>  gdk_window_get_size(icon[symbol_no],&w,&h);
>  gdk_gc_set_clip_mask(gc,iconmask[symbol_no]);
>  gdk_gc_set_clip_origin(gc,symbol_posx,symbol_posy);
>  gdk_draw_pixmap(jpgimage,gc,iconmap[symbol_no],0,0,0,0,w,h);
>  gdk_gc_destroy(gc);
> }
> --------------------
> An icon file is reading with a "gdk_pixmap_create_from_xpm" .
> I want to apply affine conversion in order to rotate an icon.
> void AffineConv (GdkPixbuf *pixbuf,double w,double h,double r)
> {
>  GnomeCanvas *canvas;
>  GnomeCanvasItem *item;
>  double affine[6];
>  canvas = GNOME_CANVAS(gnome_canvas_new ());
>  gtk_widget_set_usize (canvas, w, h);
>  item = gnome_canvas_item_new (GNOME_CANVAS(canvas)
>          ,gnome_canvas_pixbuf_get_type()
>          ,"pixbuf",pixbuf,NULL);
>  art_affine_rotate(affine,r);
>  gnome_canvas_item_affine_absolute(item,affine);
> }
> I want to draw the item after conversion in jpgimage.
> However, I do not understand the drawing method.
> How is what is necessary just to carry out, in order to draw?
> Or is making GdkPixbuf from GnomeCanvasItem possible?

Hello Hhamu

Just to not leave this question forgotten:

The way you've provided does draw rotated pixbuf on a canvas, but that
is useful for canvas and it's handled by gnomecanvas internal code. 

I suspect you just need something like rotation of pixbuf, that should
be implemented in purely GdkPixbuf oriented code and currently there is
no such function in GdkPixbuf library. Probably you need to write your
own function which do such rotation, moreover, this function can be
jpeg-oriented and take jpeg features into account. Code from canvas can
help you, but you are on your own here.

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