0% found this document useful (0 votes)
44 views20 pages

Module New

This document discusses various methods for drawing shapes and applying styles in SRGP (Simple Raster Graphics Package). It describes how to draw polygons, rectangles, circles, ellipses and apply line styles, colors, fill styles and patterns. Key functions outlined include SRGP_polygon(), SRGP_rectangleCoord(), SRGP_ellipseArc(), SRGP_LineStyle(), SRGP_setFillStyle() and SRGP_setFillBitmapPattern().

Uploaded by

Nisha Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views20 pages

Module New

This document discusses various methods for drawing shapes and applying styles in SRGP (Simple Raster Graphics Package). It describes how to draw polygons, rectangles, circles, ellipses and apply line styles, colors, fill styles and patterns. Key functions outlined include SRGP_polygon(), SRGP_rectangleCoord(), SRGP_ellipseArc(), SRGP_LineStyle(), SRGP_setFillStyle() and SRGP_setFillBitmapPattern().

Uploaded by

Nisha Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Polymarkers

Example:
Polygons
• To draw an outline polygon ,we can either specify a polyline that closes on
itself by making the first and last vertices identical or specialized SRGP
call:

void SRGP_polygon(int vertexCount, point *vertices);


Eg:
Rectangles

void SRGP_rectangleCoord(int leftX, int bottomY,int rightX,int topY);

void SRGP_rectanglePt(point bottomLeft, point topRight);

void SRGP_rectangleCoord(rectangle rect);


The rectanlge record stores the bottom-left
and top right corners
typedef struct
{
point bottomLeft,topRight;
}
Circles And Ellipses

Circular and elliptical arcs drawn by SRGP


General ellipse procedure is:
void SRGP_ellipseArc(rectangle extentRect,double
startAngle,double endAngle);
Attributes

void SRGP_LineStyle(CONTINUOUS/DASHED/DOTTED/…linestyle);

void SRGP_LineWidth(int width);


Code for generating the above figure is:
• A line can be considered as the string of pixels.
• Thus continuous line is considered as the
string of 1s,and dashed to the string
1111001111001111….

Void SRGP_setMarkerSize(int markerSize);

Void SRGP_setMarkerStyle(MARKER CIRCLE/MARKER SQUARE/…MARKERSTYLE);


Color
Filled primitives and their attributes
•A rule should be used for specifying which regions are
interior and to be filled and which regions are exterior.

•SRGP follows an odd parity rule.


•To determine an interior region:
•Choose a test point any point inside the particular
region
•Choose a ray that starts at the test point and extends
infinitely in any direction and does not pass through
any vertices.
•If ray intersects the polygon outline an odd no of
times, the region is considered to be interior.
Fill styles and fill pattern for area

void
SRGP_seFillStyle(SOLID/BITMAP_PATTERN_OPAQUE/
BITMAP_PATTERN_TRANSPARENT/
PIXMAP_PATTERN drawstyle);

• SOLID: produce a primitive uniformly filled with the current value of the color
attribute e.g. fig 1(e)

• BITMAP_PATTERN_OPAQUE: regular ,nonsolid pattern and rewriting all pixels


underbeneath it with either the current color or another color e.g. fig 1(c)
• BITMAP_PATTERN_TRANSPARENT: regular ,nonsolid pattern and rewriting
some pixels underbeneath the primitive in the current color but letting others
show through it. e.g. fig 1(d)
• PIXMAP_PATTERN: writes pattern containing arbitrary no of colors always in
opaque mode.

Fig 1
Bitmap fill pattrns are chosen fro table of available patterns by
spcifying
void SRGP_setFillBitmapPattern(int patternIndex);
Pen pattern for outline

You might also like