hpgs  1.1.8
About: HPGS is an HPGL/2 interpreter, which renders HPGL/2 through a Postscript-like API. Currently, it can render to eps and png files.
  Fossies Dox: hpgs-1.1.8.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Paint device.

Data Structures

struct  hpgs_paint_device_st
 The pixel rendering vector graphics device. More...
 

Macros

#define HPGS_PAINT_MAX_CLIP_DEPTH   16
 

Functions

HPGS_API hpgs_paint_devicehpgs_new_paint_device (hpgs_image *image, const char *filename, const hpgs_bbox *bb, hpgs_bool antialias)
 
HPGS_API void hpgs_paint_device_set_image_interpolation (hpgs_paint_device *pdv, int i)
 
HPGS_API void hpgs_paint_device_set_thin_alpha (hpgs_paint_device *pdv, double a)
 
HPGS_INTERNAL_API int hpgs_paint_device_fill (hpgs_paint_device *pdv, hpgs_paint_path *path, hpgs_bool winding, hpgs_bool stroke)
 
HPGS_INTERNAL_API int hpgs_paint_device_clip (hpgs_paint_device *pdv, hpgs_paint_path *path, hpgs_bool winding)
 
HPGS_INTERNAL_API int hpgs_paint_device_drawimage (hpgs_paint_device *pdv, const hpgs_image *img, const hpgs_point *ll, const hpgs_point *lr, const hpgs_point *ur)
 

Detailed Description

This module contains the workhorse for rendering a scenery to pixel graphics, hpgs_paint_device.

Most notably, you can call hpgs_new_paint_device in order to create a new paint device and perform the usual operations hpgs_moveto, hpgs_lineto, ... on it.

Details about the implementation are explained in the documentation of hpgs_paint_device_st and hpgs_paint_clipper_st and the hpyerlinks therein.

Macro Definition Documentation

◆ HPGS_PAINT_MAX_CLIP_DEPTH

#define HPGS_PAINT_MAX_CLIP_DEPTH   16

Definition at line 59 of file hpgspaint.h.

Function Documentation

◆ hpgs_new_paint_device()

HPGS_API hpgs_paint_device* hpgs_new_paint_device ( hpgs_image image,
const char *  filename,
const hpgs_bbox bb,
hpgs_bool  antialias 
)

Creates a new paint device on the heap. Use hpgs_destroy in order to destroy the returned device pointer.

The bounding box, which is mapped onto the given image is passed in as well as the antialiasing switch.

A null pointer is returned, if the system is out of memory.

Definition at line 507 of file hpgspaint.c.

References hpgs_palette_color_st::b, hpgs_paint_color_st::b, hpgs_paint_device_st::clip_depth, hpgs_paint_device_st::clippers, hpgs_paint_device_st::color, hpgs_paint_device_st::current_clipper, hpgs_paint_device_st::filename, hpgs_palette_color_st::g, hpgs_paint_color_st::g, hpgs_paint_device_st::gstate, hpgs_image_st::height, hpgs_gstate_destroy(), hpgs_image_destroy(), hpgs_image_set_resolution(), hpgs_new_gstate(), hpgs_new_paint_clipper(), hpgs_new_paint_path(), hpgs_paint_clipper_destroy(), hpgs_paint_clipper_reset(), HPGS_PAINT_MAX_CLIP_DEPTH, hpgs_paint_path_destroy(), hpgs_paint_device_st::image, hpgs_paint_device_st::image_interpolation, hpgs_paint_color_st::index, hpgs_paint_device_st::inherited, hpgs_bbox_st::llx, hpgs_bbox_st::lly, hpgs_paint_device_st::overscan, hpgs_paint_device_st::page_bb, hpgs_paint_device_st::patcol, hpgs_paint_device_st::path, hpgs_paint_device_st::path_clipper, pdv_vtable, hpgs_palette_color_st::r, hpgs_paint_color_st::r, hpgs_paint_device_st::thin_alpha, hpgs_bbox_st::urx, hpgs_bbox_st::ury, hpgs_device_st::vtable, hpgs_image_st::width, hpgs_paint_device_st::xres, and hpgs_paint_device_st::yres.

Referenced by main().

Here is the caller graph for this function:

◆ hpgs_paint_device_clip()

HPGS_INTERNAL_API int hpgs_paint_device_clip ( hpgs_paint_device pdv,
hpgs_paint_path path,
hpgs_bool  winding 
)

Sets the intersection of the given path with the current clip path of the paint device pdv as the current clip path of pdv.

