Initial import of gtk2_ardour.
[ardour.git] / gtk2_ardour / canvas-imageframe.h
1 /* Image item type for GtkCanvas widget
2  *
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.
5  *
6  * Copyright (C) 1998 The Free Software Foundation
7  *
8  * Author: Federico Mena <federico@nuclecu.unam.mx>
9  */
10  
11  
12 #ifndef __GTK_CANVAS_IMAGEFRAME_H__
13 #define __GTK_CANVAS_IMAGEFRAME_H__
14
15 #include <stdint.h>
16
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"
22
23
24 BEGIN_GTK_CANVAS_DECLS
25
26
27 /* Image item for the canvas.  Images are positioned by anchoring them to a point.
28  * The following arguments are available:
29  *
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
39  */
40
41
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))
47
48
49 typedef struct _GtkCanvasImageFrame GtkCanvasImageFrame;
50 typedef struct _GtkCanvasImageFrameClass GtkCanvasImageFrameClass;
51
52 struct _GtkCanvasImageFrame {
53         GtkCanvasItem item;
54
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 */
59
60         int cx, cy;                     /* Top-left canvas coordinates for display */
61         int cwidth, cheight;            /* Rendered size in pixels */
62
63         uint32_t need_recalc : 1;       /* Do we need to rescale the image? */
64
65         ArtPixBuf *pixbuf;              /* A pixbuf, for aa rendering */
66         double affine[6];               /* The item -> canvas affine */
67 };
68
69 struct _GtkCanvasImageFrameClass {
70         GtkCanvasItemClass parent_class;
71 };
72
73
74 /* Standard Gtk function */
75 GtkType gtk_canvas_imageframe_get_type (void);
76
77
78 END_GTK_CANVAS_DECLS
79
80 #endif