X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=spec%2Fclip.py;fp=spec%2Fclip.py;h=6b34ad26264d1afbbe5c217144795f8707e93061;hp=0000000000000000000000000000000000000000;hb=5d62a9d366a6efc35d67c4b2581c8442e1dd9394;hpb=b27d77f8a6343e60e2d3ae2c22a8096a6357a927 diff --git a/spec/clip.py b/spec/clip.py new file mode 100644 index 0000000..6b34ad2 --- /dev/null +++ b/spec/clip.py @@ -0,0 +1,46 @@ +from sys import * +from pdflib_py import * +p = PDF_new() +PDF_open_file(p, "clip.pdf") + +PDF_set_parameter(p, "usercoordinates", "true") +PDF_set_value(p, "compress", 0) + +width = 800 +height = 800 +PDF_begin_page(p, width, height) + +PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.0, 0.0) +x1,y1,x2,y2 = 100,100,300,300 +PDF_moveto(p, x1,y1) +PDF_lineto(p, x2,y1) +PDF_lineto(p, x2,y2) +PDF_lineto(p, x1,y2) +PDF_lineto(p, x1,y1) +x1,y1,x2,y2 = 200,200,400,400 +PDF_moveto(p, x1,y1) +PDF_lineto(p, x2,y1) +PDF_lineto(p, x2,y2) +PDF_lineto(p, x1,y2) +PDF_lineto(p, x1,y1) +PDF_stroke(p) + +PDF_setcolor(p, "fill", "rgb", 0.0, 1.0, 0.0, 1.0) +x1,y1,x2,y2 = 100,100,300,300 +PDF_moveto(p, x1,y1) +PDF_lineto(p, x2,y1) +PDF_lineto(p, x2,y2) +PDF_lineto(p, x1,y2) +PDF_lineto(p, x1,y1) +PDF_clip(p) +x1,y1,x2,y2 = 200,200,400,400 +PDF_moveto(p, x1,y1) +PDF_lineto(p, x2,y1) +PDF_lineto(p, x2,y2) +PDF_lineto(p, x1,y2) +PDF_lineto(p, x1,y1) +PDF_fill(p) + +PDF_end_page(p) +PDF_close(p) +PDF_delete(p);