if winding is HPGS_TRUE, the non-zero winding rule is used for the path intersection, otherwise the exclusive-or rule applies.

Return values:

  • 0 Sucess.
  • -1 An error ocurred. Call hpgs_device_get_error in order to retrieve the error message.

Definition at line 665 of file hpgspaint.c.

References hpgs_paint_device_st::clip_depth, hpgs_paint_device_st::clippers, hpgs_paint_device_st::current_clipper, hpgs_i18n(), hpgs_paint_clipper_clear(), hpgs_paint_clipper_clip(), hpgs_paint_clipper_cut(), hpgs_paint_clipper_destroy(), hpgs_set_error(), and hpgs_paint_device_st::path_clipper.

Referenced by pdv_clip().

Here is the caller graph for this function:

◆ hpgs_paint_device_drawimage()

HPGS_INTERNAL_API int hpgs_paint_device_drawimage ( hpgs_paint_device pdv,
const hpgs_image img,
const hpgs_point ll,
const hpgs_point lr,
const hpgs_point ur 
)

Draws the intersection of the given image with the current clip path of the paint device pdv to the destination image of pdv.

The arguments ll, lr and ur are the lower left, lower right and upper right corner of the drawn image in world coordinates.

Return values:

  • 0 Sucess.
  • -1 An error ocurred. Call hpgs_device_get_error in order to retrieve the error message.

Definition at line 221 of file hpgspaintimage.c.

References hpgs_paint_clipper_st::bb, build_inv_matrix(), hpgs_paint_device_st::clippers, hpgs_paint_device_st::current_clipper, hpgs_log(), hpgs_paint_device_st::image, hpgs_paint_device_st::image_interpolation, hpgs_paint_clipper_st::iscan0, hpgs_paint_clipper_st::iscan1, hpgs_bbox_st::llx, mat_6_mul(), hpgs_paint_scanline_st::n_points, hpgs_scanline_point_st::order, hpgs_paint_device_st::overscan, hpgs_paint_scanline_st::points, put_point_0(), put_point_1(), hpgs_paint_clipper_st::scanlines, hpgs_bbox_st::urx, hpgs_image_st::width, hpgs_scanline_point_st::x, hpgs_point_st::x, hpgs_point_st::y, hpgs_paint_clipper_st::y0, and hpgs_paint_clipper_st::yfac.

Referenced by pdv_drawimage().

Here is the caller graph for this function:

◆ hpgs_paint_device_fill()

HPGS_INTERNAL_API int hpgs_paint_device_fill ( hpgs_paint_device pdv,
hpgs_paint_path path,
hpgs_bool  winding,
hpgs_bool  stroke 
)

Fills the intersection of the given path with the current clip path of the paint device pdv using the current graphics state of pdv.

if winding is HPGS_TRUE, the non-zero winding rule is used for filling, otherwise the exclusive-or rule applies.

Return values:

  • 0 Sucess.
  • -1 An error ocurred. Call hpgs_device_get_error in order to retrieve the error message.

Definition at line 626 of file hpgspaint.c.

References hpgs_paint_device_st::clippers, hpgs_paint_device_st::color, hpgs_paint_device_st::current_clipper, hpgs_error_ctxt(), hpgs_have_error(), hpgs_i18n(), hpgs_paint_clipper_clear(), hpgs_paint_clipper_cut(), hpgs_paint_clipper_emit(), hpgs_set_error(), hpgs_paint_device_st::image, and hpgs_paint_device_st::path_clipper.

Referenced by pdv_fill(), and pdv_stroke().

Here is the caller graph for this function:

◆ hpgs_paint_device_set_image_interpolation()

HPGS_API void hpgs_paint_device_set_image_interpolation ( hpgs_paint_device pdv,
int  i 
)

Sets the image interpolation value of the given paint device. Currently, the following values are supported:

  • 0 no image iterpolation
  • 1 linear image interpolation.

Other values specifiying square or cubic interpolation may be supported in the future. The default value is 0.

Definition at line 598 of file hpgspaint.c.

References hpgs_paint_device_st::image_interpolation.

Referenced by main().

Here is the caller graph for this function:

◆ hpgs_paint_device_set_thin_alpha()

HPGS_API void hpgs_paint_device_set_thin_alpha ( hpgs_paint_device pdv,
double  a 
)

Sets the minimal alpha value for thin lines, when antialiasing is in effect. The supplied value must be grater than or equal to 0.01 and lesser than or equal to 10.0. Other values are ignored.

Definition at line 607 of file hpgspaint.c.

References hpgs_paint_device_st::thin_alpha.

Referenced by main().

Here is the caller graph for this function: