Changeset 29814
- Timestamp:
- Nov 24, 2010, 11:53:59 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101103/Ohana/src/libkapa
- Files:
-
- 4 edited
-
include/kapa.h (modified) (4 diffs)
-
src/KapaWindow.c (modified) (2 diffs)
-
src/bDrawFuncs.c (modified) (16 diffs)
-
src/bDrawRotFont.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/Ohana/src/libkapa/include/kapa.h
r29537 r29814 115 115 116 116 typedef struct { 117 int Nx, Ny ;117 int Nx, Ny, Nbyte; 118 118 bDrawColor **pixels; 119 png_color *palette; 120 int Npalette; 121 // current drawing values: 122 int bWeight; 123 int bType; 124 bDrawColor bColor; 125 bDrawColor bColor_R; 126 bDrawColor bColor_G; 127 bDrawColor bColor_B; 119 128 } bDrawBuffer; 120 129 … … 165 174 /* KapaWindow.c */ 166 175 int KiiResize (int fd, int Nx, int Ny); 176 int KiiResizeByImage (int fd); 167 177 int KiiRelocate (int fd, int x, int y); 168 178 int KiiCenter (int fd, double x, double y, int zoom); … … 182 192 int KapaGetLimits (int fd, float *dx, float *dy); 183 193 int KapaSetSection (int fd, KapaSection *section); 194 int KapaSetSectionByImage (int fd, KapaSection *section); 184 195 int KapaSelectSection (int fd, char *name); 185 196 int KapaGetSection (int fd, char *name); … … 221 232 222 233 /* bDrawFuncs.c */ 223 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny );234 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny, int Nbyte, png_color *palette, int Npalette); 224 235 void bDrawBufferFree (bDrawBuffer *buffer); 225 236 void bDrawSetBuffer (bDrawBuffer *buffer); 226 void bDrawSetStyle (bDraw Color color, int lw, int lt);227 void bDrawPoint ( int x, int y);228 void bDrawPointf ( float x, float y);229 230 void bDrawArc ( double Xc, double Yc, double Xr, double Yr, double Ts, double Te);231 void bDrawCircle ( double Xc, double Yc, double radius);232 void bDrawCircleFill ( double xc, double yc, double radius);233 234 void bDrawLine ( double x1, double y1, double x2, double y2);235 void bDrawLineWeight ( int X1, int Y1, int X2, int Y2, int swapcoords);236 void bDrawLineBresen ( int X1, int Y1, int X2, int Y2, int swapcoords);237 void bDrawLineHorizontal ( int X1, int X2, int Y);238 void bDrawLineVertical ( int X, int Y1, int Y2);239 240 void bDrawRectOpen ( double x1, double y1, double x2, double y2);241 void bDrawRectFill ( double x1, double y1, double x2, double y2);242 void bDrawTriOpen (double x1, double y1, double x2, double y2, double x3, double y3);243 void bDrawTriFill (double x1, double y1, double x2, double y2, double x3, double y3);237 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt); 238 void bDrawPoint (bDrawBuffer *buffer, int x, int y); 239 void bDrawPointf (bDrawBuffer *buffer, float x, float y); 240 241 void bDrawArc (bDrawBuffer *buffer, double Xc, double Yc, double Xr, double Yr, double Ts, double Te); 242 void bDrawCircle (bDrawBuffer *buffer, double Xc, double Yc, double radius); 243 void bDrawCircleFill (bDrawBuffer *buffer, double xc, double yc, double radius); 244 245 void bDrawLine (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 246 void bDrawLineWeight (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords); 247 void bDrawLineBresen (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords); 248 void bDrawLineHorizontal (bDrawBuffer *buffer, int X1, int X2, int Y); 249 void bDrawLineVertical (bDrawBuffer *buffer, int X, int Y1, int Y2); 250 251 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 252 void bDrawRectFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 253 void bDrawTriOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3); 254 void bDrawTriFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3); 244 255 245 256 /* bDrawRotFont.c */ 246 int bDrawRotText ( int x, int y, char *string, int pos, double angle);247 int bDrawRotBitmap ( int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale);257 int bDrawRotText (bDrawBuffer *buffer, int x, int y, char *string, int pos, double angle); 258 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale); 248 259 249 260 /* Kapa Socket functions */ -
branches/eam_branches/ipp-20101103/Ohana/src/libkapa/src/KapaWindow.c
r27790 r29814 23 23 KiiSendCommand (fd, 4, "RSIZ"); 24 24 KiiSendMessage (fd, "%d %d", Nx, Ny); 25 KiiWaitAnswer (fd, "DONE"); 26 return (TRUE); 27 } 28 29 int KiiResizeByImage (int fd) { 30 31 KiiSendCommand (fd, 4, "ISIZ"); 25 32 KiiWaitAnswer (fd, "DONE"); 26 33 return (TRUE); … … 370 377 } 371 378 379 int KapaSetSectionByImage (int fd, KapaSection *section) { 380 381 KiiSendCommand (fd, 4, "ISEC"); 382 KiiSendMessage (fd, "%s %6.3f %6.3f %3d", 383 section[0].name, 384 section[0].x, 385 section[0].y, 386 section[0].bg); 387 KiiWaitAnswer (fd, "DONE"); 388 return (TRUE); 389 } 390 372 391 int KapaSectionBG (int fd, char *name, int bg) { 373 392 -
branches/eam_branches/ipp-20101103/Ohana/src/libkapa/src/bDrawFuncs.c
r29782 r29814 1 1 # include <kapa_internal.h> 2 3 // XXX we can get rid of these static vars by making them elements of the bDrawBuffer 4 // 5 6 7 static int bWeight; 8 static int bType; 9 static bDrawColor bColor; 10 static bDrawBuffer *bBuffer; 11 void bDrawCircleSingle (double xc, double yc, double radius); 12 13 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny) { 2 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort (); } } 3 4 // move these to the bDrawBuffer type 5 // static int bWeight; 6 // static int bType; 7 // static bDrawColor bColor; 8 // static bDrawColor bColor_R; 9 // static bDrawColor bColor_G; 10 // static bDrawColor bColor_B; 11 // static bDrawBuffer *bBuffer; 12 13 void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius); 14 15 // create a drawing buffer with either 1 or 3 byte colors 16 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny, int Nbyte, png_color *palette, int Npalette) { 14 17 15 18 int i, j; 16 bDrawColor white ;19 bDrawColor white, white_R, white_G, white_B; 17 20 bDrawBuffer *buffer; 18 21 22 myAssert((Nbyte == 1) || (Nbyte == 3), "invalid depth"); 23 myAssert(palette, "missing palette"); 24 19 25 white = KapaColorByName ("white"); 26 white_R = palette[white].red; 27 white_G = palette[white].green; 28 white_B = palette[white].blue; 20 29 21 30 ALLOCATE (buffer, bDrawBuffer, 1); 22 31 buffer[0].Nx = Nx; 23 32 buffer[0].Ny = Ny; 33 buffer[0].Nbyte = Nbyte; 34 buffer[0].palette = palette; 35 buffer[0].Npalette = Npalette; 24 36 25 37 ALLOCATE (buffer[0].pixels, bDrawColor *, Ny); 26 38 for (i = 0; i < Ny; i++) { 27 ALLOCATE (buffer[0].pixels[i], bDrawColor, N x);39 ALLOCATE (buffer[0].pixels[i], bDrawColor, Nbyte*Nx); 28 40 for (j = 0; j < Nx; j++) { 29 buffer[0].pixels[i][j] = white; 30 } 31 } 41 if (Nbyte == 1) { 42 buffer[0].pixels[i][j] = white; 43 } else { 44 buffer[0].pixels[i][3*j+0] = white_R; 45 buffer[0].pixels[i][3*j+1] = white_G; 46 buffer[0].pixels[i][3*j+2] = white_B; 47 } 48 } 49 } 50 51 buffer[0].bWeight = 0; 52 buffer[0].bType = 0; 53 buffer[0].bColor = white; 54 buffer[0].bColor_R = white_R; 55 buffer[0].bColor_G = white_G; 56 buffer[0].bColor_B = white_B; 32 57 return (buffer); 33 58 } … … 41 66 } 42 67 free (buffer[0].pixels); 68 free (buffer[0].palette); 43 69 free (buffer); 44 70 return; 45 71 } 46 72 47 void bDrawSetBuffer (bDrawBuffer *buffer) { 48 bBuffer = buffer; 49 return; 50 } 51 52 void bDrawSetStyle (bDrawColor color, int lw, int lt) { 53 bColor = color; 54 bWeight = lw; 55 bType = lt; 73 // void bDrawSetBuffer (bDrawBuffer *buffer) { 74 // myAssert(buffer[0].Nbyte == 1, "invalid depth"); 75 // bBuffer = buffer; 76 // return; 77 // } 78 79 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 80 buffer->bColor = color; 81 buffer->bColor_R = buffer->palette[color].red; 82 buffer->bColor_G = buffer->palette[color].green; 83 buffer->bColor_B = buffer->palette[color].blue; 84 buffer->bWeight = lw; 85 buffer->bType = lt; 56 86 return; 57 87 } 58 88 59 89 // draw a point in the current color 60 void bDrawPoint (int x, int y) { 61 90 void bDrawPoint (bDrawBuffer *buffer, int x, int y) { 91 92 // myAssert(buffer[0].Nbyte == 1, "invalid depth"); 62 93 if (x < 0) return; 63 94 if (y < 0) return; 64 if (x >= bBuffer[0].Nx) return; 65 if (y >= bBuffer[0].Ny) return; 66 bBuffer[0].pixels[y][x] = bColor; 95 if (x >= buffer[0].Nx) return; 96 if (y >= buffer[0].Ny) return; 97 if (buffer[0].Nbyte == 1) { 98 buffer[0].pixels[y][x] = buffer->bColor; 99 } else { 100 buffer[0].pixels[y][3*x+0] = buffer->bColor_R; 101 buffer[0].pixels[y][3*x+1] = buffer->bColor_G; 102 buffer[0].pixels[y][3*x+2] = buffer->bColor_B; 103 } 67 104 return; 68 105 } 69 106 70 107 // draw a point in the current color 71 void bDrawPointf ( float x, float y) {72 73 bDrawPoint ( ROUND(x), ROUND(y));74 return; 75 } 76 77 void bDrawTriOpen ( double x1, double y1, double x2, double y2, double x3, double y3) {78 79 bDrawLine ( x1, y1, x2, y2);80 bDrawLine ( x2, y2, x3, y3);81 bDrawLine ( x3, y3, x1, y1);82 83 return; 84 } 85 86 void bDrawRectOpen ( double x1, double y1, double x2, double y2) {108 void bDrawPointf (bDrawBuffer *buffer, float x, float y) { 109 110 bDrawPoint (buffer, ROUND(x), ROUND(y)); 111 return; 112 } 113 114 void bDrawTriOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3) { 115 116 bDrawLine (buffer, x1, y1, x2, y2); 117 bDrawLine (buffer, x2, y2, x3, y3); 118 bDrawLine (buffer, x3, y3, x1, y1); 119 120 return; 121 } 122 123 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 87 124 88 125 int X1, Y1, X2, Y2; … … 91 128 if (y1 > y2) SWAP (y1, y2); 92 129 93 X1 = MIN (MAX (ROUND (x1), 0), b Buffer[0].Nx - 1);94 X2 = MIN (MAX (ROUND (x2), 1), b Buffer[0].Nx - 1);95 96 Y1 = MIN (MAX (ROUND (y1), 0), b Buffer[0].Ny - 1);97 Y2 = MIN (MAX (ROUND (y2), 1), b Buffer[0].Ny - 1);98 99 bDrawLineHorizontal ( X1, X2, Y1);100 bDrawLineHorizontal ( X1, X2, Y2);101 bDrawLineVertical (X1, Y1, Y2);102 bDrawLineVertical (X2, Y1, Y2);103 return; 104 } 105 106 void bDrawRectFill ( double x1, double y1, double x2, double y2) {130 X1 = MIN (MAX (ROUND (x1), 0), buffer[0].Nx - 1); 131 X2 = MIN (MAX (ROUND (x2), 1), buffer[0].Nx - 1); 132 133 Y1 = MIN (MAX (ROUND (y1), 0), buffer[0].Ny - 1); 134 Y2 = MIN (MAX (ROUND (y2), 1), buffer[0].Ny - 1); 135 136 bDrawLineHorizontal (buffer, X1, X2, Y1); 137 bDrawLineHorizontal (buffer, X1, X2, Y2); 138 bDrawLineVertical (buffer, X1, Y1, Y2); 139 bDrawLineVertical (buffer, X2, Y1, Y2); 140 return; 141 } 142 143 void bDrawRectFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 107 144 108 145 int i; … … 112 149 if (y1 > y2) SWAP (y1, y2); 113 150 114 X1 = MIN (MAX (ROUND (x1), 0), b Buffer[0].Nx - 1);115 X2 = MIN (MAX (ROUND (x2), 1), b Buffer[0].Nx - 1);116 117 Y1 = MIN (MAX (ROUND (y1), 0), b Buffer[0].Ny - 1);118 Y2 = MIN (MAX (ROUND (y2), 0), b Buffer[0].Ny - 1);151 X1 = MIN (MAX (ROUND (x1), 0), buffer[0].Nx - 1); 152 X2 = MIN (MAX (ROUND (x2), 1), buffer[0].Nx - 1); 153 154 Y1 = MIN (MAX (ROUND (y1), 0), buffer[0].Ny - 1); 155 Y2 = MIN (MAX (ROUND (y2), 0), buffer[0].Ny - 1); 119 156 120 157 for (i = Y1; i < Y2; i++) { 121 bDrawLineHorizontal ( X1, X2, i);158 bDrawLineHorizontal (buffer, X1, X2, i); 122 159 } 123 160 return; … … 125 162 126 163 // identify the quadrant and draw the correct line 127 void bDrawLine ( double x1, double y1, double x2, double y2) {164 void bDrawLine (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 128 165 129 166 int FlipDirect, FlipCoords; … … 144 181 FlipDirect = FlipCoords ? (y1 > y2) : (x1 > x2); 145 182 146 if (!FlipDirect && !FlipCoords) bDrawLineWeight ( X1, Y1, X2, Y2, FALSE);147 if ( FlipDirect && !FlipCoords) bDrawLineWeight ( X2, Y2, X1, Y1, FALSE);148 if (!FlipDirect && FlipCoords) bDrawLineWeight ( Y1, X1, Y2, X2, TRUE);149 if ( FlipDirect && FlipCoords) bDrawLineWeight ( Y2, X2, Y1, X1, TRUE);183 if (!FlipDirect && !FlipCoords) bDrawLineWeight (buffer, X1, Y1, X2, Y2, FALSE); 184 if ( FlipDirect && !FlipCoords) bDrawLineWeight (buffer, X2, Y2, X1, Y1, FALSE); 185 if (!FlipDirect && FlipCoords) bDrawLineWeight (buffer, Y1, X1, Y2, X2, TRUE); 186 if ( FlipDirect && FlipCoords) bDrawLineWeight (buffer, Y2, X2, Y1, X1, TRUE); 150 187 151 188 return; … … 153 190 154 191 // draw a series of lines to give the line weight 155 void bDrawLineWeight ( int X1, int Y1, int X2, int Y2, int swapcoords) {192 void bDrawLineWeight (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords) { 156 193 157 194 int dN, dNs, dNe; 158 195 159 dNs = -0.5*(b Weight - 1);196 dNs = -0.5*(buffer->bWeight - 1); 160 197 /* 0, 0, 0, -1, -1, -2, -2 */ 161 198 162 dNe = +0.5*b Weight + 1;199 dNe = +0.5*buffer->bWeight + 1; 163 200 /* 1, 1, 2, 2, 2, 3, 3 */ 164 201 165 202 for (dN = dNs; dN < dNe; dN++) { 166 bDrawLineBresen ( X1, Y1 + dN, X2, Y2 + dN, swapcoords);203 bDrawLineBresen (buffer, X1, Y1 + dN, X2, Y2 + dN, swapcoords); 167 204 } 168 205 return; … … 171 208 // use the Bresenham line drawing technique 172 209 // integer-only Bresenham line-draw version which is fast 173 void bDrawLineBresen ( int X1, int Y1, int X2, int Y2, int swapcoords) {210 void bDrawLineBresen (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords) { 174 211 175 212 int X, Y, dX, dY; … … 185 222 e = 0; 186 223 for (X = X1, N = 0; X <= X2; X++, N++) { 187 if (b Type == 1) { DashOn = (N % 10) < 5; }188 if (b Type == 2) { DashOn = (N % 6) < 3; }224 if (buffer->bType == 1) { DashOn = (N % 10) < 5; } 225 if (buffer->bType == 2) { DashOn = (N % 6) < 3; } 189 226 if (swapcoords) { 190 if (DashOn) bDrawPoint ( Y,X);227 if (DashOn) bDrawPoint (buffer, Y,X); 191 228 } else { 192 if (DashOn) bDrawPoint ( X,Y);229 if (DashOn) bDrawPoint (buffer, X,Y); 193 230 } 194 231 e += dY; … … 206 243 } 207 244 208 void bDrawLineHorizontal ( int X1, int X2, int Y) {245 void bDrawLineHorizontal (bDrawBuffer *buffer, int X1, int X2, int Y) { 209 246 210 247 int i; 211 248 212 249 for (i = X1; i < X2; i++) { 213 bBuffer[0].pixels[Y][i] = bColor; 214 } 215 return; 216 } 217 218 void bDrawLineVertical (int X, int Y1, int Y2) { 250 if (buffer[0].Nbyte == 1) { 251 buffer[0].pixels[Y][i] = buffer->bColor; 252 } else { 253 buffer[0].pixels[Y][3*i+0] = buffer->bColor_R; 254 buffer[0].pixels[Y][3*i+1] = buffer->bColor_G; 255 buffer[0].pixels[Y][3*i+2] = buffer->bColor_B; 256 } 257 } 258 return; 259 } 260 261 void bDrawLineVertical (bDrawBuffer *buffer, int X, int Y1, int Y2) { 219 262 220 263 int i; 221 264 222 265 for (i = Y1; i < Y2; i++) { 223 bBuffer[0].pixels[i][X] = bColor; 224 } 225 return; 226 } 227 228 void bDrawTriFill (double x1, double y1, double x2, double y2, double x3, double y3) { 229 230 bDrawTriOpen (x1, y1, x2, y2, x3, y3); 231 return; 232 } 233 234 void bDrawArc (double Xc, double Yc, double Xr, double Yr, double Ts, double Te) { 266 if (buffer[0].Nbyte == 1) { 267 buffer[0].pixels[i][X] = buffer->bColor; 268 } else { 269 buffer[0].pixels[i][3*X+0] = buffer->bColor_R; 270 buffer[0].pixels[i][3*X+1] = buffer->bColor_G; 271 buffer[0].pixels[i][3*X+2] = buffer->bColor_B; 272 } 273 } 274 return; 275 } 276 277 void bDrawTriFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3) { 278 279 bDrawTriOpen (buffer, x1, y1, x2, y2, x3, y3); 280 return; 281 } 282 283 void bDrawArc (bDrawBuffer *buffer, double Xc, double Yc, double Xr, double Yr, double Ts, double Te) { 235 284 236 285 float t, dt; … … 258 307 259 308 /* we could use the value of MAX(dy/dt,dx/dt) to set dt */ 260 bDrawPoint ( x,y);309 bDrawPoint (buffer, x,y); 261 310 262 311 dt = MAX (fabs(Xr * sin(t)), fabs(Yr * cos(t))); … … 267 316 268 317 // draw a series of circles to give line weight 269 void bDrawCircle ( double xc, double yc, double radius) {318 void bDrawCircle (bDrawBuffer *buffer, double xc, double yc, double radius) { 270 319 271 320 int dN, dNs, dNe; 272 321 273 dNs = -0.5*(b Weight - 1);322 dNs = -0.5*(buffer->bWeight - 1); 274 323 /* 0, 0, 0, -1, -1, -2, -2 */ 275 324 276 dNe = +0.5*b Weight + 1;325 dNe = +0.5*buffer->bWeight + 1; 277 326 /* 1, 1, 2, 2, 2, 3, 3 */ 278 327 279 328 for (dN = dNs; dN < dNe; dN++) { 280 bDrawCircleSingle ( xc, yc, radius + dN);329 bDrawCircleSingle (buffer, xc, yc, radius + dN); 281 330 } 282 331 return; … … 284 333 285 334 // draw a pure circle 286 void bDrawCircleSingle ( double xc, double yc, double radius) {335 void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) { 287 336 288 337 int Xc, Yc, Radius; … … 300 349 301 350 while (x <= y) { 302 bDrawPoint ( Xc+x, Yc+y);303 bDrawPoint ( Xc+x, Yc-y);304 bDrawPoint ( Xc-x, Yc+y);305 bDrawPoint ( Xc-x, Yc-y);306 bDrawPoint ( Xc+y, Yc+x);307 bDrawPoint ( Xc+y, Yc-x);308 bDrawPoint ( Xc-y, Yc+x);309 bDrawPoint ( Xc-y, Yc-x);351 bDrawPoint (buffer, Xc+x, Yc+y); 352 bDrawPoint (buffer, Xc+x, Yc-y); 353 bDrawPoint (buffer, Xc-x, Yc+y); 354 bDrawPoint (buffer, Xc-x, Yc-y); 355 bDrawPoint (buffer, Xc+y, Yc+x); 356 bDrawPoint (buffer, Xc+y, Yc-x); 357 bDrawPoint (buffer, Xc-y, Yc+x); 358 bDrawPoint (buffer, Xc-y, Yc-x); 310 359 311 360 if (d < 0) { … … 322 371 323 372 // draw a pure circle 324 void bDrawCircleFill ( double xc, double yc, double radius) {373 void bDrawCircleFill (bDrawBuffer *buffer, double xc, double yc, double radius) { 325 374 326 375 int Xc, Yc, Radius; … … 338 387 339 388 while (x <= y) { 340 bDrawLineHorizontal ( Xc-x, Xc+x, Yc+y);341 bDrawLineHorizontal ( Xc-x, Xc+x, Yc-y);342 bDrawLineHorizontal ( Xc-y, Xc+y, Yc+x);343 bDrawLineHorizontal ( Xc-y, Xc+y, Yc-x);389 bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc+y); 390 bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc-y); 391 bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc+x); 392 bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc-x); 344 393 345 394 if (d < 0) { -
branches/eam_branches/ipp-20101103/Ohana/src/libkapa/src/bDrawRotFont.c
r12332 r29814 6 6 # define NEARINT(x) ((x < 0) ? ((int)(x - 0.5)) : ((int)(x + 0.5))) 7 7 8 static bDrawColor black; 9 static bDrawColor white; 10 11 int bDrawRotText (int x, int y, char *string, int pos, double angle) { 8 // XXX need to pass the rot text color here 9 // static bDrawColor black; 10 // static bDrawColor white; 11 12 int bDrawRotText (bDrawBuffer *buffer, int x, int y, char *string, int pos, double angle) { 12 13 13 14 unsigned char *bitmap; … … 19 20 RotFont *currentfont; 20 21 21 white = KapaColorByName ("white");22 black = KapaColorByName ("black");22 // white = KapaColorByName ("white"); 23 // black = KapaColorByName ("black"); 23 24 24 25 currentname = GetRotFont (¤tsize); … … 111 112 X = x + (int)(Xoff*cs - Yoff*sn) + (int)(currentscale*currentfont[N].ascent*sn); 112 113 Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(currentscale*currentfont[N].ascent*cs); 113 bDrawRotBitmap ( X, Y, dx, dy, bitmap, TRUE, angle, currentscale);114 bDrawRotBitmap (buffer, X, Y, dx, dy, bitmap, TRUE, angle, currentscale); 114 115 Xoff += 1 + (int)(currentscale*dx + 0.5); 115 116 } … … 118 119 } 119 120 120 int bDrawRotBitmap ( int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {121 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) { 121 122 122 123 int ii, jj, byte_line, byte, bit, flag; 123 bDrawColor color;124 124 double i, j, cs, sn, rscale, tmp; 125 125 int X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0; 126 126 127 127 /* this mode option is nort actually used... */ 128 if (mode) {129 color = black;130 } else {131 color = white;132 }128 // if (mode) { 129 // color = black; 130 // } else { 131 // color = white; 132 // } 133 133 134 134 byte_line = (int) ((dx + 7) / 8); … … 148 148 Y = YPROC (dx,0); 149 149 # ifdef DRAWBOXES 150 bDrawLine ( x+X, y+Y, x+X1, y+Y1);150 bDrawLine (buffer, x+X, y+Y, x+X1, y+Y1); 151 151 Xt = X; 152 152 Yt = Y; … … 160 160 Y = YPROC (dx,dy); 161 161 # ifdef DRAWBOXES 162 bDrawLine ( x+X, y+Y, x+Xt, y+Yt);162 bDrawLine (buffer, x+X, y+Y, x+Xt, y+Yt); 163 163 Xt = X; 164 164 Yt = Y; … … 172 172 Y = YPROC (0,dy); 173 173 # ifdef DRAWBOXES 174 bDrawLine ( x+X, y+Y, x+Xt, y+Yt);174 bDrawLine (buffer, x+X, y+Y, x+Xt, y+Yt); 175 175 Xt = X; 176 176 Yt = Y; … … 181 181 X2 = MAX (X, X2); 182 182 183 bDrawSetStyle (color, 0, 0);183 // bDrawSetStyle (color, 0, 0); 184 184 if (scale > 1) { 185 185 for (i = X1; i <= X2; i+=1) { … … 191 191 bit = ii % 8; 192 192 flag = 0x01 & (bitmap[byte] >> bit); 193 if (flag) bDrawPointf ( x + i, y + j);193 if (flag) bDrawPointf (buffer, x + i, y + j); 194 194 } 195 195 } … … 203 203 bit = ii % 8; 204 204 flag = 0x01 & (bitmap[byte] >> bit); 205 if (flag) bDrawPointf ( x + i, y + j);205 if (flag) bDrawPointf (buffer, x + i, y + j); 206 206 } 207 207 } 208 208 } 209 bDrawSetStyle (black, 0, 0);209 // bDrawSetStyle (black, 0, 0); 210 210 return (TRUE); 211 211 }
Note:
See TracChangeset
for help on using the changeset viewer.
