1 /* Image item type for GnomeCanvas widget
3 * GnomeCanvas 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 __GNOME_CANVAS_IMAGEFRAME_H__
13 #define __GNOME_CANVAS_IMAGEFRAME_H__
17 #include <libgnomecanvas/libgnomecanvas.h>
18 #include <gtk/gtkenums.h>
19 #include <libart_lgpl/art_misc.h>
20 #include <libart_lgpl/art_pixbuf.h>
26 /* Image item for the canvas. Images are positioned by anchoring them to a point.
27 * The following arguments are available:
29 * name type read/write description
30 * ------------------------------------------------------------------------------------------
31 * pixbuf ArtPixBuf* W Pointer to an ArtPixBuf (aa-mode)
32 * x double RW X coordinate of anchor point
33 * y double RW Y coordinate of anchor point
34 * width double RW Width to scale image to, in canvas units
35 * height double RW Height to scale image to, in canvas units
36 * drawwidth double RW Width to scale image to, in canvas units
37 * anchor GtkAnchorType RW Anchor side for the image
41 #define GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME (gnome_canvas_imageframe_get_type ())
42 #define GNOME_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrame))
43 #define GNOME_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrameClass))
44 #define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
45 #define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
48 typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
49 typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
51 struct _GnomeCanvasImageFrame {
54 double x, y; /* Position at anchor, item relative */
55 double width, height; /* Size of image, item relative */
56 double drawwidth ; /* the amount of the image we draw width-wise (0-drawwidth)*/
57 GtkAnchorType anchor; /* Anchor side for image */
59 int cx, cy; /* Top-left canvas coordinates for display */
60 int cwidth, cheight; /* Rendered size in pixels */
62 uint32_t need_recalc : 1; /* Do we need to rescale the image? */
64 ArtPixBuf *pixbuf; /* A pixbuf, for aa rendering */
65 double affine[6]; /* The item -> canvas affine */
68 struct _GnomeCanvasImageFrameClass {
69 GnomeCanvasItemClass parent_class;
73 /* Standard Gtk function */
74 GtkType gnome_canvas_imageframe_get_type (void);