4 #include "c24lib/image/image.h"
6 static void draw_thick_line(image_t
* dst
, int x1
, int y1
, int x2
, int y2
, double vx
, double vy
, double nx
, double ny
, int th
)
8 double x
, y
, ymin
, ymax
;
21 draw_pcb_fillcr(dst
, x1
, y1
, th
/2);
25 xx
= x
- nx
* th
/ 2.0;
26 yy
= y
- ny
* th
/ 2.0;
27 for(n
= 0; n
<= th
; n
++) {
28 if ((xx
>= 0) && (xx
<= dst
->sx
) && (yy
>= 0) && (yy
<= dst
->sy
)) {
29 pixel_t
*pixel
= (dst
->pixmap
) + (int) xx
+ dst
->sx
* (int) yy
;
40 if ((y
> ymax
) || (y
< ymin
))
44 draw_pcb_fillcr(dst
, x
, y
, th
/2);
50 void draw_pcb_line(image_t
*dst
, int x1
, int y1
, int x2
, int y2
, double th
)
52 double nx
, ny
, vx
, vy
;
73 if ((x1
!= x2
) || (y1
!= y2
))
74 draw_thick_line(dst
, x1
, y1
, x2
, y2
, vx
, vy
, nx
, ny
, th
);
76 draw_pcb_fillcr(dst
, x1
, y1
, th
/2);
78 // draw_color(pixel_red);
79 // draw_line(dst, x1+nx*th/2.0, y1+ny*th, x2+nx*th, y2+ny*th/2.0);
80 // draw_line(dst, x1-nx*th/2.0, y1-ny*th, x2-nx*th, y2-ny*th/2.0);
85 static void fc_pat_gen(int r
)
88 p
= fc_pat
[r
] = malloc(sizeof(int) * (r
+1));
89 for(y
= 0; y
<= r
; y
++) {
90 double x
= (double)r
* cos(asin((double)y
/(double)r
));
95 void draw_pcb_fillcr(image_t
*dst
, int xc
, int yc
, int r
)
100 if (fc_pat
[r
] == NULL
)
105 for(y
= -r
; y
<= r
; y
++) {
120 p
= &image_pix(dst
, x1
, y
+yc
);
121 for(x
= x1
; x
<= x2
; x
++,p
++) {
125 /* p = &image_pix(dst, xc, yc);