Help with drawing lines
| From: | Aleksandar Nedeljkovic | Date: | Wed, 14 Oct 2009 12:48:10 +0000 |
| Subject: | Help with drawing lines | ||
| Groups: | php.gd.devel | ||
| Request: | Send a blank email to php-gd-devel+get-613@lists.php.net to get a copy of this message | ||
Hi,
I need to draw a various types of lines, and I have a problem with drawing
dashed lines with width greater then 1 pixel.
Here is my code:
#include "gd.h"
#include <stdio.h>
int main() {
gdImagePtr im;
int styleDotted[2], styleDashed[6];
FILE * jpegout;
int black;
int red;
im = gdImageCreate(100, 100);
black = gdImageColorAllocate(im, 0, 0, 0);
red = gdImageColorAllocate(im, 255, 0, 0);
styleDashed[0] = red;
styleDashed[1] = red;
styleDashed[2] = red;
styleDashed[3] = red;
styleDashed[4] = gdTransparent;
styleDashed[5] = gdTransparent;
gdImageSetThickness(im, 2);
gdImageSetStyle(im, styleDashed, 6);
gdImageLine(im, 0, 12, 99, 12, gdStyled);
jpegout = fopen("test3.jpg", "wb");
gdImageJpeg(im, jpegout, -1);
fclose(jpegout);
gdImageDestroy(im);
return 0;
}
Image created with this program is in attachment. Did I miss something, or
what?
Thanks in advance.