47 #define round(x) ceil((double)(x))
49 #define dprintf if(DEBUG) printf
64 rotate_point(GdkPoint point,
int angle)
72 sint = sin(-(
double)angle * M_PI / 180.0);
73 cost = cos(-(
double)angle * M_PI / 180.0);
75 returned.x = (int)round(cost * (
double)point.x - sint * (double)point.y);
76 returned.y = (int)round(sint * (
double)point.x + cost * (double)point.y);
86 gerbv_gdk_draw_prim1(GdkPixmap *pixmap, GdkGC *gc,
double *p,
87 double scale, gint x, gint y)
89 const int exposure_idx = 0;
90 const int diameter_idx = 1;
91 const int x_offset_idx = 2;
92 const int y_offset_idx = 3;
93 const gint full_circle = 23360;
94 GdkGC *local_gc = gdk_gc_new(pixmap);
95 gint dia = round(fabs(p[diameter_idx] * scale));
96 gint real_x = x - dia / 2;
97 gint real_y = y - dia / 2;
100 gdk_gc_copy(local_gc, gc);
102 real_x += (int)(p[x_offset_idx] * (
double)scale);
103 real_y -= (int)(p[y_offset_idx] * (
double)scale);
106 if (p[exposure_idx] == 0.0) {
108 gdk_gc_set_foreground(local_gc, &color);
111 gdk_gc_set_line_attributes(local_gc,
120 gdk_draw_arc(pixmap, local_gc, 1, real_x, real_y, dia, dia,
123 gdk_gc_unref(local_gc);
135 gerbv_gdk_draw_prim4(GdkPixmap *pixmap, GdkGC *gc,
double *p,
136 double scale, gint x, gint y)
138 const int exposure_idx = 0;
139 const int nuf_points_idx = 1;
140 const int first_x_idx = 2;
141 const int first_y_idx = 3;
142 const int rotext_idx = 4;
143 GdkGC *local_gc = gdk_gc_new(pixmap);
144 int nuf_points, point;
150 nuf_points = (int)p[nuf_points_idx] + 1;
151 points = (GdkPoint *)g_malloc(
sizeof(GdkPoint) * nuf_points);
157 rotation = p[(nuf_points - 1) * 2 + rotext_idx];
158 for (point = 0; point < nuf_points; point++) {
159 points[point].x = (int)round(scale * p[point * 2 + first_x_idx]);
160 points[point].y = -(int)round(scale * p[point * 2 + first_y_idx]);
162 points[point] = rotate_point(points[point], rotation);
163 points[point].x += x;
164 points[point].y += y;
167 gdk_gc_copy(local_gc, gc);
170 if (p[exposure_idx] == 0.0) {
172 gdk_gc_set_foreground(local_gc, &color);
175 gdk_gc_set_line_attributes(local_gc,
180 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
184 gdk_gc_unref(local_gc);
194 gerbv_gdk_draw_prim5(GdkPixmap *pixmap, GdkGC *gc,
double *p,
195 double scale, gint x, gint y)
197 const int exposure_idx = 0;
198 const int nuf_vertices_idx = 1;
199 const int center_x_idx = 2;
200 const int center_y_idx = 3;
201 const int diameter_idx = 4;
202 const int rotation_idx = 5;
204 double vertex, tick, rotation, radius;
206 GdkGC *local_gc = gdk_gc_new(pixmap);
209 nuf_vertices = (int)p[nuf_vertices_idx];
210 points = (GdkPoint *)g_malloc(
sizeof(GdkPoint) * nuf_vertices);
216 gdk_gc_copy(local_gc, gc);
219 if (p[exposure_idx] == 0.0) {
221 gdk_gc_set_foreground(local_gc, &color);
224 tick = 2 * M_PI / (double)nuf_vertices;
225 rotation = -p[rotation_idx] * M_PI / 180.0;
226 radius = p[diameter_idx] / 2.0;
227 for (i = 0; i < nuf_vertices; i++) {
228 vertex = tick * (double)i + rotation;
229 points[i].x = (int)round(scale * radius * cos(vertex)) + x +
231 points[i].y = (int)round(scale * radius * sin(vertex)) + y +
235 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_vertices);
237 gdk_gc_unref(local_gc);
251 gerbv_gdk_draw_prim6(GdkPixmap *pixmap, GdkGC *gc,
double *p,
252 double scale, gint x, gint y)
254 const int outside_dia_idx = 2;
255 const int ci_thickness_idx = 3;
256 const int gap_idx = 4;
257 const int nuf_circles_idx = 5;
258 const int ch_thickness_idx = 6;
259 const int ch_length_idx = 7;
260 const int rotation_idx = 8;
261 GdkGC *local_gc = gdk_gc_new(pixmap);
263 double real_dia_diff;
265 GdkPoint crosshair[4];
268 gdk_gc_copy(local_gc, gc);
269 gdk_gc_set_line_attributes(local_gc,
270 (
int)round(scale * p[ci_thickness_idx]),
275 real_dia = p[outside_dia_idx] - p[ci_thickness_idx] / 2.0;
276 real_dia_diff = 2*(p[gap_idx] + p[ci_thickness_idx]);
278 for (circle = 0; circle != (int)p[nuf_circles_idx]; circle++) {
282 const gint full_circle = 23360;
283 gint dia = (real_dia - real_dia_diff * circle) * scale;
285 gdk_draw_arc(pixmap, local_gc, 0, x - dia / 2, y - dia / 2,
286 dia, dia, 0, full_circle);
293 memset(crosshair, 0,
sizeof(GdkPoint) * 4);
294 crosshair[0].x = (int)((p[ch_length_idx] / 2.0) * scale);
296 crosshair[1].x = -crosshair[0].x;
299 crosshair[2].y = crosshair[0].x;
301 crosshair[3].y = -crosshair[0].x;
303 gdk_gc_set_line_attributes(local_gc,
304 (
int)round(scale * p[ch_thickness_idx]),
309 for (point = 0; point < 4; point++) {
310 crosshair[point] = rotate_point(crosshair[point],
312 crosshair[point].x += x;
313 crosshair[point].y += y;
315 gdk_draw_line(pixmap, local_gc,
316 crosshair[0].x, crosshair[0].y,
317 crosshair[1].x, crosshair[1].y);
318 gdk_draw_line(pixmap, local_gc,
319 crosshair[2].x, crosshair[2].y,
320 crosshair[3].x, crosshair[3].y);
322 gdk_gc_unref(local_gc);
329 gerbv_gdk_draw_prim7(GdkPixmap *pixmap, GdkGC *gc,
double *p,
330 double scale, gint x, gint y)
332 const int outside_dia_idx = 2;
333 const int inside_dia_idx = 3;
334 const int ch_thickness_idx = 4;
335 const int rotation_idx = 5;
336 const gint full_circle = 23360;
339 GdkGC *local_gc = gdk_gc_new(pixmap);
341 double ci_thickness = (p[outside_dia_idx] -
342 p[inside_dia_idx]) / 2.0;
344 gdk_gc_copy(local_gc, gc);
345 gdk_gc_set_line_attributes(local_gc,
346 (
int)round(scale * ci_thickness),
354 diameter = (p[inside_dia_idx] + ci_thickness) * scale;
355 gdk_draw_arc(pixmap, local_gc, 0, x - diameter / 2, y - diameter / 2,
356 diameter, diameter, 0, full_circle);
365 for (i = 0; i < 4; i++) {
366 point[i].x = round((p[outside_dia_idx] / 2.0) * scale) + 2;
368 point[i] = rotate_point(point[i], p[rotation_idx] + 90 * i);
373 gdk_gc_set_line_attributes(local_gc,
374 (
int)round(scale * p[ch_thickness_idx]),
380 gdk_gc_get_values(local_gc, &gc_val);
381 if (gc_val.foreground.pixel == 1)
382 gc_val.foreground.pixel = 0;
384 gc_val.foreground.pixel = 1;
385 gdk_gc_set_foreground(local_gc, &(gc_val.foreground));
388 gdk_draw_line(pixmap, local_gc,
389 point[0].x, point[0].y, point[2].x, point[2].y);
390 gdk_draw_line(pixmap, local_gc,
391 point[1].x, point[1].y, point[3].x, point[3].y);
393 gdk_gc_unref(local_gc);
403 gerbv_gdk_draw_prim20(GdkPixmap *pixmap, GdkGC *gc,
double *p,
404 double scale, gint x, gint y)
406 const int exposure_idx = 0;
407 const int linewidth_idx = 1;
408 const int start_x_idx = 2;
409 const int start_y_idx = 3;
410 const int end_x_idx = 4;
411 const int end_y_idx = 5;
412 const int rotation_idx = 6;
413 const int nuf_points = 2;
414 GdkGC *local_gc = gdk_gc_new(pixmap);
415 GdkPoint points[nuf_points];
419 gdk_gc_copy(local_gc, gc);
422 if (p[exposure_idx] == 0.0) {
424 gdk_gc_set_foreground(local_gc, &color);
427 gdk_gc_set_line_attributes(local_gc,
428 (
int)round(scale * p[linewidth_idx]),
433 points[0].x = (p[start_x_idx] * scale);
434 points[0].y = (p[start_y_idx] * scale);
435 points[1].x = (p[end_x_idx] * scale);
436 points[1].y = (p[end_y_idx] * scale);
438 for (i = 0; i < nuf_points; i++) {
439 points[i] = rotate_point(points[i], -p[rotation_idx]);
440 points[i].x = x + points[i].x;
441 points[i].y = y - points[i].y;
444 gdk_draw_line(pixmap, local_gc,
445 points[0].x, points[0].y,
446 points[1].x, points[1].y);
448 gdk_gc_unref(local_gc);
455 gerbv_gdk_draw_prim21(GdkPixmap *pixmap, GdkGC *gc,
double *p,
456 double scale, gint x, gint y)
458 const int exposure_idx = 0;
459 const int width_idx = 1;
460 const int height_idx = 2;
461 const int exp_x_idx = 3;
462 const int exp_y_idx = 4;
463 const int rotation_idx = 5;
464 const int nuf_points = 4;
465 GdkPoint points[nuf_points];
467 GdkGC *local_gc = gdk_gc_new(pixmap);
468 int half_width, half_height;
471 half_width = (int)round(p[width_idx] * scale / 2.0);
472 half_height =(int)round(p[height_idx] * scale / 2.0);
474 points[0].x = half_width;
475 points[0].y = half_height;
477 points[1].x = half_width;
478 points[1].y = -half_height;
480 points[2].x = -half_width;
481 points[2].y = -half_height;
483 points[3].x = -half_width;
484 points[3].y = half_height;
486 for (i = 0; i < nuf_points; i++) {
487 points[i] = rotate_point(points[i], p[rotation_idx]);
488 points[i].x += (x + (int)(p[exp_x_idx] * scale));
489 points[i].y += (y - (int)(p[exp_y_idx] * scale));
492 gdk_gc_copy(local_gc, gc);
495 if (p[exposure_idx] == 0.0) {
497 gdk_gc_set_foreground(local_gc, &color);
500 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
502 gdk_gc_unref(local_gc);
512 gerbv_gdk_draw_prim22(GdkPixmap *pixmap, GdkGC *gc,
double *p,
513 double scale, gint x, gint y)
515 const int exposure_idx = 0;
516 const int width_idx = 1;
517 const int height_idx = 2;
518 const int x_lower_left_idx = 3;
519 const int y_lower_left_idx = 4;
520 const int rotation_idx = 5;
521 const int nuf_points = 4;
522 GdkPoint points[nuf_points];
523 GdkGC *local_gc = gdk_gc_new(pixmap);
527 points[0].x = (int)round(p[x_lower_left_idx] * scale);
528 points[0].y = (int)round(p[y_lower_left_idx] * scale);
530 points[1].x = (int)round((p[x_lower_left_idx] + p[width_idx])
532 points[1].y = (int)round(p[y_lower_left_idx] * scale);
534 points[2].x = (int)round((p[x_lower_left_idx] + p[width_idx])
536 points[2].y = (int)round((p[y_lower_left_idx] + p[height_idx])
539 points[3].x = (int)round(p[x_lower_left_idx] * scale);
540 points[3].y = (int)round((p[y_lower_left_idx] + p[height_idx])
543 for (i = 0; i < nuf_points; i++) {
544 points[i] = rotate_point(points[i], p[rotation_idx]);
545 points[i].x = x + points[i].x;
546 points[i].y = y - points[i].y;
549 gdk_gc_copy(local_gc, gc);
552 if (p[exposure_idx] == 0.0) {
554 gdk_gc_set_foreground(local_gc, &color);
557 gdk_draw_polygon(pixmap, local_gc, 1, points, nuf_points);
559 gdk_gc_unref(local_gc);
566 gerbv_gdk_draw_amacro(GdkPixmap *pixmap, GdkGC *gc,
567 gerbv_simplified_amacro_t *s,
double scale,
570 gerbv_simplified_amacro_t *ls = s;
572 dprintf(_(
"Drawing simplified aperture macros:\n"));
577 gerbv_gdk_draw_prim1(pixmap, gc, ls->parameter, scale, x, y);
578 dprintf(_(
" Circle\n"));
581 gerbv_gdk_draw_prim4(pixmap, gc, ls->parameter, scale, x, y);
582 dprintf(_(
" Outline\n"));
585 gerbv_gdk_draw_prim5(pixmap, gc, ls->parameter, scale, x, y);
586 dprintf(_(
" Polygon\n"));
589 gerbv_gdk_draw_prim6(pixmap, gc, ls->parameter, scale, x, y);
590 dprintf(_(
" Moire\n"));
593 gerbv_gdk_draw_prim7(pixmap, gc, ls->parameter, scale, x, y);
594 dprintf(_(
" Thermal\n"));
597 gerbv_gdk_draw_prim20(pixmap, gc, ls->parameter, scale, x, y);
598 dprintf(_(
" Line 20\n"));
601 gerbv_gdk_draw_prim21(pixmap, gc, ls->parameter, scale, x, y);
602 dprintf(_(
" Line 21\n"));
605 gerbv_gdk_draw_prim22(pixmap, gc, ls->parameter, scale, x, y);
606 dprintf(_(
" Line 22\n"));
609 GERB_FATAL_ERROR(_(
"Unknown simplified aperture macro"));
622 gerbv_gdk_draw_circle(GdkPixmap *pixmap, GdkGC *gc,
623 gint filled, gint x, gint y, gint dia)
625 static const gint full_circle = 23360;
626 gint real_x = x - dia / 2;
627 gint real_y = y - dia / 2;
629 gdk_draw_arc(pixmap, gc, filled, real_x, real_y, dia, dia, 0, full_circle);
639 gerbv_gdk_draw_rectangle(GdkPixmap *pixmap, GdkGC *gc,
640 gint filled, gint x, gint y, gint x_side, gint y_side)
643 gint real_x = x - x_side / 2;
644 gint real_y = y - y_side / 2;
646 gdk_draw_rectangle(pixmap, gc, filled, real_x, real_y, x_side, y_side);
656 gerbv_gdk_draw_oval(GdkPixmap *pixmap, GdkGC *gc,
657 gint filled, gint x, gint y, gint x_axis, gint y_axis)
660 GdkGC *local_gc = gdk_gc_new(pixmap);
662 gdk_gc_copy(local_gc, gc);
664 if (x_axis > y_axis) {
666 delta = x_axis / 2 - y_axis / 2;
667 gdk_gc_set_line_attributes(local_gc, y_axis,
671 gdk_draw_line(pixmap, local_gc, x - delta, y, x + delta, y);
674 delta = y_axis / 2 - x_axis / 2;
675 gdk_gc_set_line_attributes(local_gc, x_axis,
679 gdk_draw_line(pixmap, local_gc, x, y - delta, x, y + delta);
682 gdk_gc_unref(local_gc);
694 gerbv_gdk_draw_arc(GdkPixmap *pixmap, GdkGC *gc,
696 int width,
int height,
697 double angle1,
double angle2)
699 gint real_x = x - width / 2;
700 gint real_y = y - height / 2;
702 gdk_draw_arc(pixmap, gc, FALSE, real_x, real_y, width, height,
703 (gint)(angle1 * 64.0), (gint)(((angle2 - angle1) * 64.0)));
710 cairo_matrix_t *fullMatrix, cairo_matrix_t *scaleMatrix, GdkGC *gc, GdkGC *pgc,
711 GdkPixmap **pixmap) {
713 gint x2,y2,cp_x=0,cp_y=0,cir_width=0;
714 GdkPoint *points = NULL;
715 int pointArraySize=0;
716 int curr_point_idx = 0;
718 gdouble angleDiff, tempX, tempY;
725 for (currentNet = oldNet->
next; currentNet!=NULL; currentNet = currentNet->
next){
726 tempX = currentNet->
stop_x + sr_x;
727 tempY = currentNet->
stop_y + sr_y;
728 cairo_matrix_transform_point (fullMatrix, &tempX, &tempY);
729 x2 = (int)round(tempX);
730 y2 = (int)round(tempY);
736 tempX = currentNet->
cirseg->width;
737 tempY = currentNet->
cirseg->height;
738 cairo_matrix_transform_point (scaleMatrix, &tempX, &tempY);
739 cir_width = (int)round(tempX);
741 tempX = currentNet->
cirseg->cp_x + sr_x;
742 tempY = currentNet->
cirseg->cp_y + sr_y;
743 cairo_matrix_transform_point (fullMatrix, &tempX, &tempY);
744 cp_x = (int)round(tempX);
745 cp_y = (int)round(tempY);
753 if (pointArraySize < (curr_point_idx + 1)) {
754 points = (GdkPoint *)g_realloc(points,
sizeof(GdkPoint) * (curr_point_idx + 1));
755 pointArraySize = (curr_point_idx + 1);
757 points[curr_point_idx].x = x2;
758 points[curr_point_idx].y = y2;
765 angleDiff = currentNet->
cirseg->angle2 - currentNet->
cirseg->angle1;
766 steps = (int) abs(angleDiff);
767 if (pointArraySize < (curr_point_idx + steps)) {
768 points = (GdkPoint *)g_realloc(points,
sizeof(GdkPoint) * (curr_point_idx + steps));
769 pointArraySize = (curr_point_idx + steps);
771 for (i=0; i<steps; i++){
772 points[curr_point_idx].x = cp_x + cir_width / 2.0 * cos ((currentNet->
cirseg->angle1 +
773 (angleDiff * i) / steps)*M_PI/180);
774 points[curr_point_idx].y = cp_y - cir_width / 2.0 * sin ((currentNet->
cirseg->angle1 +
775 (angleDiff * i) / steps)*M_PI/180);
780 gdk_gc_copy(pgc, gc);
781 gdk_gc_set_line_attributes(pgc, 1,
785 gdk_draw_polygon(*pixmap, pgc, 1, points, curr_point_idx);
797 draw_gdk_apply_netstate_transformation (cairo_matrix_t *fullMatrix, cairo_matrix_t *scaleMatrix,
800 cairo_matrix_scale (fullMatrix, state->
scaleA, state->
scaleB);
801 cairo_matrix_scale (scaleMatrix, state->
scaleA, state->
scaleB);
803 cairo_matrix_translate (fullMatrix, state->
offsetA, state->
offsetB);
806 case GERBV_MIRROR_STATE_FLIPA:
807 cairo_matrix_scale (fullMatrix, -1, 1);
808 cairo_matrix_scale (scaleMatrix, -1, 1);
810 case GERBV_MIRROR_STATE_FLIPB:
811 cairo_matrix_scale (fullMatrix, 1, -1);
812 cairo_matrix_scale (scaleMatrix, -1, 1);
814 case GERBV_MIRROR_STATE_FLIPAB:
815 cairo_matrix_scale (fullMatrix, -1, -1);
816 cairo_matrix_scale (scaleMatrix, -1, 1);
822 if (state->
axisSelect == GERBV_AXIS_SELECT_SWAPAB) {
825 cairo_matrix_rotate (fullMatrix, 3 * M_PI / 2);
826 cairo_matrix_scale (fullMatrix, 1, -1);
834 draw_gdk_image_to_pixmap(GdkPixmap **pixmap,
gerbv_image_t *image,
835 double scale,
double trans_x,
double trans_y,
840 GdkGC *gc = gdk_gc_new(*pixmap);
841 GdkGC *pgc = gdk_gc_new(*pixmap);
842 GdkGCValues gc_values;
847 glong xlong1, ylong1, xlong2, ylong2;
849 int cir_width = 0, cir_height = 0;
850 int cp_x = 0, cp_y = 0;
851 GdkColor transparent, opaque;
854 gdouble minX=0,minY=0,maxX=0,maxY=0;
862 polarity = image->
info->polarity;
864 if (drawMode == DRAW_SELECTIONS)
867 gboolean useOptimizations = TRUE;
872 (fabs(transform.
scaleX - 1) > 0.00001) ||
873 (fabs(transform.
scaleY - 1) > 0.00001) ||
874 (fabs(transform.
rotation) > 0.00001) ||
876 useOptimizations = FALSE;
879 cairo_matrix_t fullMatrix, scaleMatrix;
880 cairo_matrix_init (&fullMatrix, 1, 0, 0, 1, 0, 0);
881 cairo_matrix_init (&scaleMatrix, 1, 0, 0, 1, 0, 0);
883 cairo_matrix_translate (&fullMatrix, trans_x, trans_y);
884 cairo_matrix_scale (&fullMatrix, scale, scale);
885 cairo_matrix_scale (&scaleMatrix, scale, scale);
890 gdouble scaleX = transform.
scaleX;
891 gdouble scaleY = -1*transform.
scaleY;
892 cairo_matrix_scale (&scaleMatrix, scaleX, -1*scaleY);
898 cairo_matrix_scale (&fullMatrix, scaleX, scaleY);
900 cairo_matrix_rotate (&fullMatrix, transform.
rotation);
904 cairo_matrix_rotate (&fullMatrix, image->
info->imageRotation);
906 if (useOptimizations) {
915 if (image == NULL || image->
netlist == NULL) {
927 transparent.pixel = 1;
933 gdk_gc_set_foreground(gc, &transparent);
934 gdk_draw_rectangle(*pixmap, gc, TRUE, 0, 0, -1, -1);
935 gdk_gc_set_foreground(gc, &opaque);
937 gdk_gc_set_foreground(gc, &opaque);
938 gdk_draw_rectangle(*pixmap, gc, TRUE, 0, 0, -1, -1);
939 gdk_gc_set_foreground(gc, &transparent);
944 int repeat_X=1, repeat_Y=1;
945 double repeat_dist_X=0.0, repeat_dist_Y=0.0;
946 int repeat_i, repeat_j;
957 if (net->
state != oldState){
960 draw_gdk_apply_netstate_transformation (&fullMatrix, &scaleMatrix, net->
state);
961 oldState = net->
state;
965 if (net->
layer != oldLayer){
967 oldLayer = net->
layer;
970 if (drawMode == DRAW_SELECTIONS) {
972 gboolean foundNet = FALSE;
974 for (i=0; i<selectionInfo->selectedNodeArray->len; i++){
975 gerbv_selection_item_t sItem = g_array_index (selectionInfo->selectedNodeArray,
976 gerbv_selection_item_t, i);
977 if (sItem.net == net)
984 for(repeat_i = 0; repeat_i < repeat_X; repeat_i++) {
985 for(repeat_j = 0; repeat_j < repeat_Y; repeat_j++) {
986 double sr_x = repeat_i * repeat_dist_X;
987 double sr_y = repeat_j * repeat_dist_Y;
1000 tempX = net->
cirseg->width;
1001 tempY = net->
cirseg->height;
1002 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1003 cir_width = (int)round(tempX);
1004 cir_height = (int)round(tempY);
1006 tempX = net->
cirseg->cp_x;
1007 tempY = net->
cirseg->cp_y;
1008 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1009 cp_x = (int)round(tempX);
1010 cp_y = (int)round(tempY);
1017 gdk_gc_set_function(gc, GDK_COPY);
1019 gdk_gc_set_foreground(gc, &opaque);
1021 gdk_gc_set_foreground(gc, &transparent);
1028 draw_gdk_render_polygon_object (net,image,sr_x,sr_y,&fullMatrix,
1029 &scaleMatrix,gc,pgc,pixmap);
1057 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1058 xlong1 = (int)round(tempX);
1059 ylong1 = (int)round(tempY);
1061 tempX = net->
stop_x + sr_x;
1062 tempY = net->
stop_y + sr_y;
1063 cairo_matrix_transform_point (&fullMatrix, &tempX, &tempY);
1064 xlong2 = (int)round(tempX);
1065 ylong2 = (int)round(tempY);
1069 if ((xlong1 < -10000) && (xlong2 < -10000))
1071 if ((ylong1 < -10000) && (ylong2 < -10000))
1073 if ((xlong1 > 10000) && (xlong2 > 10000))
1075 if ((ylong1 > 10000) && (ylong2 > 10000))
1078 if (xlong1 > G_MAXINT) x1 = G_MAXINT;
1079 else if (xlong1 < G_MININT) x1 = G_MININT;
1080 else x1 = (int)xlong1;
1082 if (xlong2 > G_MAXINT) x2 = G_MAXINT;
1083 else if (xlong2 < G_MININT) x2 = G_MININT;
1084 else x2 = (int)xlong2;
1086 if (ylong1 > G_MAXINT) y1 = G_MAXINT;
1087 else if (ylong1 < G_MININT) y1 = G_MININT;
1088 else y1 = (int)ylong1;
1090 if (ylong2 > G_MAXINT) y2 = G_MAXINT;
1091 else if (ylong2 < G_MININT) y2 = G_MININT;
1092 else y2 = (int)ylong2;
1097 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1098 p1 = (int)round(tempX);
1102 gdk_gc_set_line_attributes(gc, p1,
1107 gdk_gc_set_line_attributes(gc, p1,
1116 GERB_MESSAGE(_(
"Linear != x1"));
1117 gdk_gc_set_line_attributes(gc, p1,
1118 GDK_LINE_ON_OFF_DASH,
1121 gdk_draw_line(*pixmap, gc, x1, y1, x2, y2);
1122 gdk_gc_set_line_attributes(gc, p1,
1129 gdk_draw_line(*pixmap, gc, x1, y1, x2, y2);
1136 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1137 dx = (int)round(tempX);
1138 dy = (int)round(tempY);
1140 if(x1 > x2) dx = -dx;
1141 if(y1 > y2) dy = -dy;
1142 poly[0].x = x1 - dx; poly[0].y = y1 - dy;
1143 poly[1].x = x1 - dx; poly[1].y = y1 + dy;
1144 poly[2].x = x2 - dx; poly[2].y = y2 + dy;
1145 poly[3].x = x2 + dx; poly[3].y = y2 + dy;
1146 poly[4].x = x2 + dx; poly[4].y = y2 - dy;
1147 poly[5].x = x1 + dx; poly[5].y = y1 - dy;
1148 gdk_draw_polygon(*pixmap, gc, 1, poly, 6);
1153 gerbv_gdk_draw_arc(*pixmap, gc, cp_x, cp_y, cir_width, cir_height,
1165 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1166 p1 = (int)round(tempX);
1167 p2 = (int)round(tempY);
1169 cairo_matrix_transform_point (&scaleMatrix, &tempX, &tempY);
1173 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p1);
1181 gdk_gc_get_values(gc, &gc_values);
1182 if (gc_values.foreground.pixel == opaque.pixel) {
1183 gdk_gc_set_foreground(gc, &transparent);
1184 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p2);
1185 gdk_gc_set_foreground(gc, &opaque);
1187 gdk_gc_set_foreground(gc, &opaque);
1188 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p2);
1189 gdk_gc_set_foreground(gc, &transparent);
1195 gerbv_gdk_draw_rectangle(*pixmap, gc, TRUE, x2, y2, p1, p2);
1198 gerbv_gdk_draw_oval(*pixmap, gc, TRUE, x2, y2, p1, p2);
1201 gerbv_gdk_draw_circle(*pixmap, gc, TRUE, x2, y2, p1);
1204 gerbv_gdk_draw_amacro(*pixmap, gc,
1209 GERB_MESSAGE(_(
"Unknown aperture type"));
1214 GERB_MESSAGE(_(
"Unknown aperture state"));