The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

fills.c - implements the basic general fills

SYNOPSIS

  i_fill_t *fill;
  i_color c1, c2;
  i_fcolor fc1, fc2;
  int combine;
  fill = i_new_fill_solidf(&fc1, combine);
  fill = i_new_fill_solid(&c1, combine);
  fill = i_new_fill_hatchf(&fc1, &fc2, combine, hatch, cust_hash, dx, dy);
  fill = i_new_fill_hatch(&c1, &c2, combine, hatch, cust_hash, dx, dy);
  fill = i_new_fill_image(im, matrix, xoff, yoff, combine);
  fill = i_new_fill_opacity(fill, alpha_mult);
  i_fill_destroy(fill);

DESCRIPTION

Implements the basic general fills, which can be used for filling some shapes and for flood fills.

Each fill can implement up to 3 functions:

fill_with_color

called for fills on 8-bit images. This can be NULL in which case the fill_with_colorf function is called.

fill_with_fcolor

called for fills on non-8-bit images or when fill_with_color is NULL.

destroy

called by i_fill_destroy() if non-NULL, to release any extra resources that the fill may need.

fill_with_color and fill_with_fcolor are basically the same function except that the first works with lines of i_color and the second with lines of i_fcolor.

If the combines member if non-zero the line data is populated from the target image before calling fill_with_*color.

fill_with_color needs to fill the data parameter with the fill pixels. If combines is non-zero it the fill pixels should be combined with the existing data.

The current fills are:

  • solid fill

  • hatched fill

  • fountain fill

Fountain fill is implemented by filters.c.

Other fills that could be implemented include:

  • image - an image tiled over the fill area, with an offset either horizontally or vertically.

  • checkerboard - combine 2 fills in a checkerboard

  • combine - combine the levels of 2 other fills based in the levels of an image

  • regmach - use the register machine to generate colors

i_fill_destroy(fill) =order 90 =category Fills =synopsis i_fill_destroy(fill);

Call to destroy any fill object.

i_new_fill_solidf(color, combine)

Create a solid fill based on a float color.

If combine is non-zero then alpha values will be combined.

i_new_fill_solid(color, combine)

Create a solid fill based on an 8-bit color.

If combine is non-zero then alpha values will be combined.

i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)

Creates a new hatched fill with the fg color used for the 1 bits in the hatch and bg for the 0 bits. If combine is non-zero alpha values will be combined.

If cust_hatch is non-NULL it should be a pointer to 8 bytes of the hash definition, with the high-bits to the left.

If cust_hatch is NULL then one of the standard hatches is used.

(dx, dy) are an offset into the hatch which can be used to hatch adjoining areas out of alignment, or to align the origin of a hatch with the side of a filled area.

i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)

Creates a new hatched fill with the fg color used for the 1 bits in the hatch and bg for the 0 bits. If combine is non-zero alpha values will be combined.

If cust_hatch is non-NULL it should be a pointer to 8 bytes of the hash definition, with the high-bits to the left.

If cust_hatch is NULL then one of the standard hatches is used.

(dx, dy) are an offset into the hatch which can be used to hatch adjoining areas out of alignment, or to align the origin of a hatch with the side of a filled area.

i_new_fill_image(im, matrix, xoff, yoff, combine)

Create an image based fill.

matrix is an array of 9 doubles representing a transformation matrix.

xoff and yoff are the offset into the image to start filling from.

INTERNAL FUNCTIONS

fill_solid(fill, x, y, width, channels, data)

The 8-bit sample fill function for non-combining solid fills.

fill_solid(fill, x, y, width, channels, data)

The floating sample fill function for non-combining solid fills.

i_new_hatch_low(fg, bg, ffg, fbg, combine, hatch, cust_hatch, dx, dy)

Implements creation of hatch fill objects.

fill_hatch(fill, x, y, width, channels, data)

The 8-bit sample fill function for hatched fills.

fill_hatchf(fill, x, y, width, channels, data)

The floating sample fill function for hatched fills.

fill_image(fill, x, y, width, channels, data, work)
fill_imagef(fill, x, y, width, channels, data, work)

AUTHOR

Tony Cook <tony@develop-help.com>

SEE ALSO

Imager(3)

5 POD Errors

The following errors were encountered while parsing the POD:

Around line 205:

Unknown directive: =category

Around line 236:

Unknown directive: =category

Around line 419:

Unknown directive: =category

Around line 449:

Unknown directive: =category

Around line 501:

Unknown directive: =category