Imager

 view release on metacpan or  search on metacpan

lib/Imager/APIRef.pod  view on Meta::CPAN

  # Error handling
  im_clear_error(aIMCTX);
  i_clear_error();
  i_push_error(0, "Yep, it's broken");
  i_push_error(errno, "Error writing");
  im_push_error(aIMCTX, 0, "Something is wrong");
  va_args args;
  va_start(args, lastarg);
  im_push_errorvf(ctx, code, format, args);
  i_push_errorf(errno, "Cannot open file %s: %d", filename, errno);
  im_push_errorf(aIMCTX, errno, "Cannot open file %s: %d", filename, errno);

  # Files
  im_set_image_file_limits(aIMCTX, 500, 500, 1000000);
  i_set_image_file_limits(500, 500, 1000000);
  im_get_image_file_limits(aIMCTX, &width, &height, &bytes)
  i_get_image_file_limits(&width, &height, &bytes)
  im_int_check_image_file_limits(aIMCTX, width, height, channels, sizeof(i_sample_t))
  i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t))

  # Fills
  i_fill_t *fill = i_new_fill_solidf(&fcolor, combine);
  i_fill_t *fill = i_new_fill_solid(&color, combine);
  i_fill_t *fill = i_new_fill_hatch(&fg_color, &bg_color, combine, hatch, custom_hatch, dx, dy);
  i_fill_t *fill = i_new_fill_hatchf(&fg_fcolor, &bg_fcolor, combine, hatch, custom_hatch, dx, dy);
  i_fill_t *fill = i_new_fill_image(src_img, matrix, x_offset, y_offset, combine);
  fill = i_new_fill_fount(0, 0, 100, 100, i_ft_linear, i_ft_linear, 
                          i_fr_triangle, 0, i_fts_grid, 9, 1, segs);
  i_fill_destroy(fill);

  # I/O Layers
  ssize_t count = i_io_peekn(ig, buffer, sizeof(buffer));
  ssize_t result = i_io_write(io, buffer, size)
  char buffer[BUFSIZ]
  ssize_t len = i_io_gets(buffer, sizeof(buffer), '\n');
  io_glue_destroy(ig);

  # Image

  # Image creation/destruction
  i_img *img = i_sametype(src, width, height);
  i_img *img = i_sametype_chans(src, width, height, channels);
  i_img *img = im_img_16_new(aIMCTX, width, height, channels);
  i_img *img = i_img_16_new(width, height, channels);
  i_img *img = im_img_8_new(aIMCTX, width, height, channels);
  i_img *img = i_img_8_new(width, height, channels);
  i_img *img = im_img_double_new(aIMCTX, width, height, channels);
  i_img *img = i_img_double_new(width, height, channels);
  i_img *img = im_img_pal_new(aIMCTX, width, height, channels, max_palette_size)
  i_img *img = i_img_pal_new(width, height, channels, max_palette_size)
  i_img_destroy(img)

  # Image Implementation
  i_img *im = im_img_alloc(aIMCTX);
  i_img *im = i_img_alloc();
  im_img_init(aIMCTX, im);
  i_img_init(im);

  # Image Information
  // only channel 0 writable 
  i_img_setmask(img, 0x01);
  int mask = i_img_getmask(img);
  int channels = i_img_getchannels(img);
  i_img_dim width = i_img_get_width(im);
  i_img_dim height = i_img_get_height(im);
  i_color_model_t cm = i_img_color_model(im);
  int alpha_channel;
  int has_alpha = i_img_alpha_channel(im, &alpha_channel);
  int color_channels = i_img_color_channels(im);

  # Image quantization

  # Logging

  # mutex
  i_mutex_t mutex;

  # Mutex functions
  i_mutex_t m = i_mutex_new();
  i_mutex_destroy(m);
  i_mutex_lock(m);
  i_mutex_unlock(m);

  # Paletted images

  # Tags
  i_tags_set(&img->tags, "i_comment", -1);
  i_tags_setn(&img->tags, "i_xres", 204);
  i_tags_setn(&img->tags, "i_yres", 196);

=head1 DESCRIPTION

=head2 Blit tools

=over

=item i_render_color(r, x, y, width, source, color)

Render the given color with the coverage specified by C<source[0]> to
C<source[width-1]>.

Renders in normal combine mode.


=for comment
From: File render.im

=item i_render_delete(r)

Release an C<i_render> object.


=for comment
From: File render.im

=item i_render_fill(r, x, y, width, source, fill)

Render the given fill with the coverage in C<source[0]> through
C<source[width-1]>.


lib/Imager/APIRef.pod  view on Meta::CPAN


=item i_img_getchannels(C<im>)

  int channels = i_img_getchannels(img);

Get the number of channels in C<im>.


=for comment
From: File image.c

=item i_img_getmask(C<im>)

  int mask = i_img_getmask(img);

Get the image channel mask for C<im>.


=for comment
From: File image.c

=item i_img_has_alpha(C<im>)


Return true if the image has an alpha channel.


=for comment
From: File immacros.h

=item i_img_is_monochrome(img, &zero_is_white)


Tests an image to check it meets our monochrome tests.

The idea is that a file writer can use this to test where it should
write the image in whatever bi-level format it uses, eg. C<pbm> for
C<pnm>.

For performance of encoders we require monochrome images:

=over

=item *

be paletted

=item *

have a palette of two colors, containing only C<(0,0,0)> and
C<(255,255,255)> in either order.

=back

C<zero_is_white> is set to non-zero if the first palette entry is white.


=for comment
From: File image.c

=item i_img_setmask(C<im>, C<ch_mask>)

  // only channel 0 writable 
  i_img_setmask(img, 0x01);

Set the image channel mask for C<im> to C<ch_mask>.

The image channel mask gives some control over which channels can be
written to in the image.


=for comment
From: File image.c


=back

=head2 Image quantization

=over

=item i_quant_makemap(C<quant>, C<imgs>, C<count>)


Analyzes the C<count> images in C<imgs> according to the rules in
C<quant> to build a color map (optimal or not depending on
C<< quant->make_colors >>).


=for comment
From: File quant.c

=item i_quant_translate(C<quant>, C<img>)


Quantize the image given the palette in C<quant>.

On success returns a pointer to a memory block of C<< img->xsize *
img->ysize >> C<i_palidx> entries.

On failure returns NULL.

You should call myfree() on the returned block when you're done with
it.

This function will fail if the supplied palette contains no colors.


=for comment
From: File quant.c

=item i_quant_transparent(C<quant>, C<data>, C<img>, C<trans_index>)


Dither the alpha channel on C<img> into the palette indexes in
C<data>.  Pixels to be transparent are replaced with C<trans_pixel>.

The method used depends on the tr_* members of C<quant>.


=for comment
From: File quant.c




( run in 1.401 second using v1.01-cache-2.11-cpan-99c4e6809bf )