Subversion Repositories wimsdev

Rev

Rev 8419 | Rev 9652 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8419 Rev 9651
Line 28... Line 28...
28
 
28
 
29
void patchgdImageFill (gdImagePtr im, int x, int y, int color)
29
void patchgdImageFill (gdImagePtr im, int x, int y, int color)
30
{
30
{
31
   if(x>=im->sx || x<0 || y>=im->sy || y<0) return;
31
   if(x>=im->sx || x<0 || y>=im->sy || y<0) return;
32
   gdImageFill(im,x,y,color);
32
   gdImageFill(im,x,y,color);
-
 
33
}
-
 
34
 
-
 
35
 
-
 
36
#define DASHPIXELS 8
-
 
37
 
-
 
38
void myDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-
 
39
void myDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color){
-
 
40
  /**
-
 
41
   * emulates gdImageDashedLine with gdImageSetStyle and gdImageLine
-
 
42
   * GK: As gdImageDashedLine is slightly broken in latest libgd libraries,
-
 
43
   * GK: I implemented an emulation named "myDashedLine"
-
 
44
   **/
-
 
45
 
-
 
46
  int styleDashed[DASHPIXELS],i;
-
 
47
  for (i=0; i< DASHPIXELS/2; i++) styleDashed[i]=color;
-
 
48
  for (; i< DASHPIXELS; i++) styleDashed[i]=gdTransparent;
-
 
49
  gdImageSetStyle(im, styleDashed, DASHPIXELS);
-
 
50
  gdImageLine(im, x1, y1, x2, y2, gdStyled);
33
}
51
}
34
 
52
 
35
 
53
 
36
/* File opening: with security */
54
/* File opening: with security */
37
FILE *open4read(char *n)
55
FILE *open4read(char *n)
Line 176... Line 194...
176
      ii[1].x=-rint(dd[2])+ii[0].x; ii[1].y=-rint(dd[3])+ii[0].y;
194
      ii[1].x=-rint(dd[2])+ii[0].x; ii[1].y=-rint(dd[3])+ii[0].y;
177
      ii[2].x=-rint(dd[4])+ii[0].x; ii[2].y=-rint(dd[5])+ii[0].y;
195
      ii[2].x=-rint(dd[4])+ii[0].x; ii[2].y=-rint(dd[5])+ii[0].y;
178
      gdImageFilledPolygon(image, ii,3,pm->color[0]);
196
      gdImageFilledPolygon(image, ii,3,pm->color[0]);
179
    }
197
    }
180
    stem: if(pm->fill)
198
    stem: if(pm->fill)
181
      gdImageDashedLine(image,pm->p[0],pm->p[1],xx,yy,pm->color[0]);
199
      myDashedLine(image,pm->p[0],pm->p[1],xx,yy,pm->color[0]);
182
    else
200
    else
183
      gdImageLine(image,pm->p[0],pm->p[1],xx,yy,pm->color[0]);
201
      gdImageLine(image,pm->p[0],pm->p[1],xx,yy,pm->color[0]);
184
    if(vimg_enable) vimg_line(scale_buf[0],scale_buf[1],scale_buf[2],scale_buf[3]);
202
    if(vimg_enable) vimg_line(scale_buf[0],scale_buf[1],scale_buf[2],scale_buf[3]);
185
}
203
}
186
 
204
 
Line 199... Line 217...
199
/* horizontal line */
217
/* horizontal line */
200
void obj_hline(objparm *pm)
218
void obj_hline(objparm *pm)
201
{
219
{
202
    scale(pm->pd,pm->p,1);
220
    scale(pm->pd,pm->p,1);
203
    if(pm->fill)
221
    if(pm->fill)
204
      gdImageDashedLine(image,0,pm->p[1],sizex,pm->p[1],pm->color[0]);
222
      myDashedLine(image,0,pm->p[1],sizex,pm->p[1],pm->color[0]);
205
    else
223
    else
206
      gdImageLine(image,0,pm->p[1],sizex,pm->p[1],pm->color[0]);
224
      gdImageLine(image,0,pm->p[1],sizex,pm->p[1],pm->color[0]);
207
}
225
}
208
 
226
 
209
/* vertical line */
227
/* vertical line */
210
void obj_vline(objparm *pm)
228
void obj_vline(objparm *pm)
211
{
229
{
212
    scale(pm->pd,pm->p,1);
230
    scale(pm->pd,pm->p,1);
213
    if(pm->fill)
231
    if(pm->fill)
214
      gdImageDashedLine(image,pm->p[0],0,pm->p[0],sizey,pm->color[0]);
232
      myDashedLine(image,pm->p[0],0,pm->p[0],sizey,pm->color[0]);
215
    else
233
    else
216
      gdImageLine(image,pm->p[0],0,pm->p[0],sizey,pm->color[0]);
234
      gdImageLine(image,pm->p[0],0,pm->p[0],sizey,pm->color[0]);
217
}
235
}
218
 
236
 
219
/* dashed line */
237
/* dashed line */
Line 347... Line 365...
347
{
365
{
348
    int i, n;
366
    int i, n;
349
    n=(pm->pcnt)/2;
367
    n=(pm->pcnt)/2;
350
    scale(pm->pd,pm->p,n);
368
    scale(pm->pd,pm->p,n);
351
    for(i=2;i<2*n;i+=2)
369
    for(i=2;i<2*n;i+=2)
352
      gdImageDashedLine(image,pm->p[i-2],pm->p[i-1],pm->p[i],pm->p[i+1],pm->color[0]);
370
      myDashedLine(image,pm->p[i-2],pm->p[i-1],pm->p[i],pm->p[i+1],pm->color[0]);
353
    if(vimg_enable) vimg_polyline(scale_buf,n,0);
371
    if(vimg_enable) vimg_polyline(scale_buf,n,0);
354
}
372
}
355
 
373
 
356
/* points */
374
/* points */
357
void obj_points(objparm *pm)
375
void obj_points(objparm *pm)