#include "ink.h"

Go to the source code of this file.
Functions | |
| void | draw_ink (PtrInk ink) |
| void | draw_stroke (PtrStroke stroke) |
| void | ink_draw_line (int x0, int y0, int x1, int y1) |
| int | ink_setDrawable (GdkDrawable *pDrawable) |
| void draw_ink | ( | PtrInk | ink | ) |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition at line 106 of file ink_draw.c.
00107 { 00108 int nStrokes; 00109 PtrStroke stroke = NULL; 00110 if (ink == NULL) 00111 return; 00112 00113 stroke = ink->firstStroke; 00114 nStrokes = get_num_of_strokes (ink); 00115 SB_INKPRINTF("nStrokes=%d\n", nStrokes); 00116 if (stroke == NULL || nStrokes <= 0) 00117 { 00118 return; 00119 } 00120 00121 while (stroke) 00122 { 00123 draw_stroke (stroke); 00124 stroke = stroke->nextStroke; 00125 } 00126 }

| void draw_stroke | ( | PtrStroke | stroke | ) |
Definition at line 129 of file ink_draw.c.
00130 { 00131 PtrInkPoint point = NULL; 00132 int nPoints; 00133 if (stroke == NULL) 00134 return; 00135 00136 point = stroke->firstPoint; 00137 nPoints = get_num_of_points (stroke); 00138 if (point == NULL || nPoints <= 0) 00139 return; 00140 00141 //select pensize 00142 setPenSizeAtrr(stroke->iPenSize); 00143 //set pen color 00144 setPenColorAttr(&stroke->gdkColor); 00145 00146 SB_INKPRINTF("(nPoints=%d)\n", nPoints); 00147 // only one point in the stroke 00148 if ( 1==nPoints ) 00149 { 00150 ink_draw_line(point->x, point->y,point->x, point->y); 00151 return; 00152 } 00153 00154 while (point->nextPoint) 00155 { 00156 ink_draw_line(point->x, point->y, 00157 point->nextPoint->x,point->nextPoint->y); 00158 point = point->nextPoint; 00159 } 00160 }

| void ink_draw_line | ( | int | x0, | |
| int | y0, | |||
| int | x1, | |||
| int | y1 | |||
| ) |
Definition at line 95 of file ink_draw.c.
00096 { 00097 GdkPoint points[2]; 00098 points[0].x=(gint)x0; 00099 points[0].y=(gint)y0; 00100 points[1].x=(gint)x1; 00101 points[1].y=(gint)y1; 00102 gdk_draw_lines(pCurrDrawable,pCurrGDKGC,points,2); 00103 }
| int ink_setDrawable | ( | GdkDrawable * | pDrawable | ) |
Definition at line 46 of file ink_draw.c.
00047 { 00048 //avoiding duplicated efforts 00049 if(pCurrDrawable==pDrawable) return 0; 00050 00051 pCurrDrawable=pDrawable; 00052 00053 if(pCurrGDKGC) 00054 g_object_unref(pCurrGDKGC); 00055 00056 pCurrGDKGC=gdk_gc_new(pDrawable); 00057 if(NULL==pCurrGDKGC) 00058 { 00059 SB_INKERRPRINTF("error when create GDKGC\n"); 00060 return -1; 00061 } 00062 SB_INKPRINTF("create gdk gc successfully\n"); 00063 return 0; 00064 }
1.5.6