00001 /*----------------------------------------------------------------------------------------*/ 00002 /* FILE : clipping.h */ 00003 /* COPYRIGHT : INRIA 2006 */ 00004 /* AUTHORS : Jean-Baptiste Silvy, Jean-Philipe Chancelier */ 00005 /* DESC. : Management of clipping when drawing */ 00006 /*----------------------------------------------------------------------------------------*/ 00007 00008 #ifndef __SCI_CLIPPING__ 00009 #define __SCI_CLIPPING__ 00010 00011 #include "ObjectStructure.h" 00012 #include "PloEch.h" 00013 00014 /*----------------------------------------------------------------------------------------*/ 00015 /* 00016 * @memo a structure to defined a clipping rectangle in pixels 00017 */ 00018 typedef struct 00019 { 00020 int leftX ; /* abscissa of the left edge of the region */ 00021 int rightX ; /* abscissa of the rigth edge */ 00022 int bottomY ; /* ordinate of the bottom edge */ 00023 int topY ; /* ordinate of the upper edge */ 00024 } 00025 SClipRegion ; 00026 00027 /*----------------------------------------------------------------------------------------*/ 00031 SClipRegion getClipRegion( struct BCG * scilabXGC ) ; 00032 /*----------------------------------------------------------------------------------------*/ 00033 /* 00034 * use for drawing precomputing clipping when drawing polygons 00035 * Test a single point to be within the xleft,xright,ybot,ytop bbox. 00036 * Sets the returned integers 4 l.s.b. as follows: 00037 * bit 0 if to the left of xleft. 00038 * bit 1 if to the right of xright. 00039 * bit 2 if below of ybot. 00040 * bit 3 if above of ytop. 00041 * 0 is returned if inside. 00042 */ 00043 int sciClipPoint(integer x, integer y, SClipRegion * clipping ) ; 00044 00045 void sciClipLine( integer x1 , 00046 integer yy1 , 00047 integer x2 , 00048 integer y2 , 00049 integer * x1n , 00050 integer * yy1n , 00051 integer * x2n , 00052 integer * y2n , 00053 integer * flag , 00054 SClipRegion * clipping ) ; 00055 00056 void sciDrawInsideSegments( integer iib, 00057 integer iif, 00058 integer * vx , 00059 integer * vy , 00060 SClipRegion * clipping ) ; 00061 00062 /* draw the segement defined by (vx[index-1],vy[index-1]) (vx[index],vy[index]) */ 00063 void sciDrawOutsideSegment( integer ind, 00064 integer *vx, 00065 integer *vy, 00066 SClipRegion * clipping ) ; 00067 /* 00068 * returns the first (vx[.],vy[.]) point inside 00069 * xleft,xright,ybot,ytop bbox. begining at index ideb 00070 * or zero if the whole polyline is out 00071 */ 00072 integer sciFirstInClipRegion( integer n , 00073 integer ideb, 00074 integer * vx , 00075 integer * vy , 00076 SClipRegion * clipping ) ; 00077 /* 00078 * returns the first (vx[.],vy[.]) point outside 00079 * xleft,xright,ybot,ytop bbox. 00080 * or zero if the whole polyline is out 00081 */ 00082 integer sciFirstOutClipRegion( integer n , 00083 integer ideb, 00084 integer * vx , 00085 integer * vy , 00086 SClipRegion * clipping ) ; 00087 00088 /* 00089 * check every segment of the polyline and draw only the part which is in the 00090 * clip region 00091 */ 00092 void C2F(clipPolyLine)( integer n , 00093 integer * vx , 00094 integer * vy , 00095 integer closed, 00096 SClipRegion * clipping ) ; 00097 00098 /*----------------------------------------------------------------------------------------*/ 00099 /* 00100 * get the real clipping (the set one the axe or the window borders) 00101 * in pixels of a graphic object 00102 */ 00103 void getPixelClipping( sciPointObj * pObj, SClipRegion * clipping ) ; 00104 /*----------------------------------------------------------------------------------------*/ 00112 void sciClip ( sciPointObj * pobj ) ; 00113 00119 void sciUnClip ( sciPointObj * pobj ) ; 00120 /*----------------------------------------------------------------------------------------*/ 00124 void frame_clip_on( void ) ; 00125 00129 void frame_clip_off( void ) ; 00130 /*----------------------------------------------------------------------------------------*/ 00131 00132 #endif // __SCI_CLIPPING__
1.5.1