47 #define round(x) ceil((double)(x))
50 #define DPRINTF(...) do { if (DEBUG) printf(__VA_ARGS__); } while (0)
65 rotate_point(GdkPoint point,
double angle)
73 sint = sin(DEG2RAD(-angle));
74 cost = cos(DEG2RAD(-angle));
76 returned.x = lround(cost*point.x - sint*point.y);
77 returned.y = lround(sint*point.x + cost*point.y);
87 gerbv_gdk_draw_prim1(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
88 double scale, gint x, gint y)
90 const int exposure_idx = 0;
91 const int diameter_idx = 1;
92 const int x_offset_idx = 2;
93 const int y_offset_idx = 3;
94 const int rotation_idx = 4;
95 const gint full_circle = 23360;
96 GdkGC *local_gc = gdk_gc_new(pixmap);
97 gint dia = round(fabs(s->parameter[diameter_idx] * scale));
98 gint real_x = x - dia / 2;
99 gint real_y = y - dia / 2;
103 gdk_gc_copy(local_gc, gc);
105 center.x = (int)(s->parameter[x_offset_idx] * (
double)scale);
106 center.y = -(int)(s->parameter[y_offset_idx] * (
double)scale);
107 center = rotate_point(center, s->parameter[rotation_idx]);
112 if (s->parameter[exposure_idx] == 0.0) {
114 gdk_gc_set_foreground(local_gc, &color);
117 gdk_gc_set_line_attributes(local_gc,
126 gdk_draw_arc(pixmap, local_gc, 1, real_x, real_y, dia, dia,
129 gdk_gc_unref(local_gc);
141 gerbv_gdk_draw_prim4(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
142 double scale, gint x, gint y)
144 const int exposure_idx = 0;
145 const int nuf_points_idx = 1;
146 const int first_x_idx = 2;
147 const int first_y_idx = 3;
148 const int rotext_idx = 4;
149 GdkGC *local_gc = gdk_gc_new(pixmap);
150 int nuf_points, point;
156 nuf_points = (int)s->parameter[nuf_points_idx] + 1;
157 points = g_new(GdkPoint, nuf_points);
163 rotation = s->parameter[(nuf_points - 1) * 2 + rotext_idx];
164 for (point = 0; point < nuf_points; point++) {
165 points[point].x = (int)round(scale * s->parameter[point * 2 + first_x_idx]);
166 points[point].y = -(int)round(scale * s->parameter[point * 2 + first_y_idx]);
168 points[point] = rotate_point(points[point], rotation);
169 points[point].x += x;
170 points[point].y += y;
173 gdk_gc_copy(local_gc, gc);
176 if (s->parameter[exposure_idx] == 0.0) {
178 gdk_gc_set_foreground(local_gc, &color);
181 gdk_gc_set_line_attributes(local_gc,
186 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
190 gdk_gc_unref(local_gc);
200 gerbv_gdk_draw_prim5(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
201 double scale, gint x, gint y)
203 const int exposure_idx = 0;
204 const int nuf_vertices_idx = 1;
205 const int center_x_idx = 2;
206 const int center_y_idx = 3;
207 const int diameter_idx = 4;
208 const int rotation_idx = 5;
210 double vertex, tick, rotation, radius;
212 GdkGC *local_gc = gdk_gc_new(pixmap);
215 nuf_vertices = (int)s->parameter[nuf_vertices_idx];
216 points = g_new(GdkPoint, nuf_vertices);
222 gdk_gc_copy(local_gc, gc);
225 if (s->parameter[exposure_idx] == 0.0) {
227 gdk_gc_set_foreground(local_gc, &color);
230 tick = 2 * M_PI / (double)nuf_vertices;
231 rotation = DEG2RAD(-s->parameter[rotation_idx]);
232 radius = s->parameter[diameter_idx] / 2.0;
233 for (i = 0; i < nuf_vertices; i++) {
234 vertex = tick * (double)i + rotation;
235 points[i].x = (int)round(scale * (radius * cos(vertex) + s->parameter[center_x_idx])) + x;
236 points[i].y = (int)round(scale * (radius * sin(vertex) - s->parameter[center_y_idx])) + y;
239 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_vertices);
241 gdk_gc_unref(local_gc);
255 gerbv_gdk_draw_prim6(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
256 double scale, gint x, gint y)
258 const int outside_dia_idx = 2;
259 const int ci_thickness_idx = 3;
260 const int gap_idx = 4;
261 const int nuf_circles_idx = 5;
262 const int ch_thickness_idx = 6;
263 const int ch_length_idx = 7;
264 const int rotation_idx = 8;
265 GdkGC *local_gc = gdk_gc_new(pixmap);
267 double real_dia_diff;
269 GdkPoint crosshair[4];
272 gdk_gc_copy(local_gc, gc);
273 gdk_gc_set_line_attributes(local_gc,
274 (
int)round(scale * s->parameter[ci_thickness_idx]),
279 real_dia = s->parameter[outside_dia_idx] - s->parameter[ci_thickness_idx] / 2.0;
280 real_dia_diff = 2*(s->parameter[gap_idx] + s->parameter[ci_thickness_idx]);
282 for (circle = 0; circle != (int)s->parameter[nuf_circles_idx]; circle++) {
286 const gint full_circle = 23360;
287 gint dia = (real_dia - real_dia_diff * circle) * scale;
289 gdk_draw_arc(pixmap, local_gc, 0, x - dia / 2, y - dia / 2,
290 dia, dia, 0, full_circle);
297 memset(crosshair, 0,
sizeof(GdkPoint) * 4);
298 crosshair[0].x = (int)((s->parameter[ch_length_idx] / 2.0) * scale);
300 crosshair[1].x = -crosshair[0].x;
303 crosshair[2].y = crosshair[0].x;
305 crosshair[3].y = -crosshair[0].x;
307 gdk_gc_set_line_attributes(local_gc,
308 (
int)round(scale * s->parameter[ch_thickness_idx]),
313 for (point = 0; point < 4; point++) {
314 crosshair[point] = rotate_point(crosshair[point],
315 s->parameter[rotation_idx]);
316 crosshair[point].x += x;
317 crosshair[point].y += y;
319 gdk_draw_line(pixmap, local_gc,
320 crosshair[0].x, crosshair[0].y,
321 crosshair[1].x, crosshair[1].y);
322 gdk_draw_line(pixmap, local_gc,
323 crosshair[2].x, crosshair[2].y,
324 crosshair[3].x, crosshair[3].y);
326 gdk_gc_unref(local_gc);
333 gerbv_gdk_draw_prim7(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
334 double scale, gint x, gint y)
336 const int outside_dia_idx = 2;
337 const int inside_dia_idx = 3;
338 const int ch_thickness_idx = 4;
339 const int rotation_idx = 5;
340 const gint full_circle = 23360;
343 GdkGC *local_gc = gdk_gc_new(pixmap);
345 double ci_thickness = (s->parameter[outside_dia_idx] -
346 s->parameter[inside_dia_idx]) / 2.0;
348 gdk_gc_copy(local_gc, gc);
349 gdk_gc_set_line_attributes(local_gc,
350 (
int)round(scale * ci_thickness),
358 diameter = (s->parameter[inside_dia_idx] + ci_thickness) * scale;
359 gdk_draw_arc(pixmap, local_gc, 0, x - diameter / 2, y - diameter / 2,
360 diameter, diameter, 0, full_circle);
369 for (i = 0; i < 4; i++) {
370 point[i].x = round((s->parameter[outside_dia_idx] / 2.0) * scale) + 2;
372 point[i] = rotate_point(point[i], s->parameter[rotation_idx] + 90 * i);
377 gdk_gc_set_line_attributes(local_gc,
378 (
int)round(scale * s->parameter[ch_thickness_idx]),
384 gdk_gc_get_values(local_gc, &gc_val);
385 if (gc_val.foreground.pixel == 1)
386 gc_val.foreground.pixel = 0;
388 gc_val.foreground.pixel = 1;
389 gdk_gc_set_foreground(local_gc, &(gc_val.foreground));
392 gdk_draw_line(pixmap, local_gc,
393 point[0].x, point[0].y, point[2].x, point[2].y);
394 gdk_draw_line(pixmap, local_gc,
395 point[1].x, point[1].y, point[3].x, point[3].y);
397 gdk_gc_unref(local_gc);
407 gerbv_gdk_draw_prim20(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
408 double scale, gint x, gint y)
410 const int exposure_idx = 0;
411 const int linewidth_idx = 1;
412 const int start_x_idx = 2;
413 const int start_y_idx = 3;
414 const int end_x_idx = 4;
415 const int end_y_idx = 5;
416 const int rotation_idx = 6;
417 const int nuf_points = 2;
418 GdkGC *local_gc = gdk_gc_new(pixmap);
419 GdkPoint points[nuf_points];
423 gdk_gc_copy(local_gc, gc);
426 if (s->parameter[exposure_idx] == 0.0) {
428 gdk_gc_set_foreground(local_gc, &color);
431 gdk_gc_set_line_attributes(local_gc,
432 (
int)round(scale * s->parameter[linewidth_idx]),
437 points[0].x = (s->parameter[start_x_idx] * scale);
438 points[0].y = (s->parameter[start_y_idx] * scale);
439 points[1].x = (s->parameter[end_x_idx] * scale);
440 points[1].y = (s->parameter[end_y_idx] * scale);
442 for (i = 0; i < nuf_points; i++) {
443 points[i] = rotate_point(points[i], -s->parameter[rotation_idx]);
444 points[i].x = x + points[i].x;
445 points[i].y = y - points[i].y;
448 gdk_draw_line(pixmap, local_gc,
449 points[0].x, points[0].y,
450 points[1].x, points[1].y);
452 gdk_gc_unref(local_gc);
459 gerbv_gdk_draw_prim21(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
460 double scale, gint x, gint y)
462 const int exposure_idx = 0;
463 const int width_idx = 1;
464 const int height_idx = 2;
465 const int exp_x_idx = 3;
466 const int exp_y_idx = 4;
467 const int rotation_idx = 5;
468 const int nuf_points = 4;
469 GdkPoint points[nuf_points];
471 GdkGC *local_gc = gdk_gc_new(pixmap);
472 int half_width, half_height;
475 half_width = (int)round(s->parameter[width_idx] * scale / 2.0);
476 half_height =(int)round(s->parameter[height_idx] * scale / 2.0);
478 points[0].x = half_width;
479 points[0].y = half_height;
481 points[1].x = half_width;
482 points[1].y = -half_height;
484 points[2].x = -half_width;
485 points[2].y = -half_height;
487 points[3].x = -half_width;
488 points[3].y = half_height;
490 for (i = 0; i < nuf_points; i++) {
491 points[i].x += (int)(s->parameter[exp_x_idx] * scale);
492 points[i].y -= (int)(s->parameter[exp_y_idx] * scale);
493 points[i] = rotate_point(points[i], s->parameter[rotation_idx]);
498 gdk_gc_copy(local_gc, gc);
501 if (s->parameter[exposure_idx] == 0.0) {
503 gdk_gc_set_foreground(local_gc, &color);
506 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
508 gdk_gc_unref(local_gc);
518 gerbv_gdk_draw_prim22(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s,
519 double scale, gint x, gint y)
521 const int exposure_idx = 0;
522 const int width_idx = 1;
523 const int height_idx = 2;
524 const int x_lower_left_idx = 3;
525 const int y_lower_left_idx = 4;
526 const int rotation_idx = 5;
527 const int nuf_points = 4;
528 GdkPoint points[nuf_points];
529 GdkGC *local_gc = gdk_gc_new(pixmap);
533 points[0].x = (int)round(s->parameter[x_lower_left_idx] * scale);
534 points[0].y = (int)round(s->parameter[y_lower_left_idx] * scale);
536 points[1].x = (int)round((s->parameter[x_lower_left_idx] + s->parameter[width_idx])
538 points[1].y = (int)round(s->parameter[y_lower_left_idx] * scale);
540 points[2].x = (int)round((s->parameter[x_lower_left_idx] + s->parameter[width_idx])
542 points[2].y = (int)round((s->parameter[y_lower_left_idx] + s->parameter[height_idx])
545 points[3].x = (int)round(s->parameter[x_lower_left_idx] * scale);
546 points[3].y = (int)round((s->parameter[y_lower_left_idx] + s->parameter[height_idx])
549 for (i = 0; i < nuf_points; i++) {
550 points[i] = rotate_point(points[i], -s->parameter[rotation_idx]);
551 points[i].x = x + points[i].x;
552 points[i].y = y - points[i].y;
555 gdk_gc_copy(local_gc, gc);
558 if (s->parameter[exposure_idx] == 0.0) {
560 gdk_gc_set_foreground(local_gc, &color);
563 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
565 gdk_gc_unref(local_gc);
571 static void (*dgk_draw_amacro_funcs[])(GdkPixmap *, GdkGC *, gerbv_simplified_amacro_t *,
572 double, gint, gint) = {
584 gerbv_gdk_draw_amacro(GdkPixmap *pixmap, GdkGC *gc,
585 gerbv_simplified_amacro_t *s,
double scale,
588 DPRINTF(
"%s(): drawing simplified aperture macros:\n", __func__);
593 dgk_draw_amacro_funcs[s->type](pixmap, gc,
598 _(
"Unknown simplified aperture macro type %d"),
611 gerbv_gdk_draw_circle(GdkPixmap *pixmap, GdkGC *gc,
612 gint filled, gint x, gint y, gint dia)
614 static const gint full_circle = 23360;
615 gint real_x = x - dia / 2;
616 gint real_y = y - dia / 2;
618 gdk_draw_arc(pixmap, gc, filled, real_x, real_y, dia, dia, 0, full_circle);
628 gerbv_gdk_draw_rectangle(GdkPixmap *pixmap, GdkGC *gc,
629 int filled, gint x, gint y, gint x_side, gint y_side,
635 points[0].x = -(x_side >> 1);
636 points[0].y = -(y_side >> 1);
637 points[1].x = x_side >> 1;
638 points[1].y = points[0].y;
639 points[2].x = points[1].x;
640 points[2].y = y_side >> 1;
641 points[3].x = points[0].x;
642 points[3].y = points[2].y;
644 for (i = 0; i < 4; i++) {
645 points[i] = rotate_point(points[i], angle_deg);
650 gdk_draw_polygon(pixmap, gc, filled, points, 4);
660 gerbv_gdk_draw_oval(GdkPixmap *pixmap, GdkGC *gc,
661 int filled, gint x, gint y, gint x_axis, gint y_axis,
666 GdkGC *local_gc = gdk_gc_new(pixmap);
668 gdk_gc_copy(local_gc, gc);
670 if (x_axis > y_axis) {
674 points[0].x = -(x_axis >> 1) + (y_axis >> 1);
676 points[1].x = (x_axis >> 1) - (y_axis >> 1);
683 points[0].y = -(y_axis >> 1) + (x_axis >> 1);
685 points[1].y = (y_axis >> 1) - (x_axis >> 1);
688 points[0] = rotate_point(points[0], angle_deg);
691 points[1] = rotate_point(points[1], angle_deg);
695 gdk_gc_set_line_attributes(local_gc, width,
696 GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_MITER);
697 gdk_draw_line(pixmap, local_gc,
698 points[0].x, points[0].y,
699 points[1].x, points[1].y);
701 gdk_gc_unref(local_gc);
713 gerbv_gdk_draw_arc(GdkPixmap *pixmap, GdkGC *gc,
715 gdouble width, gdouble height,
716 double angle1,
double angle2)
718 gint real_x = round(x - width / 2);
719 gint real_y = round(y - height / 2);
721 gdk_draw_arc(pixmap, gc, FALSE, real_x, real_y, width, height,
722 round(64*fmod(angle1, 360)), round(64*(angle2 - angle1)));
727 cairo_matrix_t *fullMatrix, cairo_matrix_t *scaleMatrix, GdkGC *gc, GdkGC *pgc,
728 GdkPixmap **pixmap) {
730 gint x2,y2,cp_x=0,cp_y=0,cir_width=0;
731 GdkPoint *points = NULL;
732 unsigned int pointArraySize, curr_point_idx;
734 gdouble angleDiff, tempX, tempY;
741 for (currentNet = oldNet->
next; currentNet!=NULL; currentNet = currentNet->
next){
742 tempX = currentNet->
stop_x + sr_x;
743 tempY = currentNet->
stop_y + sr_y;
744 cairo_matrix_transform_point (fullMatrix, &tempX, &tempY);
745 x2 = (int)round(tempX);
746 y2 = (int)round(tempY);
752 tempX = currentNet->
cirseg->width;
753 tempY = currentNet->
cirseg->height;
754 cairo_matrix_transform_point (scaleMatrix, &tempX, &tempY);
758 cir_width = (int)round(tempX);
760 tempX = currentNet->
cirseg->cp_x + sr_x;
761 tempY = currentNet->
cirseg->cp_y + sr_y;
762 cairo_matrix_transform_point (fullMatrix, &tempX, &tempY);
763 cp_x = (int)round(tempX);
764 cp_y = (int)round(tempY);
772 if (pointArraySize < (curr_point_idx + 1)) {
773 pointArraySize = curr_point_idx + 1;
774 points = (GdkPoint *)g_realloc(points,
775 pointArraySize*
sizeof(GdkPoint));
777 points[curr_point_idx].x = x2;
778 points[curr_point_idx].y = y2;
785 angleDiff = currentNet->
cirseg->angle2 - currentNet->
cirseg->angle1;
786 steps = (int) fabs(angleDiff);
787 if (pointArraySize < (curr_point_idx + steps)) {
788 pointArraySize = curr_point_idx + steps;
789 points = (GdkPoint *)g_realloc(points,
790 pointArraySize*
sizeof(GdkPoint));
792 for (i=0; i<steps; i++){
793 points[curr_point_idx].x = cp_x + cir_width / 2.0 * cos (DEG2RAD(currentNet->
cirseg->angle1 +
794 (angleDiff * i) / steps));
795 points[curr_point_idx].y = cp_y - cir_width / 2.0 * sin (DEG2RAD(currentNet->
cirseg->angle1 +
796 (angleDiff * i) / steps));
801 gdk_gc_copy(pgc, gc);
802 gdk_gc_set_line_attributes(pgc, 1,
806 gdk_draw_polygon(*pixmap, pgc, 1, points, curr_point_idx);
811 GERB_COMPILE_WARNING(
812 _(
"Skipped interpolation type %d"),
821 draw_gdk_apply_netstate_transformation (cairo_matrix_t *fullMatrix, cairo_matrix_t *scaleMatrix,
824 cairo_matrix_scale (fullMatrix, state->
scaleA, state->
scaleB);
825 cairo_matrix_scale (scaleMatrix, state->
scaleA, state->
scaleB);
827 cairo_matrix_translate (fullMatrix, state->
offsetA, state->
offsetB);
830 case GERBV_MIRROR_STATE_FLIPA:
831 cairo_matrix_scale (fullMatrix, -1, 1);
832 cairo_matrix_scale (scaleMatrix, -1, 1);
834 case GERBV_MIRROR_STATE_FLIPB:
835 cairo_matrix_scale (fullMatrix, 1, -1);
836 cairo_matrix_scale (scaleMatrix, -1, 1);
838 case GERBV_MIRROR_STATE_FLIPAB:
839 cairo_matrix_scale (fullMatrix, -1, -1);
840 cairo_matrix_scale (scaleMatrix, -1, 1);
846 if (state->
axisSelect == GERBV_AXIS_SELECT_SWAPAB) {
849 cairo_matrix_rotate (fullMatrix, M_PI + M_PI_2);
850 cairo_matrix_scale (fullMatrix, 1, -1);
855 draw_gdk_cross (GdkPixmap *pixmap, GdkGC *gc, gint xc, gint yc, gint r)
857 gdk_gc_set_line_attributes (gc, 1, GDK_LINE_SOLID,
858 GDK_CAP_BUTT, GDK_JOIN_MITER);
859 gdk_draw_line (pixmap, gc, xc - r, yc, xc + r, yc);
860 gdk_draw_line (pixmap, gc, xc, yc - r, xc, yc + r);
867 draw_gdk_image_to_pixmap(GdkPixmap **pixmap,
gerbv_image_t *image,
868 double scale,
double trans_x,
double trans_y,
869 enum draw_mode drawMode,
873 const int hole_cross_inc_px = 8;
874 GdkGC *gc = gdk_gc_new(*pixmap);
875 GdkGC *pgc = gdk_gc_new(*pixmap);
876 GdkGCValues gc_values;
881 glong xlong1, ylong1, xlong2, ylong2;
883 double cir_width = 0, cir_height = 0;
884 int cp_x = 0, cp_y = 0;
885 GdkColor transparent, opaque;
887 gdouble tempX, tempY, r;
888 gdouble minX=0,minY=0,maxX=0,maxY=0;
890 if (image == NULL || image->
netlist == NULL) {
903 polarity = image->
info->polarity;
905 if (drawMode == DRAW_SELECTIONS)
908 gboolean useOptimizations = TRUE;
911 if (fabs(transform.
translateX) > GERBV_PRECISION_LINEAR_INCH
912 || fabs(transform.
translateY) > GERBV_PRECISION_LINEAR_INCH
913 || fabs(transform.
scaleX - 1) > GERBV_PRECISION_LINEAR_INCH
914 || fabs(transform.
scaleY - 1) > GERBV_PRECISION_LINEAR_INCH
915 || fabs(transform.
rotation) > GERBV_PRECISION_ANGLE_RAD
917 useOptimizations = FALSE;
920 cairo_matrix_t fullMatrix, scaleMatrix;
921 cairo_matrix_init (&fullMatrix, 1, 0, 0, 1, 0, 0);
922 cairo_matrix_init (&scaleMatrix, 1, 0, 0, 1, 0, 0);
924 cairo_matrix_translate (&fullMatrix, trans_x, trans_y);
925 cairo_matrix_scale (&fullMatrix, scale, scale);
926 cairo_matrix_scale (&scaleMatrix, scale, scale);
931 gdouble scaleX = transform.
scaleX;
932 gdouble scaleY = -1*transform.
scaleY;
933 cairo_matrix_scale (&scaleMatrix, scaleX, -1*scaleY);
939 cairo_matrix_scale (&fullMatrix, scaleX, scaleY);
941 cairo_matrix_rotate (&fullMatrix, transform.
rotation);
945 cairo_matrix_rotate (&fullMatrix, image->
info->imageRotation);
947 if (useOptimizations) {
958 transparent.pixel = 1;
964 gdk_gc_set_foreground(gc, &transparent);
965 gdk_draw_rectangle(*pixmap, gc, TRUE, 0, 0, -1, -1);
966 gdk_gc_set_foreground(gc, &opaque);
968 gdk_gc_set_foreground(gc, &opaque);
969 gdk_draw_rectangle(*pixmap, gc, TRUE, 0, 0, -1, -1);
970 gdk_gc_set_foreground(gc, &transparent);
975 int repeat_X=1, repeat_Y=1;
976 double repeat_dist_X=0.0, repeat_dist_Y=0.0;
977 int repeat_i, repeat_j;
988 if (net->
state != oldState){
991 draw_gdk_apply_netstate_transformation (&fullMatrix, &scaleMatrix, net->
state);
992 oldState = net->
state;
996 if (net->
layer != oldLayer){
998 oldLayer = net->
layer;
1001 if (drawMode == DRAW_SELECTIONS) {
1002 gboolean foundNet = FALSE;
1003 gerbv_selection_item_t sItem;
1005 for (guint i = 0; i < selectionInfo->selectedNodeArray->len; i++) {
1006 sItem = g_array_index (selectionInfo->selectedNodeArray,
1007 gerbv_selection_item_t, i);
1008 if (sItem.net == net) {
1017 for(repeat_i = 0; repeat_i < repeat_X; repeat_i++) {
1018 for(repeat_j = 0; repeat_j < repeat_Y; repeat_j++) {
1019 double sr_x = repeat_i * repeat_dist_X;
1020 double sr_y = repeat_j * repeat_dist_Y;
1033 tempX = net->
cirseg->width;
1034 tempY = net->
cirseg->height;
1035 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1038 tempX = fabs(tempX);
1039 tempY = fabs(tempY);
1043 tempX = net->
cirseg->cp_x;
1044 tempY = net->
cirseg->cp_y;
1045 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1046 cp_x = (int)round(tempX);
1047 cp_y = (int)round(tempY);
1054 gdk_gc_set_function(gc, GDK_COPY);
1056 gdk_gc_set_foreground(gc, &opaque);
1058 gdk_gc_set_foreground(gc, &transparent);
1065 draw_gdk_render_polygon_object (net,image,sr_x,sr_y,&fullMatrix,
1066 &scaleMatrix,gc,pgc,pixmap);
1094 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1095 xlong1 = (int)round(tempX);
1096 ylong1 = (int)round(tempY);
1098 tempX = net->
stop_x + sr_x;
1099 tempY = net->
stop_y + sr_y;
1100 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1101 xlong2 = (int)round(tempX);
1102 ylong2 = (int)round(tempY);
1106 if ((xlong1 < -10000) && (xlong2 < -10000))
1108 if ((ylong1 < -10000) && (ylong2 < -10000))
1110 if ((xlong1 > 10000) && (xlong2 > 10000))
1112 if ((ylong1 > 10000) && (ylong2 > 10000))
1115 if (xlong1 > G_MAXINT) x1 = G_MAXINT;
1116 else if (xlong1 < G_MININT) x1 = G_MININT;
1117 else x1 = (int)xlong1;
1119 if (xlong2 > G_MAXINT) x2 = G_MAXINT;
1120 else if (xlong2 < G_MININT) x2 = G_MININT;
1121 else x2 = (int)xlong2;
1123 if (ylong1 > G_MAXINT) y1 = G_MAXINT;
1124 else if (ylong1 < G_MININT) y1 = G_MININT;
1125 else y1 = (int)ylong1;
1127 if (ylong2 > G_MAXINT) y2 = G_MAXINT;
1128 else if (ylong2 < G_MININT) y2 = G_MININT;
1129 else y2 = (int)ylong2;
1134 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1137 tempX = fabs(tempX);
1138 p1 = (int)round(tempX);
1140 gdk_gc_set_line_attributes(gc, p1, GDK_LINE_SOLID,
1142 GDK_CAP_PROJECTING: GDK_CAP_ROUND,
1149 GERB_MESSAGE(_(
"Linear != x1"));
1150 gdk_gc_set_line_attributes(gc, p1,
1151 GDK_LINE_ON_OFF_DASH,
1154 gdk_draw_line(*pixmap, gc, x1, y1, x2, y2);
1155 gdk_gc_set_line_attributes(gc, p1,
1162 gdk_draw_line(*pixmap, gc, x1, y1, x2, y2);
1167 r = p1/2.0 + hole_cross_inc_px;
1168 draw_gdk_cross(*pixmap, gc, x1, y1, r);
1169 draw_gdk_cross(*pixmap, gc, x2, y2, r);
1179 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1180 dx = (int)round(tempX);
1181 dy = (int)round(tempY);
1183 if(x1 > x2) dx = -dx;
1184 if(y1 > y2) dy = -dy;
1185 poly[0].x = x1 - dx; poly[0].y = y1 - dy;
1186 poly[1].x = x1 - dx; poly[1].y = y1 + dy;
1187 poly[2].x = x2 - dx; poly[2].y = y2 + dy;
1188 poly[3].x = x2 + dx; poly[3].y = y2 + dy;
1189 poly[4].x = x2 + dx; poly[4].y = y2 - dy;
1190 poly[5].x = x1 + dx; poly[5].y = y1 - dy;
1191 gdk_draw_polygon(*pixmap, gc, 1, poly, 6);
1196 gerbv_gdk_draw_arc(*pixmap, gc, cp_x, cp_y,
1197 cir_width, cir_height,
1204 GERB_COMPILE_WARNING(
1205 _(
"Skipped interpolation type %d"),
1215 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1218 tempX = fabs(tempX);
1219 tempY = fabs(tempY);
1220 p1 = (int)round(tempX);
1221 p2 = (int)round(tempY);
1225 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p1);
1229 r = p1/2.0 + hole_cross_inc_px;
1230 draw_gdk_cross(*pixmap, gc, x2, y2, r);
1240 gdk_gc_get_values(gc, &gc_values);
1241 if (gc_values.foreground.pixel == opaque.pixel) {
1242 gdk_gc_set_foreground(gc, &transparent);
1243 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p2);
1244 gdk_gc_set_foreground(gc, &opaque);
1246 gdk_gc_set_foreground(gc, &opaque);
1247 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p2);
1248 gdk_gc_set_foreground(gc, &transparent);
1254 gerbv_gdk_draw_rectangle(*pixmap, gc, TRUE,
1255 x2, y2, p1, p2, RAD2DEG(transform.
rotation +
1256 image->
info->imageRotation));
1259 gerbv_gdk_draw_oval(*pixmap, gc, TRUE,
1260 x2, y2, p1, p2, RAD2DEG(transform.
rotation +
1261 image->
info->imageRotation));
1265 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p1);
1269 gerbv_gdk_draw_amacro(*pixmap, gc,
1274 GERB_MESSAGE(_(
"Unknown aperture type %d"),
1280 GERB_MESSAGE(_(
"Unknown aperture state %d"),
Header info for the GDK rendering functions.
gerbv_net_t * gerbv_image_return_next_renderable_object(gerbv_net_t *oldNet)
Return the next net entry which corresponds to a unique visible object.
const char * gerbv_aperture_type_name(gerbv_aperture_type_t type)
Return string name of gerbv_aperture_type_t aperture type.
The main header file for the libgerbv library.
@ GERBV_APERTURE_STATE_OFF
@ GERBV_APERTURE_STATE_ON
@ GERBV_APERTURE_STATE_FLASH
@ GERBV_POLARITY_NEGATIVE
@ GERBV_POLARITY_POSITIVE
@ GERBV_APTYPE_MACRO_LINE20
@ GERBV_APTYPE_MACRO_LINE21
@ GERBV_APTYPE_MACRO_OUTLINE
@ GERBV_APTYPE_MACRO_CIRCLE
@ GERBV_APTYPE_MACRO_POLYGON
@ GERBV_APTYPE_MACRO_THERMAL
@ GERBV_APTYPE_MACRO_LINE22
@ GERBV_APTYPE_MACRO_MOIRE
@ GERBV_INTERPOLATION_LINEARx01
@ GERBV_INTERPOLATION_PAREA_START
@ GERBV_INTERPOLATION_LINEARx001
@ GERBV_INTERPOLATION_DELETED
@ GERBV_INTERPOLATION_CW_CIRCULAR
@ GERBV_INTERPOLATION_PAREA_END
@ GERBV_INTERPOLATION_LINEARx10
@ GERBV_INTERPOLATION_CCW_CIRCULAR
@ GERBV_INTERPOLATION_LINEARx1
gerbv_layertype_t layertype
gerbv_aperture_t * aperture[APERTURE_MAX]
gerbv_netstate_t * states
gerbv_image_info_t * info
gerbv_step_and_repeat_t stepAndRepeat
gerbv_polarity_t polarity
gerbv_render_size_t boundingBox
gerbv_aperture_state_t aperture_state
gerbv_interpolation_t interpolation
gerbv_axis_select_t axisSelect
gerbv_mirror_state_t mirrorState
gboolean show_cross_on_drill_holes