draw - Methods to Draw on an Image

- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- CloneDrawInfo
- ColorFloodfillImage
- DestroyDrawInfo
- DrawClipPath
- DrawImage
- MatteFloodfillImage
- OpaqueImage
- TransparentImage

# NAME

draw - Methods to Draw on an Image

# SYNOPSIS

DrawInfo * CloneDrawInfo( const ImageInfo *image_info, const DrawInfo *draw_info );

unsigned int ColorFloodfillImage( Image *image, const DrawInfo *draw_info, const PixelPacket target, const int x_offset, const int y_offset, const PaintMethod method );

void DestroyDrawInfo( DrawInfo *draw_info );

unsigned int DrawClipPath( Image *image, DrawInfo *draw_info );

unsigned int DrawImage( Image *image, DrawInfo *draw_info );

unsigned int MatteFloodfillImage( Image *image, const PixelPacket target, const unsigned int opacity, const int x_offset, const int y_offset, const PaintMethod method );

unsigned int OpaqueImage( Image *image, const PixelPacket target, const PixelPacket fill );

unsigned int TransparentImage( Image *image, const PixelPacket target, const unsigned int opacity );

# FUNCTION DESCRIPTIONS

## CloneDrawInfo

> CloneDrawInfo ( ) makes a copy of the given draw info structure. If NULLis specified, a new image info structure is created initialized todefault values.;

The format of the CloneDrawInfo method is:

> DrawInfo *CloneDrawInfo ( const ImageInfo *image_info, const DrawInfo *draw_info );

A description of each parameter follows:

image_info:
  The image info.

draw_info:
  The draw info.

## ColorFloodfillImage

`ColorFloodfill()` changes the color value of any pixel that matches target and is an immediate neighbor. If the method is FillToBorderMethod is specified, the color value is changed for any neighbor pixel that does not match the bordercolor member of image.

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color for the purposes of the floodfill.

The format of the ColorFloodfillImage method is:

> unsigned int ColorFloodfillImage ( Image *image, const DrawInfo *draw_info, const PixelPacket target, const int x_offset, const int y_offset, const PaintMethod method );

A description of each parameter follows:

image:
  The image.

draw_info:
  The draw info.

target:
  The RGB value of the target color.

x,y:
  The starting location of the operation.

method:
  Choose either FloodfillMethod or FillToBorderMethod.

## DestroyDrawInfo

> DestroyDrawInfo ( ) deallocates memory associated with an DrawInfostructure.;

The format of the DestroyDrawInfo method is:

> void DestroyDrawInfo ( DrawInfo *draw_info );

A description of each parameter follows:

draw_info:
  The draw info.

## DrawClipPath

> DrawClipPath ( ) draws the clip path on the image mask.;

The format of the DrawClipPath method is:

> unsigned int DrawClipPath ( Image *image, DrawInfo *draw_info );

A description of each parameter follows:

image:
  The image.

draw_info:
  The draw info.

## DrawImage

> DrawImage ( ) allows you to draw a graphic primitive on your image. Theprimitive may be represented as a string or filename. Precede thefilename with an ampersand ( @ ) and the contents of the file are drawnon the image. image. You can affect how text is drawn by setting oneor more members of the draw info structure.;

The format of the DrawImage method is:

> unsigned int DrawImage ( Image *image, DrawInfo *draw_info );

A description of each parameter follows:

image:
  The image.

draw_info:
  The draw info.

## MatteFloodfillImage

`MatteFloodfill()` changes the transparency value of any pixel that matches target and is an immediate neighbor. If the method is FillToBorderMethod is specified, the transparency value is changed for any neighbor pixel that does not match the bordercolor member of image.

By default target must match a particular pixel transparency exactly. However, in many cases two transparency values may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two transparency values as the same. For example, set fuzz to 10 and the opacity values of 100 and 102 respectively are now interpreted as the same value for the purposes of the floodfill.

The format of the MatteFloodfillImage method is:

> unsigned int MatteFloodfillImage ( Image *image, const PixelPacket target, const unsigned int opacity, const int x_offset, const int y_offset, const PaintMethod method );

A description of each parameter follows:

image:
  The image.

target:
  The RGB value of the target color.

opacity:
  The level of transparency: 0 is fully opaque and MaxRGB is fully transparent.

x,y:
  The starting location of the operation.

method:
  Choose either FloodfillMethod or FillToBorderMethod.

## OpaqueImage

> OpaqueImage ( ) changes any pixel that matches color with the colordefined by fill.;

By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.

The format of the OpaqueImage method is:

> unsigned int OpaqueImage ( Image *image, const PixelPacket target, const PixelPacket fill );

A description of each parameter follows:

image:
  The image.

target:
  The RGB value of the target color.

fill:
  The replacement color.

## TransparentImage

> TransparentImage ( ) changes the opacity value associated with any pixelthat matches color to the value defined by opacity.;

By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.

The format of the TransparentImage method is:

> unsigned int TransparentImage ( Image *image, const PixelPacket target, const unsigned int opacity );

A description of each parameter follows:

image:
  The image.

target:
  The RGB value of the target color.