Utility and miscellaneous convenience functions.
These functions provide miscellaneous utilities for manipulating pixbufs. The pixel data in pixbufs may of course be manipulated directly by applications, but several common operations can be performed by these functions instead.
<gdk-pixbuf>
) (substitute_color bool
) (r unsigned-char
) (g unsigned-char
) (b unsigned-char
) ⇒ (ret <gdk-pixbuf>
)Takes an existing pixbuf and adds an alpha channel to it. If the existing pixbuf already had an alpha channel, the channel values are copied from the original; otherwise, the alpha channel is initialized to 255 (full opacity).
If substitute-color is ‘
#t
’, then the color specified by (r, g, b) will be assigned zero opacity. That is, if you pass (255, 255, 255) for the substitute color, all white pixels will become fully transparent.
- pixbuf
- A
<gdk-pixbuf>
.- substitute-color
- Whether to set a color to zero opacity. If this is ‘
#f
’, then the (r, g, b) arguments will be ignored.- r
- Red value to substitute.
- g
- Green value to substitute.
- b
- Blue value to substitute.
- ret
- A newly-created pixbuf with a reference count of 1.
<gdk-pixbuf>
) (src_x int
) (src_y int
) (width int
) (height int
) (dest_pixbuf <gdk-pixbuf>
) (dest_x int
) (dest_y int
)Copies a rectangular area from src-pixbuf to dest-pixbuf. Conversion of pixbuf formats is done automatically.
- src-pixbuf
- Source pixbuf.
- src-x
- Source X coordinate within src-pixbuf.
- src-y
- Source Y coordinate within src-pixbuf.
- width
- Width of the area to copy.
- height
- Height of the area to copy.
- dest-pixbuf
- Destination pixbuf.
- dest-x
- X coordinate within dest-pixbuf.
- dest-y
- Y coordinate within dest-pixbuf.
<gdk-pixbuf>
) (dest <gdk-pixbuf>
) (saturation float
) (pixelate bool
)Modifies saturation and optionally pixelates src, placing the result in dest. src and dest may be the same pixbuf with no ill effects. If saturation is 1.0 then saturation is not changed. If it's less than 1.0, saturation is reduced (the image turns toward grayscale); if greater than 1.0, saturation is increased (the image gets more vivid colors). If pixelate is ‘
#t
’, then pixels are faded in a checkerboard pattern to create a pixelated image. src and dest must have the same image format, size, and rowstride.
- src
- source image
- dest
- place to write modified version of src
- saturation
- saturation factor
- pixelate
- whether to pixelate
<gdk-pixbuf>
) (pixel unsigned-int32
)Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixbuf's pixel format. The alpha will be ignored if the pixbuf doesn't have an alpha channel.
- pixbuf
- a
<gdk-pixbuf>
- pixel
- RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black)