Merged with trunk R1612.
[ardour.git] / gtk2_ardour / canvas-imageframe.h
1 /* Image item type for GnomeCanvas widget
2  *
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.
5  *
6  * Copyright (C) 1998 The Free Software Foundation
7  *
8  * Author: Federico Mena <federico@nuclecu.unam.mx>
9  */
10  
11  
12 #ifndef __GNOME_CANVAS_IMAGEFRAME_H__
13 #define __GNOME_CANVAS_IMAGEFRAME_H__
14
15 #include <stdint.h>
16
17 #include <libgnomecanvas/libgnomecanvas.h>
18 #include <gtk/gtkenums.h> 
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 #include <libart_lgpl/art_misc.h>
24 #ifdef __cplusplus
25 }
26 #endif
27
28 #include <libart_lgpl/art_pixbuf.h>
29
30
31 G_BEGIN_DECLS
32
33
34 /* Image item for the canvas.  Images are positioned by anchoring them to a point.
35  * The following arguments are available:
36  *
37  * name         type                    read/write      description
38  * ------------------------------------------------------------------------------------------
39  * pixbuf     ArtPixBuf*      W         Pointer to an ArtPixBuf (aa-mode)
40  * x          double          RW                X coordinate of anchor point
41  * y          double          RW                Y coordinate of anchor point
42  * width      double          RW                Width to scale image to, in canvas units
43  * height     double          RW                Height to scale image to, in canvas units
44  * drawwidth  double          RW                Width to scale image to, in canvas units
45  * anchor     GtkAnchorType   RW                Anchor side for the image
46  */
47
48
49 #define GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME            (gnome_canvas_imageframe_get_type ())
50 #define GNOME_CANVAS_IMAGEFRAME(obj)                   (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrame))
51 #define GNOME_CANVAS_IMAGEFRAME_CLASS(klass)           (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrameClass))
52 #define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME(obj)         (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
53 #define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
54
55
56 typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
57 typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
58
59 struct _GnomeCanvasImageFrame {
60         GnomeCanvasItem item;
61
62         double x, y;                    /* Position at anchor, item relative */
63         double width, height;           /* Size of image, item relative */
64         double drawwidth ;              /* the amount of the image we draw width-wise (0-drawwidth)*/
65         GtkAnchorType anchor;           /* Anchor side for image */
66
67         int cx, cy;                     /* Top-left canvas coordinates for display */
68         int cwidth, cheight;            /* Rendered size in pixels */
69
70         uint32_t need_recalc : 1;       /* Do we need to rescale the image? */
71
72         ArtPixBuf *pixbuf;              /* A pixbuf, for aa rendering */
73         double affine[6];               /* The item -> canvas affine */
74 };
75
76 struct _GnomeCanvasImageFrameClass {
77         GnomeCanvasItemClass parent_class;
78 };
79
80
81 /* Standard Gtk function */
82 GtkType gnome_canvas_imageframe_get_type (void);
83
84
85 G_END_DECLS
86
87 #endif