MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / PSL_beginclipping

Function PSL_beginclipping

src/postscriptlight.c:3817–3846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3815}
3816
3817int PSL_beginclipping (struct PSL_CTRL *PSL, double *x, double *y, int n, double rgb[], int flag) {
3818 /* Any plotting outside the path defined by x,y will be clipped.
3819 * use PSL_endclipping to restore the original clipping path.
3820 * n : number of x,y pairs (i.e. path length)
3821 * rgb : optional paint (use rgb[0] = -1 to avoid paint)
3822 * flag : 0 = continue adding pieces to the clipping path
3823 * 1 = start new clipping path (more follows)
3824 * 2 = end clipping path (this is the last segment)
3825 * 3 = this is the complete clipping path (start to end)
3826 * Add 4 to omit use even-odd clipping [nonzero-winding rule].
3827 */
3828 if (flag & 1) { /* First segment in (possibly multi-segmented) clip-path */
3829 PSL_comment (PSL, "Start of polygon clip path\n");
3830 PSL_command (PSL, "clipsave\n");
3831 }
3832
3833 if (n > 0) {
3834 int close_interior = 0;
3835 if ((flag & 3) != 3) close_interior = PSL_CLOSE_INTERIOR;
3836 PSL_plotline (PSL, x, y, n, PSL_MOVE | close_interior); /* Must not close path since first point not given ! */
3837 }
3838
3839 if (flag & 2) { /* End path and [optionally] fill */
3840 if (!PSL_eq(rgb[0],-1.0)) PSL_command (PSL, "V %s eofill U ", psl_putcolor (PSL, rgb, 0));
3841 PSL->current.nclip++;
3842 PSL_command (PSL, (flag & 4) ? "PSL_eoclip N\n" : "PSL_clip N\n");
3843 PSL_comment (PSL, "End of polygon clip path. Polygon clipping is currently ON\n");
3844 }
3845 return (PSL_NO_ERROR);
3846}
3847
3848int PSL_plotcolorimage (struct PSL_CTRL *PSL, double x, double y, double xsize, double ysize, int justify, unsigned char *buffer, int nx, int ny, int nbits) {
3849 /* Plots a 24-bit color image in Grayscale, RGB or CMYK mode.

Callers 11

gmt_map_clip_onFunction · 0.85
gmt_BB_clip_onFunction · 0.85
GMT_pssolarFunction · 0.85
GMT_grdviewFunction · 0.85
GMT_psternaryFunction · 0.85
PSL_beginclipping_Function · 0.85
GMT_pscoastFunction · 0.85
GMT_psclipFunction · 0.85
GMT_psroseFunction · 0.85

Calls 4

PSL_commentFunction · 0.85
PSL_commandFunction · 0.85
PSL_plotlineFunction · 0.85
psl_putcolorFunction · 0.85

Tested by

no test coverage detected