43 } gerb_translation_entry_t;
71 image->
info->min_x = HUGE_VAL;
72 image->
info->min_y = HUGE_VAL;
73 image->
info->max_x = -HUGE_VAL;
74 image->
info->max_y = -HUGE_VAL;
92 image->
info->type = g_strdup(_(
"unknown"));
94 image->
info->type = g_strdup(type);
97 image->
info->attr_list = NULL;
98 image->
info->n_attr = 0;
109 gerbv_simplified_amacro_t *sam, *sam2;
117 for (i = 0; i < APERTURE_MAX; i++)
119 for (sam = image->
aperture[i]->simplified; sam != NULL;) {
134 free_amacro(image->
amacro);
147 g_free(image->
info->name);
148 g_free(image->
info->type);
149 gerbv_attribute_destroy_HID_attribute(image->
info->attr_list, image->
info->n_attr);
156 for (net = image->
netlist; net != NULL;) {
159 if (tmp->
cirseg != NULL) {
164 g_string_free(tmp->
label, TRUE);
169 for (layer = image->
layers; layer != NULL;) {
173 g_free(tempLayer->
name);
176 for (state = image->
states; state != NULL;) {
206 gerb_verify_error_t error = GERB_IMAGE_OK;
212 error |= GERB_IMAGE_MISSING_NETLIST;
213 if (image->
format == NULL)
214 error |= GERB_IMAGE_MISSING_FORMAT;
215 if (image->
info == NULL)
216 error |= GERB_IMAGE_MISSING_INFO;
228 for (i = 0; i < APERTURE_MAX && image->
aperture[i] == NULL; i++)
230 if (i == APERTURE_MAX)
231 error |= GERB_IMAGE_MISSING_APERTURES;
243 default: printf(_(
"..state unknown"));
251 gerbv_aperture_t*
const* aperture;
255 printf(_(
"Apertures:\n"));
257 for (i = 0; i < APERTURE_MAX; i++) {
259 printf(_(
" Aperture no:%d is an "), i);
260 switch (aperture[i]->type) {
266 default: printf(_(
"unknown"));
268 for (j = 0; j < aperture[i]->nuf_parameters; j++) {
269 printf(
" %f", aperture[i]->parameter[j]);
290 *newLayer = *previousLayer;
291 previousLayer->
next = newLayer;
293 newLayer->
knockout.firstInstance = FALSE;
294 newLayer->
name = NULL;
295 newLayer->
next = NULL;
304 *newState = *previousState;
305 previousState->
next = newState;
308 newState->
next = NULL;
317 *newLayer = *oldLayer;
318 newLayer->
name = g_strdup(oldLayer->
name);
326 *newState = *oldState;
330 static gerbv_aperture_t*
331 gerbv_image_duplicate_aperture(gerbv_aperture_t* oldAperture) {
332 gerbv_aperture_t* newAperture = g_new0(gerbv_aperture_t, 1);
333 gerbv_simplified_amacro_t *simplifiedMacro, *tempSimplified;
335 *newAperture = *oldAperture;
339 newAperture->amacro = NULL;
340 newAperture->simplified = NULL;
343 tempSimplified = NULL;
344 for (simplifiedMacro = oldAperture->simplified; simplifiedMacro != NULL; simplifiedMacro = simplifiedMacro->next) {
345 gerbv_simplified_amacro_t* newSimplified = g_new0(gerbv_simplified_amacro_t, 1);
346 *newSimplified = *simplifiedMacro;
348 tempSimplified->next = newSimplified;
350 newAperture->simplified = newSimplified;
351 tempSimplified = newSimplified;
357 gerbv_image_copy_all_nets(
366 gerbv_aperture_t* aper;
367 gerbv_simplified_amacro_t* sam;
368 int* trans_apers = NULL;
369 int aper_last_id = 0;
370 guint err_scale_circle = 0, err_scale_line_macro = 0, err_scale_poly_macro = 0, err_scale_thermo_macro = 0,
371 err_scale_moire_macro = 0, err_unknown_aperture = 0, err_unknown_macro_aperture = 0, err_rotate_oval = 0,
377 _(
"Exporting mirrored file "
386 _(
"Exporting inverted file "
395 for (aper_last_id = APERTURE_MAX - 1; aper_last_id > 0; aper_last_id--) {
396 if (destImage->
aperture[aper_last_id] != NULL)
400 trans_apers = g_new(
int, aper_last_id + 1);
402 for (
int i = 0; i < aper_last_id + 1; i++)
406 for (currentNet = sourceImage->
netlist; currentNet != NULL; currentNet = currentNet->
next) {
409 if (currentNet->
layer != lastLayer) {
410 lastLayer->
next = gerbv_image_duplicate_layer(currentNet->
layer);
411 lastLayer = lastLayer->
next;
415 if (currentNet->
state != lastState) {
416 lastState->
next = gerbv_image_duplicate_state(currentNet->
state);
417 lastState = lastState->
next;
422 *newNet = *currentNet;
425 newNet->
cirseg = g_new(gerbv_cirseg_t, 1);
429 if (currentNet->
label)
430 newNet->
label = g_string_new(currentNet->
label->str);
432 newNet->
label = NULL;
434 newNet->
state = lastState;
435 newNet->
layer = lastLayer;
438 lastNet->
next = newNet;
445 if (translationTable) {
446 for (guint i = 0; i < translationTable->len; i++) {
447 gerb_translation_entry_t translationEntry;
449 translationEntry = g_array_index(translationTable, gerb_translation_entry_t, i);
451 if (translationEntry.oldAperture == newNet->
aperture) {
452 newNet->
aperture = translationEntry.newAperture;
474 if (trans->
scaleX == 1.0 && trans->
scaleY == 1.0 && fabs(trans->
rotation) < GERBV_PRECISION_ANGLE_RAD)
478 if (trans_apers[newNet->
aperture] != -1) {
495 aper = gerbv_image_duplicate_aperture(destImage->
aperture[newNet->
aperture]);
496 aper->parameter[0] *= trans->
scaleX;
498 trans_apers[newNet->
aperture] = ++aper_last_id;
499 destImage->
aperture[aper_last_id] = aper;
509 && fabs(fabs(trans->
rotation) - M_PI) < GERBV_PRECISION_ANGLE_RAD)
512 aper = gerbv_image_duplicate_aperture(destImage->
aperture[newNet->
aperture]);
513 aper->parameter[0] *= trans->
scaleX;
514 aper->parameter[1] *= trans->
scaleY;
516 if (fabs(fabs(trans->
rotation) - M_PI_2) < GERBV_PRECISION_ANGLE_RAD
517 || fabs(fabs(trans->
rotation) - (M_PI + M_PI_2)) < GERBV_PRECISION_ANGLE_RAD) {
518 double t = aper->parameter[0];
519 aper->parameter[0] = aper->parameter[1];
520 aper->parameter[1] = t;
530 trans_apers[newNet->
aperture] = ++aper_last_id;
531 destImage->
aperture[aper_last_id] = aper;
537 aper = gerbv_image_duplicate_aperture(destImage->
aperture[newNet->
aperture]);
538 sam = aper->simplified;
540 for (; sam != NULL; sam = sam->next) {
545 sam->parameter[CIRCLE_CENTER_X] *= trans->
scaleX;
546 sam->parameter[CIRCLE_CENTER_Y] *= trans->
scaleY;
548 sam->parameter + CIRCLE_CENTER_X, sam->parameter + CIRCLE_CENTER_Y, trans->
rotation
555 sam->parameter[CIRCLE_DIAMETER] *= trans->
scaleX;
561 sam->parameter[LINE20_LINE_WIDTH] *= trans->
scaleX;
562 }
else if (sam->parameter[LINE20_START_X] == sam->parameter[LINE20_END_X]) {
563 sam->parameter[LINE20_LINE_WIDTH] *= trans->
scaleX;
564 }
else if (sam->parameter[LINE20_START_Y] == sam->parameter[LINE20_END_Y]) {
565 sam->parameter[LINE20_LINE_WIDTH] *= trans->
scaleY;
568 err_scale_line_macro++;
572 sam->parameter[LINE20_START_X] *= trans->
scaleX;
573 sam->parameter[LINE20_START_Y] *= trans->
scaleY;
574 sam->parameter[LINE20_END_X] *= trans->
scaleX;
575 sam->parameter[LINE20_END_Y] *= trans->
scaleY;
580 sam->parameter[LINE20_ROTATION] += RAD2DEG(trans->
rotation);
584 #if (LINE21_WIDTH != LINE22_WIDTH) || (LINE21_HEIGHT != LINE22_HEIGHT) || (LINE21_ROTATION != LINE22_ROTATION) \
585 || (LINE21_CENTER_X != LINE22_LOWER_LEFT_X) || (LINE21_CENTER_Y != LINE22_LOWER_LEFT_Y)
586 #error "LINE21 and LINE22 indexes are not equal"
598 sam->parameter[LINE21_WIDTH] *= trans->
scaleX;
599 sam->parameter[LINE21_HEIGHT] *= trans->
scaleX;
601 }
else if (fabs(sam->parameter[LINE21_ROTATION]) == 0 || fabs(sam->parameter[LINE21_ROTATION]) == 180) {
602 sam->parameter[LINE21_WIDTH] *= trans->
scaleX;
603 sam->parameter[LINE21_HEIGHT] *= trans->
scaleY;
605 }
else if (fabs(sam->parameter[LINE21_ROTATION]) == 90 || fabs(sam->parameter[LINE21_ROTATION]) == 270) {
607 t = sam->parameter[LINE21_WIDTH];
608 sam->parameter[LINE21_WIDTH] = trans->
scaleY * sam->parameter[LINE21_HEIGHT];
609 sam->parameter[LINE21_HEIGHT] = trans->
scaleX * t;
612 err_scale_line_macro++;
616 sam->parameter[LINE21_CENTER_X] *= trans->
scaleX;
617 sam->parameter[LINE21_CENTER_Y] *= trans->
scaleY;
619 sam->parameter[LINE21_ROTATION] += RAD2DEG(trans->
rotation);
621 sam->parameter + LINE21_CENTER_X, sam->parameter + LINE21_CENTER_Y, trans->
rotation
626 for (
int i = 0; i < 1 + sam->parameter[OUTLINE_NUMBER_OF_POINTS]; i++) {
627 sam->parameter[OUTLINE_X_IDX_OF_POINT(i)] *= trans->
scaleX;
628 sam->parameter[OUTLINE_Y_IDX_OF_POINT(i)] *= trans->
scaleY;
631 sam->parameter[OUTLINE_ROTATION_IDX(sam->parameter)] += RAD2DEG(trans->
rotation);
637 gerbv_selection_item_t sItem = {sourceImage, currentNet};
638 selection_add_item (&screen.selectionInfo, &sItem);
644 sam->parameter[POLYGON_CENTER_X] *= trans->
scaleX;
645 sam->parameter[POLYGON_CENTER_Y] *= trans->
scaleX;
646 sam->parameter[POLYGON_DIAMETER] *= trans->
scaleX;
649 err_scale_poly_macro++;
653 sam->parameter[POLYGON_ROTATION] += RAD2DEG(trans->
rotation);
658 sam->parameter[MOIRE_CENTER_X] *= trans->
scaleX;
659 sam->parameter[MOIRE_CENTER_Y] *= trans->
scaleX;
660 sam->parameter[MOIRE_OUTSIDE_DIAMETER] *= trans->
scaleX;
661 sam->parameter[MOIRE_CIRCLE_THICKNESS] *= trans->
scaleX;
662 sam->parameter[MOIRE_GAP_WIDTH] *= trans->
scaleX;
663 sam->parameter[MOIRE_CROSSHAIR_THICKNESS] *= trans->
scaleX;
664 sam->parameter[MOIRE_CROSSHAIR_LENGTH] *= trans->
scaleX;
666 err_scale_moire_macro++;
670 sam->parameter[MOIRE_ROTATION] += RAD2DEG(trans->
rotation);
675 sam->parameter[THERMAL_CENTER_X] *= trans->
scaleX;
676 sam->parameter[THERMAL_CENTER_Y] *= trans->
scaleX;
677 sam->parameter[THERMAL_INSIDE_DIAMETER] *= trans->
scaleX;
678 sam->parameter[THERMAL_OUTSIDE_DIAMETER] *= trans->
scaleX;
679 sam->parameter[THERMAL_CROSSHAIR_THICKNESS] *= trans->
scaleX;
681 err_scale_thermo_macro++;
685 sam->parameter[THERMAL_ROTATION] += RAD2DEG(trans->
rotation);
690 err_unknown_macro_aperture++;
694 trans_apers[newNet->
aperture] = ++aper_last_id;
695 destImage->
aperture[aper_last_id] = aper;
699 default: err_unknown_aperture++;
706 "Can't rotate %u rectangular aperture to %.2f "
707 "degrees (non 90 multiply)!",
708 "Can't rotate %u rectangular apertures to %.2f "
709 "degrees (non 90 multiply)!",
712 err_rotate_rect, RAD2DEG(trans->
rotation)
715 if (err_scale_line_macro)
717 ngettext(
"Can't scale %u line macro!",
"Can't scale %u line macros!", err_scale_line_macro),
721 if (err_scale_poly_macro)
723 ngettext(
"Can't scale %u polygon macro!",
"Can't scale %u polygon macros!", err_scale_poly_macro),
727 if (err_scale_thermo_macro)
729 ngettext(
"Can't scale %u thermal macro!",
"Can't scale %u thermal macros!", err_scale_poly_macro),
733 if (err_scale_moire_macro)
735 ngettext(
"Can't scale %u moire macro!",
"Can't scale %u moire macros!", err_scale_poly_macro),
742 "Can't rotate %u oval aperture to %.2f "
743 "degrees (non 90 multiply)!",
744 "Can't rotate %u oval apertures to %.2f "
745 "degrees (non 90 multiply)!",
748 err_rotate_oval, RAD2DEG(trans->
rotation)
751 if (err_scale_circle)
754 "Can't scale %u circle aperture to ellipse!",
"Can't scale %u circle apertures to ellipse!",
760 if (err_unknown_aperture)
763 "Skipped %u aperture with unknown type!",
"Skipped %u apertures with unknown type!",
769 if (err_unknown_macro_aperture)
771 ngettext(
"Skipped %u macro aperture!",
"Skipped %u macro apertures!", err_unknown_macro_aperture),
772 err_unknown_macro_aperture
779 gerbv_image_find_existing_aperture_match(gerbv_aperture_t* checkAperture,
gerbv_image_t* imageToSearch) {
783 for (i = 0; i < APERTURE_MAX; i++) {
784 if (imageToSearch->
aperture[i] != NULL) {
785 if ((imageToSearch->
aperture[i]->type == checkAperture->type)
786 && (imageToSearch->
aperture[i]->simplified == NULL)
787 && (imageToSearch->
aperture[i]->unit == checkAperture->unit)) {
790 for (j = 0; j < APERTURE_PARAMETERS_MAX; j++) {
791 if (imageToSearch->
aperture[i]->parameter[j] != checkAperture->parameter[j])
803 gerbv_image_find_unused_aperture_number(
int startIndex,
gerbv_image_t* image) {
806 for (i = startIndex; i < APERTURE_MAX; i++) {
818 int lastUsedApertureNumber = APERTURE_MIN - 1;
819 GArray* apertureNumberTable = g_array_new(FALSE, FALSE,
sizeof(gerb_translation_entry_t));
823 *(newImage->
info) = *(sourceImage->
info);
824 newImage->
info->name = g_strdup(sourceImage->
info->name);
825 newImage->
info->type = g_strdup(sourceImage->
info->type);
826 newImage->
info->plotterFilm = g_strdup(sourceImage->
info->plotterFilm);
827 newImage->
info->attr_list = gerbv_attribute_dup(sourceImage->
info->attr_list, sourceImage->
info->n_attr);
831 for (i = 0; i < APERTURE_MAX; i++) {
832 if (sourceImage->
aperture[i] != NULL) {
833 gerbv_aperture_t* newAperture = gerbv_image_duplicate_aperture(sourceImage->
aperture[i]);
835 lastUsedApertureNumber = gerbv_image_find_unused_aperture_number(lastUsedApertureNumber + 1, newImage);
837 gerb_translation_entry_t translationEntry = { i, lastUsedApertureNumber };
838 g_array_append_val(apertureNumberTable, translationEntry);
840 newImage->
aperture[lastUsedApertureNumber] = newAperture;
846 gerbv_image_copy_all_nets(
847 sourceImage, newImage, newImage->
layers, newImage->
states, NULL, transform, apertureNumberTable
849 g_array_free(apertureNumberTable, TRUE);
857 int lastUsedApertureNumber = APERTURE_MIN - 1;
859 GArray* apertureNumberTable = g_array_new(FALSE, FALSE,
sizeof(gerb_translation_entry_t));
862 for (i = 0; i < APERTURE_MAX; i++) {
863 if (sourceImage->
aperture[i] != NULL) {
864 gint existingAperture =
865 gerbv_image_find_existing_aperture_match(sourceImage->
aperture[i], destinationImage);
869 if (existingAperture > 0) {
870 gerb_translation_entry_t translationEntry = { i, existingAperture };
871 g_array_append_val(apertureNumberTable, translationEntry);
875 gerbv_aperture_t* newAperture = gerbv_image_duplicate_aperture(sourceImage->
aperture[i]);
877 lastUsedApertureNumber =
878 gerbv_image_find_unused_aperture_number(lastUsedApertureNumber + 1, destinationImage);
880 gerb_translation_entry_t translationEntry = { i, lastUsedApertureNumber };
881 g_array_append_val(apertureNumberTable, translationEntry);
883 destinationImage->
aperture[lastUsedApertureNumber] = newAperture;
892 for (lastState = destinationImage->
states; lastState->
next; lastState = lastState->
next) {}
893 for (lastLayer = destinationImage->
layers; lastLayer->
next; lastLayer = lastLayer->
next) {}
894 for (lastNet = destinationImage->
netlist; lastNet->
next; lastNet = lastNet->
next) {}
897 gerbv_image_copy_all_nets(
898 sourceImage, destinationImage, lastLayer, lastState, lastNet, transform, apertureNumberTable
900 g_array_free(apertureNumberTable, TRUE);
907 g_assert(currentNet);
915 for (tempNet = currentNet->
next; tempNet; tempNet = tempNet->
next) {
935 gerbv_image_t* image, gdouble coordinateX, gdouble coordinateY, gdouble width, gdouble height
940 for (currentNet = image->
netlist; currentNet->
next; currentNet = currentNet->
next) {}
943 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
947 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
950 currentNet->
start_x = coordinateX;
951 currentNet->
start_y = coordinateY;
952 currentNet->
stop_x = coordinateX;
953 currentNet->
stop_y = coordinateY;
956 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
959 currentNet->
start_x = coordinateX;
960 currentNet->
start_y = coordinateY;
961 currentNet->
stop_x = coordinateX + width;
962 currentNet->
stop_y = coordinateY;
964 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
966 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
969 currentNet->
stop_x = coordinateX + width;
970 currentNet->
stop_y = coordinateY + height;
972 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
974 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
977 currentNet->
stop_x = coordinateX;
978 currentNet->
stop_y = coordinateY + height;
980 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
982 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
985 currentNet->
stop_x = coordinateX;
986 currentNet->
stop_y = coordinateY;
988 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
991 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
998 gerb_image_return_aperture_index(
gerbv_image_t* image, gdouble lineWidth,
int* apertureIndex) {
1000 gerbv_aperture_t* aperture = NULL;
1004 for (currentNet = image->
netlist; currentNet->
next; currentNet = currentNet->
next) {}
1007 for (i = 0; i < APERTURE_MAX; i++) {
1010 && (fabs(image->
aperture[i]->parameter[0] - lineWidth) < 0.001)) {
1020 if (!gerber_create_new_aperture(image, apertureIndex,
GERBV_APTYPE_CIRCLE, lineWidth, 0)) {
1030 gerbv_image_t* image, gdouble centerX, gdouble centerY, gdouble radius, gdouble startAngle, gdouble endAngle,
1035 gerbv_cirseg_t cirSeg = { centerX, centerY, radius, radius, startAngle, endAngle };
1037 currentNet = gerb_image_return_aperture_index(image, lineWidth, &apertureIndex);
1043 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
1046 currentNet->
aperture = apertureIndex;
1047 currentNet->
start_x = centerX + (cos(DEG2RAD(startAngle)) * radius);
1048 currentNet->
start_y = centerY + (sin(DEG2RAD(startAngle)) * radius);
1049 currentNet->
stop_x = centerX + (cos(DEG2RAD(endAngle)) * radius);
1050 currentNet->
stop_y = centerY + (sin(DEG2RAD(endAngle)) * radius);
1051 currentNet->
cirseg = g_new0(gerbv_cirseg_t, 1);
1052 *(currentNet->
cirseg) = cirSeg;
1054 gdouble angleDiff = currentNet->
cirseg->angle2 - currentNet->
cirseg->angle1;
1055 gint i, steps = abs(angleDiff);
1056 for (i = 0; i <= steps; i++) {
1059 + currentNet->
cirseg->width / 2.0 * cos(DEG2RAD(currentNet->
cirseg->angle1 + (i * angleDiff) / steps));
1062 + currentNet->
cirseg->width / 2.0 * sin(DEG2RAD(currentNet->
cirseg->angle1 + (i * angleDiff) / steps));
1063 gerber_update_min_and_max(
1064 ¤tNet->
boundingBox, tempX, tempY, lineWidth / 2, lineWidth / 2, lineWidth / 2, lineWidth / 2
1067 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
1073 gerbv_image_t* image, gdouble startX, gdouble startY, gdouble endX, gdouble endY, gdouble lineWidth,
1079 currentNet = gerb_image_return_aperture_index(image, lineWidth, &apertureIndex);
1085 currentNet = gerber_create_new_net(currentNet, NULL, NULL);
1089 if ((fabs(startX - endX) < 0.001) && (fabs(startY - endY) < 0.001))
1093 currentNet->
aperture = apertureIndex;
1096 currentNet->
stop_x = endX;
1097 currentNet->
stop_y = endY;
1099 gerber_update_min_and_max(
1100 ¤tNet->
boundingBox, currentNet->
stop_x, currentNet->
stop_y, lineWidth / 2, lineWidth / 2, lineWidth / 2,
1103 gerber_update_min_and_max(
1107 gerber_update_image_min_max(¤tNet->
boundingBox, 0, 0, image);
1112 gerbv_image_create_window_pane_objects(
1113 gerbv_image_t* image, gdouble lowerLeftX, gdouble lowerLeftY, gdouble width, gdouble height, gdouble areaReduction,
1114 gint paneRows, gint paneColumns, gdouble paneSeparation
1117 gdouble startX, startY, boxWidth, boxHeight;
1119 startX = lowerLeftX + (areaReduction * width) / 2.0;
1120 startY = lowerLeftY + (areaReduction * height) / 2.0;
1121 boxWidth = (width * (1.0 - areaReduction) - (paneSeparation * (paneColumns - 1))) / paneColumns;
1122 boxHeight = (height * (1.0 - areaReduction) - (paneSeparation * (paneRows - 1))) / paneRows;
1124 for (i = 0; i < paneColumns; i++) {
1125 for (j = 0; j < paneRows; j++) {
1127 image, startX + (i * (boxWidth + paneSeparation)), startY + (j * (boxHeight + paneSeparation)),
1137 gerbv_image_reduce_area_of_selected_objects(
1138 GArray* selectionArray, gdouble areaReduction, gint paneRows, gint paneColumns, gdouble paneSeparation
1140 gdouble minX, minY, maxX, maxY;
1142 for (guint i = 0; i < selectionArray->len; i++) {
1143 gerbv_selection_item_t sItem = g_array_index(selectionArray, gerbv_selection_item_t, i);
1158 for (currentNet = currentNet->
next; currentNet; currentNet = currentNet->
next) {
1162 if (currentNet->
stop_x < minX)
1163 minX = currentNet->
stop_x;
1164 if (currentNet->
stop_y < minY)
1165 minY = currentNet->
stop_y;
1166 if (currentNet->
stop_x > maxX)
1167 maxX = currentNet->
stop_x;
1168 if (currentNet->
stop_y > maxY)
1169 maxY = currentNet->
stop_y;
1180 gdouble dx = 0, dy = 0;
1184 switch (apert->type) {
1189 dx = apert->parameter[0] / 2;
1190 dy = apert->parameter[1] / 2;
1194 if (currentNet->
start_x - dx < minX)
1195 minX = currentNet->
start_x - dx;
1196 if (currentNet->
start_y - dy < minY)
1197 minY = currentNet->
start_y - dy;
1198 if (currentNet->
start_x + dx > maxX)
1199 maxX = currentNet->
start_x + dx;
1200 if (currentNet->
start_y + dy > maxY)
1201 maxY = currentNet->
start_y + dy;
1203 if (currentNet->
stop_x - dx < minX)
1204 minX = currentNet->
stop_x - dx;
1205 if (currentNet->
stop_y - dy < minY)
1206 minY = currentNet->
stop_y - dy;
1207 if (currentNet->
stop_x + dx > maxX)
1208 maxX = currentNet->
stop_x + dx;
1209 if (currentNet->
stop_y + dy > maxY)
1210 maxY = currentNet->
stop_y + dy;
1224 gerbv_image_create_window_pane_objects(
1225 image, minX, minY, maxX - minX, maxY - minY, areaReduction, paneRows, paneColumns, paneSeparation
1232 gerbv_image_move_selected_objects(GArray* selectionArray, gdouble translationX, gdouble translationY) {
1233 for (guint i = 0; i < selectionArray->len; i++) {
1234 gerbv_selection_item_t sItem = g_array_index(selectionArray, gerbv_selection_item_t, i);
1239 for (currentNet = currentNet->
next; currentNet; currentNet = currentNet->
next) {
1242 currentNet->
start_x += translationX;
1243 currentNet->
start_y += translationY;
1244 currentNet->
stop_x += translationX;
1245 currentNet->
stop_y += translationY;
1249 currentNet->
start_x += translationX;
1250 currentNet->
start_y += translationY;
1251 currentNet->
stop_x += translationX;
1252 currentNet->
stop_y += translationY;
1264 for (currentNet = currentNet->
next; currentNet; currentNet = currentNet->
next) {
1266 return currentNet->
next;
1271 return currentNet->
next;
1280 for (currentNet = parsed_image->
netlist; currentNet->
next; currentNet = currentNet->
next) {
1282 parsed_image->
aperture[currentNet->
aperture] = g_new0(gerbv_aperture_t, 1);
Aperture macro parsing header info.
void gerbv_drill_stats_destroy(gerbv_drill_stats_t *stats)
void gerbv_destroy_image(gerbv_image_t *image)
Free an image structure.
void gerbv_image_create_rectangle_object(gerbv_image_t *image, gdouble coordinateX, gdouble coordinateY, gdouble width, gdouble height)
Draw a filled rectangle on the specified image.
void gerbv_image_copy_image(gerbv_image_t *sourceImage, gerbv_user_transformation_t *transform, gerbv_image_t *destinationImage)
Copy an image into an existing image, effectively merging the two together.
gerbv_image_t * gerbv_create_image(gerbv_image_t *image, const gchar *type)
Allocate a new gerbv_image structure.
void gerbv_image_create_line_object(gerbv_image_t *image, gdouble startX, gdouble startY, gdouble endX, gdouble endY, gdouble lineWidth, gerbv_aperture_type_t apertureType)
Draw a line on the specified image.
void gerbv_image_delete_net(gerbv_net_t *currentNet)
Delete a net in an existing image.
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.
gerbv_image_t * gerbv_image_duplicate_image(gerbv_image_t *sourceImage, gerbv_user_transformation_t *transform)
Duplicate an existing image and return the new copy.
void gerbv_image_create_dummy_apertures(gerbv_image_t *parsed_image)
Create any missing apertures in the specified image.
void gerbv_image_create_arc_object(gerbv_image_t *image, gdouble centerX, gdouble centerY, gdouble radius, gdouble startAngle, gdouble endAngle, gdouble lineWidth, gerbv_aperture_type_t apertureType)
Draw an arc on the specified image.
Header info for the image editing and support functions.
void gerbv_stats_destroy(gerbv_stats_t *stats)
Header info for the RS274X parsing functions.
const char * gerbv_interpolation_name(gerbv_interpolation_t interp)
Return string name of gerbv_interpolation_t interpolation.
void gerbv_rotate_coord(double *x, double *y, double rad)
void gerbv_transform_coord(double *x, double *y, const gerbv_user_transformation_t *trans)
The main header file for the libgerbv library.
@ GERBV_APERTURE_STATE_OFF
@ GERBV_APERTURE_STATE_ON
@ GERBV_APERTURE_STATE_FLASH
@ 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_PAREA_END
@ GERBV_INTERPOLATION_LINEARx10
@ GERBV_INTERPOLATION_CCW_CIRCULAR
@ GERBV_INTERPOLATION_LINEARx1
Header info for common structs and functions used for the GUI application.
gerbv_stats_t * gerbv_stats
gerbv_layertype_t layertype
gerbv_drill_stats_t * drill_stats
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_knockout_t knockout
gerbv_render_size_t boundingBox
gerbv_aperture_state_t aperture_state
gerbv_interpolation_t interpolation