Abstract

The most useful fill routines are for filling ellipses and polygons, plus one routine is needed for odd shapes that are not ellipses or polygons. SVGALib also includes a function for filling rectangles, because a rectangle filling function is quite trivial to implement. It is useful for filling primitives to support pattern fill. The functions provided by SVGALib allow the user to set up a pattern much the same way that Microsoft graphics functions do. A bit map in the form of an array of unsigned characters is set up and passed to SVGALib through the SVGA_set_fill_pattern( ) function. Both SVGAJilLrectangle( ) and SVGAJill_ellipse( ) are quite simple functions. Filling polygons is not an easy thing for computers to do. Human beings can look at a polygon and see whether a pixel is inside the polygon or not. A computer does not have access to this world view. Therefore, the polyfill algorithm needs to start at the left-hand side of the polygon and scan across, looking for the right side of the polygon. The data structure used by SVGA_polyfill( ) is a binary tree with the key field being the Y coordinate. Each node in the tree contains a sorted list of X values. The Y values are not needed in the list, because they all use the same Y value, which is the key field for the tree.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call