Merge branch 'master' into japanese-translations
This commit is contained in:
		@@ -5,7 +5,7 @@
 | 
			
		||||
The version number of this application consists of a given version in the format of 'v1.0.0' (formely only 2 digits).
 | 
			
		||||
Where the first number indicates a major release and the second and third numbers indicate minor changes.
 | 
			
		||||
 | 
			
		||||
Versions, including release candidates and path-levels, are tagged in git.
 | 
			
		||||
Versions, including release candidates and patch-levels, are tagged in git.
 | 
			
		||||
 | 
			
		||||
@subsection rc Release Candidates
 | 
			
		||||
Release candidates are software versions that seem stable and functional to become a new version but testing is not fully finished. These versions are marked with an '-rcX', where X is the number of the release candidate.
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */
 | 
			
		||||
#define ABS_DBL(a) ((a) < 0 ? -(a) : (a))
 | 
			
		||||
 | 
			
		||||
void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
 | 
			
		||||
void bounding_box_calculate_from_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
 | 
			
		||||
{
 | 
			
		||||
	double xmin = DBL_MAX, xmax = -DBL_MAX, ymin = DBL_MAX, ymax = -DBL_MAX;
 | 
			
		||||
	struct vector_2d temp_vec;
 | 
			
		||||
@@ -68,7 +68,7 @@ void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t
 | 
			
		||||
	box->vectors.upper_right.y = ymax;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void bounding_box_update_box(union bounding_box *destination, union bounding_box *update)
 | 
			
		||||
void bounding_box_update_with_box(union bounding_box *destination, union bounding_box *update)
 | 
			
		||||
{
 | 
			
		||||
	if (!destination || !update)
 | 
			
		||||
		return;
 | 
			
		||||
@@ -151,8 +151,6 @@ void bounding_box_update_with_path(GList *vertices, double thickness,
 | 
			
		||||
	GList *vertex_iterator;
 | 
			
		||||
	struct vector_2d pt;
 | 
			
		||||
 | 
			
		||||
	/* printf("Warning! Function %s not yet implemented correctly!\n", __func__); */
 | 
			
		||||
 | 
			
		||||
	if (!vertices || !box)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
@@ -173,7 +171,7 @@ void bounding_box_update_with_path(GList *vertices, double thickness,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt)
 | 
			
		||||
void bounding_box_update_with_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt)
 | 
			
		||||
{
 | 
			
		||||
	struct vector_2d point;
 | 
			
		||||
 | 
			
		||||
@@ -224,7 +222,7 @@ void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_a
 | 
			
		||||
		vector_2d_rotate(&input_points[i], rotation_deg * M_PI / 180.0);
 | 
			
		||||
		vector_2d_scale(&input_points[i], scale);
 | 
			
		||||
 | 
			
		||||
		bounding_box_update_point(box, NULL, &input_points[i]);
 | 
			
		||||
		bounding_box_update_with_point(box, NULL, &input_points[i]);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gf
 | 
			
		||||
	case GRAPHIC_BOX:
 | 
			
		||||
		/* Expected fallthrough */
 | 
			
		||||
	case GRAPHIC_POLYGON:
 | 
			
		||||
		bounding_box_calculate_polygon(gfx->vertices,
 | 
			
		||||
		bounding_box_calculate_from_polygon(gfx->vertices,
 | 
			
		||||
							(conv_generic_to_vector_2d_t)&convert_gds_point_to_2d_vector,
 | 
			
		||||
							¤t_box);
 | 
			
		||||
		break;
 | 
			
		||||
@@ -74,7 +74,7 @@ static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gf
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Update box with results */
 | 
			
		||||
	bounding_box_update_box(box, ¤t_box);
 | 
			
		||||
	bounding_box_update_with_box(box, ¤t_box);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void calculate_cell_bounding_box(union bounding_box *box, struct gds_cell *cell)
 | 
			
		||||
@@ -113,7 +113,7 @@ void calculate_cell_bounding_box(union bounding_box *box, struct gds_cell *cell)
 | 
			
		||||
		temp_box.vectors.upper_right.y += sub_cell->origin.y;
 | 
			
		||||
 | 
			
		||||
		/* update the parent's box */
 | 
			
		||||
		bounding_box_update_box(box, &temp_box);
 | 
			
		||||
		bounding_box_update_with_box(box, &temp_box);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,15 +35,44 @@
 | 
			
		||||
#include <gds-render/geometric/vector-operations.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Union describing a bounding box
 | 
			
		||||
 *
 | 
			
		||||
 * Two ways of accessing a bounding box are possible.
 | 
			
		||||
 *
 | 
			
		||||
 * Either, use the "named" vectors struct to specifically access the points
 | 
			
		||||
 * @code
 | 
			
		||||
 * 	lower_left = box.vectors.lower_left;
 | 
			
		||||
 * 	upper right = box.vectors.upper_right;
 | 
			
		||||
 * @endcode
 | 
			
		||||
 *
 | 
			
		||||
 * or use the iterable vector array:
 | 
			
		||||
 * @code
 | 
			
		||||
 * 	for (i = 0; i < 2; i++)
 | 
			
		||||
 * 		box.vector_array[i] = points[i];
 | 
			
		||||
 * @endcode
 | 
			
		||||
 */
 | 
			
		||||
union bounding_box {
 | 
			
		||||
	/** Coordinate System is (y up | x right) */
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief Location vectors of upper right and lower left bounding box points
 | 
			
		||||
	 * @note Coordinate System is (y up | x right)
 | 
			
		||||
	 */
 | 
			
		||||
	struct _vectors {
 | 
			
		||||
		/** @brief Lower left point of the bounding box */
 | 
			
		||||
		struct vector_2d lower_left;
 | 
			
		||||
		/** @brief Upper right point of the bounding box */
 | 
			
		||||
		struct vector_2d upper_right;
 | 
			
		||||
	} vectors;
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief Array of vectors representing a bounding box
 | 
			
		||||
	 * @note This is more convenient for iterating
 | 
			
		||||
	 */
 | 
			
		||||
	struct vector_2d vector_array[2];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * @brief Pointer to a function that takes any pointer and converts this object to a vector_2d struct
 | 
			
		||||
 */
 | 
			
		||||
typedef void (*conv_generic_to_vector_2d_t)(void *, struct vector_2d *);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -52,14 +81,14 @@ typedef void (*conv_generic_to_vector_2d_t)(void *, struct vector_2d *);
 | 
			
		||||
 * @param conv_func Conversion function to convert vertices to vector_2d structs.
 | 
			
		||||
 * @param box Box to write to. This box is not updated! All previous data is discarded
 | 
			
		||||
 */
 | 
			
		||||
void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
 | 
			
		||||
void bounding_box_calculate_from_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Update an exisitng bounding box with another one.
 | 
			
		||||
 * @param destination Target box to update
 | 
			
		||||
 * @param update Box to update the target with
 | 
			
		||||
 */
 | 
			
		||||
void bounding_box_update_box(union bounding_box *destination, union bounding_box *update);
 | 
			
		||||
void bounding_box_update_with_box(union bounding_box *destination, union bounding_box *update);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Prepare an empty bounding box.
 | 
			
		||||
@@ -76,7 +105,7 @@ void bounding_box_prepare_empty(union bounding_box *box);
 | 
			
		||||
 * @param conv_func Conversion function to convert \p pt to a vector_2d. May be NULL
 | 
			
		||||
 * @param pt Point to update bounding box with
 | 
			
		||||
 */
 | 
			
		||||
void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt);
 | 
			
		||||
void bounding_box_update_with_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Return all four corner points of a bounding box
 | 
			
		||||
@@ -102,7 +131,7 @@ void bounding_box_get_all_points(struct vector_2d *points, union bounding_box *b
 | 
			
		||||
 * @param rotation_deg Rotation of bounding box around the origin in degrees (counterclockwise)
 | 
			
		||||
 * @param flip_at_x Flip the boundig box on the x axis before rotating.
 | 
			
		||||
 * @param box Bounding box the operations should be applied to.
 | 
			
		||||
 * @note Keep in mind, that this bounding boxy is actually the bounding box of the rotated boundig box and not the object itself.
 | 
			
		||||
 * @note Keep in mind, that this bounding box is actually the bounding box of the rotated boundig box and not the object itself.
 | 
			
		||||
 *       It might be too big.
 | 
			
		||||
 */
 | 
			
		||||
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box);
 | 
			
		||||
@@ -113,6 +142,9 @@ void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_a
 | 
			
		||||
 * @param thickness Thisckness of the path
 | 
			
		||||
 * @param conv_func Conversion function for vertices to vector_2d structs
 | 
			
		||||
 * @param box Bounding box to write results in.
 | 
			
		||||
 * @warning This function is not yet implemented correctly. Miter points of paths are not taken into account.
 | 
			
		||||
 *		If a path is the outmost object of your cell _and_ it is not parallel to one of the coordinate axes,
 | 
			
		||||
 *		the calculated bounding box size might be off. In other cases it should be reasonable close to the real bounding box.
 | 
			
		||||
 */
 | 
			
		||||
void bounding_box_update_with_path(GList *vertices, double thickness, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -275,12 +275,20 @@ static int cairo_renderer_render_cell_to_vector_file(GdsOutputRenderer *renderer
 | 
			
		||||
		goto ret_parent;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Close stdin and (stdout and stderr may live on) */
 | 
			
		||||
	/* We are now in a separate process just for rendering the output image.
 | 
			
		||||
     * You may print a log message to the activity bar of the gui by writing a line
 | 
			
		||||
     * teminated with '\n' to comm_pipe[1]. This will be handled by the parent process.
 | 
			
		||||
     * Directly calling the update function 
 | 
			
		||||
     *     gds_output_renderer_update_async_progress()
 | 
			
		||||
     * does not have any effect because this is a separate process.
 | 
			
		||||
     */
 | 
			
		||||
  
 | 
			
		||||
	/*
 | 
			
		||||
     * Close stdin and (stdout and stderr may live on)
 | 
			
		||||
     */
 | 
			
		||||
	close(0);
 | 
			
		||||
	//close(1);
 | 
			
		||||
	close(comm_pipe[0]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	layers = (struct cairo_layer *)calloc(MAX_LAYERS, sizeof(struct cairo_layer));
 | 
			
		||||
 | 
			
		||||
	/* Clear layers */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user