Data Structures | Defines | Functions

Paint device.

Data Structures

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

Defines

#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.


Function Documentation

HPGS_API hpgs_paint_device* hpgs_new_paint_device ( hpgs_image image,
const char *  filename,
const hpgs_bbox bb,
hpgs_bool  antialias 
)
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.

References hpgs_paint_device_st::clip_depth, hpgs_paint_device_st::clippers, hpgs_paint_device_st::current_clipper, 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.

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.

References 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_scanline_point_st::order, hpgs_paint_device_st::overscan, hpgs_paint_scanline_st::points, hpgs_paint_clipper_st::scanlines, hpgs_image_st::width, hpgs_scanline_point_st::x, and hpgs_paint_clipper_st::yfac.

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.

References hpgs_paint_device_st::clippers, hpgs_paint_device_st::color, hpgs_paint_device_st::current_clipper, hpgs_error_ctxt(), hpgs_have_error(), 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.

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.

References hpgs_paint_device_st::image_interpolation.

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.

References hpgs_paint_device_st::thin_alpha.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines