Help with drawing lines
[email protected] (Aleksandar Nedeljkovic) Wed, 14 Oct 2009 13:48:10 +0100
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
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.