/[crust]/crust/libs/GraphicsFoundation/GFImage.h
ViewVC logotype

Diff of /crust/libs/GraphicsFoundation/GFImage.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jrydberg, Sun Aug 26 20:46:03 2001 UTC revision 1.2 by jrydberg, Sun Sep 2 00:41:19 2001 UTC
# Line 21  Line 21 
21  #ifndef __GraphicsFoundation_GFImage_h  #ifndef __GraphicsFoundation_GFImage_h
22  #define __GraphicsFoundation_GFImage_h 1  #define __GraphicsFoundation_GFImage_h 1
23    
24    #include <GraphicsFoundation/GFBase.h>
25    #include <GraphicsFoundation/GFFont.h>
26    
27  /* Alpha information for images and bitmap contexts.  */  /* Alpha information for images and bitmap contexts.  */
28  enum _GFImageAlphaInfo  enum _GFImageAlphaInfo
29    {    {
# Line 34  enum _GFImageAlphaInfo Line 37  enum _GFImageAlphaInfo
37    };    };
38  typedef enum _GFImageAlphaInfo GFImageAlphaInfo;  typedef enum _GFImageAlphaInfo GFImageAlphaInfo;
39    
40    /* A image is just was you in GTK call a pixbuf.  We just hold information
41       about a raster buffer.  
42    
43       NOTE: Do not alter this structure.  It is a public available structure,
44       but it is suggested that you use convenience function to get information
45       for the structure.  */
46    struct GFImage
47      {
48        void *pixels;
49        unsigned int x0;
50        unsigned int y0;
51        unsigned int x1;
52        unsigned int y1;
53        unsigned int samples;
54        unsigned int bits;
55        GFImageAlphaInfo alpha;
56        unsigned int rowstride;
57      };
58    typedef struct GFImage *GFImageRef;
59    
60    /* Create a new image.  We allocate pixel buffer for image.  */
61    GF_EXTERN GFImageRef GFImageCreate (int width, int height, int samples,
62                                        int bits, GFImageAlphaInfo alpha);
63    
64    /* Create a new image with already allocated data.  */
65    GF_EXTERN GFImageRef
66      GFImageCreateWithData (void *pixels, int x, int y, int width, int height,
67                             int samples, int bits, int rowstride,
68                             GFImageAlphaInfo alpha);
69    
70    /* Composite RGBA image over RGBA buffer.  SRC_IMG is scaled to fit into
71       (WIDTH, HEIGHT).  */
72    GF_EXTERN void GFImageComposite (GFImageRef dst_img, GFImageRef src_img,
73                                     int x, int y, int width, int height);
74    
75    /* Generate a gaussian blur effect on IMG.  */
76    GF_EXTERN void GFImageGaussianBlur (GFImageRef img, float hortz, float vert);
77    
78    /* Copy bits from SRC_IMG into DST_IMG.  (DX, DY) is destination point.  */
79    GF_EXTERN void GFImageCopyBits (GFImageRef dst_img, GFImageRef src_img,
80                                    int dx, int dy, int sx, int sy,
81                                    int width, int height);
82    
83    /* Set all color channels to VALUE in SCR_IMG.  Leave alpha channel
84       untouched.  */
85    GF_EXTERN void GFImageClearColors (GFImageRef src_img, int value);
86    
87    /* Fill DST_IMG with a color of (RED, GREEN, BLUE, ALPHA).  */
88    GF_EXTERN void GFImageFill (GFImageRef dst_img,
89                                int red, int green, int blue, int alpha);
90    
91    
92    /* Conveneince functions for accessing data from a image.  */
93    
94    GF_EXTERN void GFImageGetCol (GFImageRef img, void *dst_buf,
95                                  int x, int y, int height);
96    
97    GF_EXTERN void GFImageSetCol (GFImageRef img, void *src_buf,
98                                  int x, int y, int height);
99    
100    GF_EXTERN void GFImageGetRow (GFImageRef img, void *dst_buf,
101                                  int x, int y, int width);
102    
103    GF_EXTERN void GFImageSetRow (GFImageRef img, void *src_buf,
104                                  int x, int y, int width);
105    
106    /* ??? comment here.  */
107    GF_EXTERN void GFImageRenderTextAtPoint (GFImageRef dst_img, float x, float y,
108                                             char *string, int string_length,
109                                             GFFontHandle font_handle,
110                                             float font_size, float value[]);
111    
112    /* The following functions are just conveneince function for accessing
113       information within the GFImage structure.  It is suggested that you use
114       these instead of accessing the image directly.  */
115    
116    #if 0 /* ??? implement these as functions.  */
117    GF_EXTERN int GFImageWidth (GFImageRef image);
118    GF_EXTERN int GFImageHeight (GFImageRef image);
119    GF_EXTERN int GFImageOriginX (GFImageRef image);
120    GF_EXTERN int GFImageOriginY (GFImageRef image);
121    GF_EXTERN int GFImageRowStride (GFImageRef image);
122    GF_EXTERN int GFImagePixelStride (GFImageRef image);
123    GF_EXTERN int GFImageSamples (GFImageRef image);
124    GF_EXTERN int GFImageBitsPerSample (GFImageRef image);
125    GF_EXTERN GFImageAlphaInfo GFImageAlphaInfo (GFImageRef image);
126    #else
127    # define GFImageWidth(IMG)              ((IMG)->x1 - (IMG)->x0)
128    # define GFImageHeight(IMG)             ((IMG)->y1 - (IMG)->y0)
129    # define GFImageOriginX(IMG)            ((IMG)->x0)
130    # define GFImageOriginY(IMG)            ((IMG)->y0)
131    # define GFImagePixelStride(IMG)        (((IMG)->samples * (IMG)->bits) / 8)
132    # define GFImageSamples(IMG)            ((IMG)->samples)
133    # define GFImageBitsPerSample(IMG)      ((IMG)->bits)
134    # define GFImageAlphaInfo(IMG)          ((IMG)->alpha)
135    # define GFImageRowStride(IMG)          ((IMG)->rowstride)
136    #endif
137    
138  #endif /* GFImage.h */  #endif /* GFImage.h */
139    
140    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26