1 /* Image item type for GtkCanvas widget
3 * GtkCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
4 * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
6 * Copyright (C) 1998 The Free Software Foundation
8 * Author: Federico Mena <federico@nuclecu.unam.mx>
12 #ifndef __GTK_CANVAS_IMAGEFRAME_H__
13 #define __GTK_CANVAS_IMAGEFRAME_H__
17 #include <gtk-canvas/gtk-canvas-defs.h>
18 #include <gtk/gtkpacker.h> /* why the hell is GtkAnchorType here and not in gtkenums.h? */
19 #include <libart_lgpl/art_misc.h>
20 #include <libart_lgpl/art_pixbuf.h>
21 #include "gtk-canvas/gtk-canvas.h"
24 BEGIN_GTK_CANVAS_DECLS
27 /* Image item for the canvas. Images are positioned by anchoring them to a point.
28 * The following arguments are available:
30 * name type read/write description
31 * ------------------------------------------------------------------------------------------
32 * pixbuf ArtPixBuf* W Pointer to an ArtPixBuf (aa-mode)
33 * x double RW X coordinate of anchor point
34 * y double RW Y coordinate of anchor point
35 * width double RW Width to scale image to, in canvas units
36 * height double RW Height to scale image to, in canvas units
37 * drawwidth double RW Width to scale image to, in canvas units
38 * anchor GtkAnchorType RW Anchor side for the image
42 #define GTK_CANVAS_TYPE_CANVAS_IMAGEFRAME (gtk_canvas_imageframe_get_type ())
43 #define GTK_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_CAST ((obj), GTK_CANVAS_TYPE_CANVAS_IMAGEFRAME, GtkCanvasImageFrame))
44 #define GTK_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_CANVAS_TYPE_CANVAS_IMAGEFRAME, GtkCanvasImageFrameClass))
45 #define GTK_CANVAS_IS_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_TYPE ((obj), GTK_CANVAS_TYPE_CANVAS_IMAGEFRAME))
46 #define GTK_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_CANVAS_TYPE_CANVAS_IMAGEFRAME))
49 typedef struct _GtkCanvasImageFrame GtkCanvasImageFrame;
50 typedef struct _GtkCanvasImageFrameClass GtkCanvasImageFrameClass;
52 struct _GtkCanvasImageFrame {
55 double x, y; /* Position at anchor, item relative */
56 double width, height; /* Size of image, item relative */
57 double drawwidth ; /* the amount of the image we draw width-wise (0-drawwidth)*/
58 GtkAnchorType anchor; /* Anchor side for image */
60 int cx, cy; /* Top-left canvas coordinates for display */
61 int cwidth, cheight; /* Rendered size in pixels */
63 uint32_t need_recalc : 1; /* Do we need to rescale the image? */
65 ArtPixBuf *pixbuf; /* A pixbuf, for aa rendering */
66 double affine[6]; /* The item -> canvas affine */
69 struct _GtkCanvasImageFrameClass {
70 GtkCanvasItemClass parent_class;
74 /* Standard Gtk function */
75 GtkType gtk_canvas_imageframe_get_type (void);