GDK-PixBuf Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <gdk-pixbuf/gdk-pixbuf.h> enum GdkInterpType; GdkPixbuf * gdk_pixbuf_scale_simple (const GdkPixbuf *src
,int dest_width
,int dest_height
,GdkInterpType interp_type
); void gdk_pixbuf_scale (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
); GdkPixbuf * gdk_pixbuf_composite_color_simple (const GdkPixbuf *src
,int dest_width
,int dest_height
,GdkInterpType interp_type
,int overall_alpha
,int check_size
,guint32 color1
,guint32 color2
); void gdk_pixbuf_composite (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
,int overall_alpha
); void gdk_pixbuf_composite_color (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
,int overall_alpha
,int check_x
,int check_y
,int check_size
,guint32 color1
,guint32 color2
); enum GdkPixbufRotation; GdkPixbuf * gdk_pixbuf_rotate_simple (const GdkPixbuf *src
,GdkPixbufRotation angle
); GdkPixbuf * gdk_pixbuf_flip (const GdkPixbuf *src
,gboolean horizontal
);
typedef enum { GDK_INTERP_NEAREST, GDK_INTERP_TILES, GDK_INTERP_BILINEAR, GDK_INTERP_HYPER } GdkInterpType;
GdkPixbuf * gdk_pixbuf_scale_simple (const GdkPixbuf *src
,int dest_width
,int dest_height
,GdkInterpType interp_type
);
Create a new GdkPixbuf containing a copy of src
scaled to
dest_width
x dest_height
. Leaves src
unaffected. interp_type
should be GDK_INTERP_NEAREST if you want maximum speed (but when
scaling down GDK_INTERP_NEAREST is usually unusably ugly). The
default interp_type
should be GDK_INTERP_BILINEAR which offers
reasonable quality and speed.
You can scale a sub-portion of src
by creating a sub-pixbuf
pointing into src
; see gdk_pixbuf_new_subpixbuf()
.
For more complicated scaling/compositing see gdk_pixbuf_scale()
and gdk_pixbuf_composite()
.
void gdk_pixbuf_scale (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
);
Creates a transformation of the source image src
by scaling by
scale_x
and scale_y
then translating by offset_x
and offset_y
,
then renders the rectangle (dest_x
, dest_y
, dest_width
,
dest_height
) of the resulting image onto the destination image
replacing the previous contents.
Try to use gdk_pixbuf_scale_simple()
first, this function is
the industrial-strength power tool you can fall back to if
gdk_pixbuf_scale_simple()
isn't powerful enough.
If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the scaling which results in rendering artifacts.
|
a GdkPixbuf |
|
the GdkPixbuf into which to render the results |
|
the left coordinate for region to render |
|
the top coordinate for region to render |
|
the width of the region to render |
|
the height of the region to render |
|
the offset in the X direction (currently rounded to an integer) |
|
the offset in the Y direction (currently rounded to an integer) |
|
the scale factor in the X direction |
|
the scale factor in the Y direction |
|
the interpolation type for the transformation. |
GdkPixbuf * gdk_pixbuf_composite_color_simple (const GdkPixbuf *src
,int dest_width
,int dest_height
,GdkInterpType interp_type
,int overall_alpha
,int check_size
,guint32 color1
,guint32 color2
);
Creates a new GdkPixbuf by scaling src
to dest_width
x
dest_height
and compositing the result with a checkboard of colors
color1
and color2
.
|
a GdkPixbuf |
|
the width of destination image |
|
the height of destination image |
|
the interpolation type for the transformation. |
|
overall alpha for source image (0..255) |
|
the size of checks in the checkboard (must be a power of two) |
|
the color of check at upper left |
|
the color of the other check |
Returns : |
the new GdkPixbuf, or NULL if not enough memory could be
allocated for it. [transfer full]
|
void gdk_pixbuf_composite (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
,int overall_alpha
);
Creates a transformation of the source image src
by scaling by
scale_x
and scale_y
then translating by offset_x
and offset_y
.
This gives an image in the coordinates of the destination pixbuf.
The rectangle (dest_x
, dest_y
, dest_width
, dest_height
)
is then composited onto the corresponding rectangle of the
original destination image.
When the destination rectangle contains parts not in the source image, the data at the edges of the source image is replicated to infinity.
|
a GdkPixbuf |
|
the GdkPixbuf into which to render the results |
|
the left coordinate for region to render |
|
the top coordinate for region to render |
|
the width of the region to render |
|
the height of the region to render |
|
the offset in the X direction (currently rounded to an integer) |
|
the offset in the Y direction (currently rounded to an integer) |
|
the scale factor in the X direction |
|
the scale factor in the Y direction |
|
the interpolation type for the transformation. |
|
overall alpha for source image (0..255) |
void gdk_pixbuf_composite_color (const GdkPixbuf *src
,GdkPixbuf *dest
,int dest_x
,int dest_y
,int dest_width
,int dest_height
,double offset_x
,double offset_y
,double scale_x
,double scale_y
,GdkInterpType interp_type
,int overall_alpha
,int check_x
,int check_y
,int check_size
,guint32 color1
,guint32 color2
);
Creates a transformation of the source image src
by scaling by
scale_x
and scale_y
then translating by offset_x
and offset_y
,
then composites the rectangle (dest_x
,dest_y
, dest_width
,
dest_height
) of the resulting image with a checkboard of the
colors color1
and color2
and renders it onto the destination
image.
See gdk_pixbuf_composite_color_simple()
for a simpler variant of this
function suitable for many tasks.
|
a GdkPixbuf |
|
the GdkPixbuf into which to render the results |
|
the left coordinate for region to render |
|
the top coordinate for region to render |
|
the width of the region to render |
|
the height of the region to render |
|
the offset in the X direction (currently rounded to an integer) |
|
the offset in the Y direction (currently rounded to an integer) |
|
the scale factor in the X direction |
|
the scale factor in the Y direction |
|
the interpolation type for the transformation. |
|
overall alpha for source image (0..255) |
|
the X offset for the checkboard (origin of checkboard is at -check_x , -check_y )
|
|
the Y offset for the checkboard |
|
the size of checks in the checkboard (must be a power of two) |
|
the color of check at upper left |
|
the color of the other check |
typedef enum { GDK_PIXBUF_ROTATE_NONE = 0, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90, GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180, GDK_PIXBUF_ROTATE_CLOCKWISE = 270 } GdkPixbufRotation;
GdkPixbuf * gdk_pixbuf_rotate_simple (const GdkPixbuf *src
,GdkPixbufRotation angle
);
Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf.
|
a GdkPixbuf |
|
the angle to rotate by |
Returns : |
the new GdkPixbuf, or NULL if not enough memory could be
allocated for it. [transfer full]
|
Since 2.6
GdkPixbuf * gdk_pixbuf_flip (const GdkPixbuf *src
,gboolean horizontal
);
Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf.
|
a GdkPixbuf |
|
TRUE to flip horizontally, FALSE to flip vertically
|
Returns : |
the new GdkPixbuf, or NULL if not enough memory could be
allocated for it. [transfer full]
|
Since 2.6