- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- CloneDrawInfo
- ColorFloodfillImage
- DestroyDrawInfo
- DrawImage
- DrawPrimitive
- GetDrawInfo
- 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 DrawImage( Image *image, const DrawInfo *draw_info );

void DrawPrimitive( Image *image, const DrawInfo *draw_info, PrimitiveInfo *primitive_info ));

void GetDrawInfo( const ImageInfo *image_info, DrawInfo *draw_info );

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

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

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

# FUNCTION DESCRIPTIONS

## CloneDrawInfo

Method CloneDrawInfo makes a duplicate of the given draw info, or if draw info is NULL, a new one.

The format of the CloneDrawInfo method is:

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

A description of each parameter follows:

cloned_info:
  Method CloneDrawInfo returns a duplicate of the given annotate info, or if annotate info is NULL a new one.

image_info:
  a structure of type ImageInfo.

draw_info:
  a structure of type DrawInfo.

## ColorFloodfillImage

Method ColorFloodfillImage floodfills the designated area with a color. The floodfill algorithm is strongly based on a similar algorithm in ``Graphics Gems'' by Paul Heckbert.

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 address of a structure of type Image.

draw_info:
  a structure of type DrawInfo.

target:
  A PixelPacket structure. This is the RGB value of the target color.

x,y:
  Unsigned integers representing the current location of the pen.

method:
  drawing method of type PrimitiveType: floodfill or fill to border.

## DestroyDrawInfo

Method DestroyDrawInfo deallocates memory associated with an DrawInfo structure.

The format of the DestroyDrawInfo method is:

> void DestroyDrawInfo ( DrawInfo *draw_info );

A description of each parameter follows:

draw_info:
  Specifies a pointer to an DrawInfo structure.

## DrawImage

Method DrawImage draws a primitive (line, rectangle, ellipse) on the image.

The format of the DrawImage method is:

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

A description of each parameter follows:

image:
  The address of a structure of type Image.

draw_info:
  The address of a DrawInfo structure.

## DrawPrimitive

Method DrawPrimitive draws a primitive (line, rectangle, ellipse) on the image.

The format of the DrawPrimitive method is:

> void DrawPrimitive ( Image *image, const DrawInfo *draw_info, PrimitiveInfo *primitive_info ) );

A description of each parameter follows:

image:
  The address of a structure of type Image.

draw_info:
  The address of a DrawInfo structure.

primitive_info:
  Specifies a pointer to a PrimitiveInfo structure.

## GetDrawInfo

Method GetDrawInfo initializes the DrawInfo structure.

The format of the GetDrawInfo method is:

> void GetDrawInfo ( const ImageInfo *image_info, DrawInfo *draw_info );

A description of each parameter follows:

image_info:
  Specifies a pointer to an ImageInfo structure.

draw_info:
  Specifies a pointer to a DrawInfo structure.

## MatteFloodfillImage

Method MatteFloodfillImage floodfills the designated area with a matte value. The floodfill algorithm is strongly based on a similar algorithm in ``Graphics Gems'' by Paul Heckbert.

The format of the MatteFloodfillImage method is:

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

A description of each parameter follows:

image:
  The address of a structure of type Image.

target:
  A PixelPacket structure. This is the RGB value of the target color.

matte:
  A integer value representing the amount of transparency.

x,y:
  Unsigned integers representing the current location of the pen.

method:
  drawing method of type PrimitiveType: floodfill or fill to border.

## OpaqueImage

Method OpaqueImage changes the color of an opaque point to the pen color.

The format of the OpaqueImage method is:

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

A description of each parameter follows:

image:
  The address of a structure of type Image; returned from ReadImage.

target:
  the color to search for in the image.

pen_color:
  the color to replace it with.

## TransparentImage

Method TransparentImage creates a matte image associated with the image. All pixel locations are initially set to opaque. Any pixel that matches the specified color are set to transparent.

The format of the TransparentImage method is:

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

A description of each parameter follows:

image:
  The address of a structure of type Image; returned from ReadImage.

target:
  The color to search for in the image.