Compare commits
13 Commits
1b1f742ae1
...
c6483dbebd
Author | SHA1 | Date | |
---|---|---|---|
c6483dbebd | |||
86342da2a2 | |||
ce8386799b | |||
374e3b54c0 | |||
3651296c3a | |||
5fe21f1d73 | |||
2d7103abbb | |||
392d7e1b3c | |||
2fddfa475b | |||
e6603d4c13 | |||
80730ab9c4 | |||
2b0e2095e6 | |||
0c20db39bd |
@ -1766,7 +1766,7 @@ PAPER_TYPE = a4
|
|||||||
# If left blank no extra packages will be included.
|
# If left blank no extra packages will be included.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
EXTRA_PACKAGES =
|
EXTRA_PACKAGES = amsmath
|
||||||
|
|
||||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
||||||
# generated LaTeX document. The header should contain everything until the first
|
# generated LaTeX document. The header should contain everything until the first
|
||||||
|
6
doxygen/plugins.dox
Normal file
6
doxygen/plugins.dox
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @defgroup plugins External Renderer Plugins
|
||||||
|
*
|
||||||
|
* These plugins can be loaded with the @ref ExternalRenderer
|
||||||
|
*
|
||||||
|
*/
|
@ -603,20 +603,12 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
self);
|
self);
|
||||||
|
|
||||||
activity_bar_set_busy(self->activity_status_bar, "Rendering cell...");
|
activity_bar_set_busy(self->activity_status_bar, "Rendering cell...");
|
||||||
/* TODO: Replace this with asynchronous rendering. However, this fixes issue #19 */
|
|
||||||
|
|
||||||
g_signal_connect(render_engine, "progress-changed",
|
g_signal_connect(render_engine, "progress-changed",
|
||||||
G_CALLBACK(async_rendering_status_update_callback), self);
|
G_CALLBACK(async_rendering_status_update_callback), self);
|
||||||
gds_output_renderer_render_output_async(render_engine, cell_to_render, sett->scale);
|
gds_output_renderer_render_output_async(render_engine, cell_to_render, sett->scale);
|
||||||
|
|
||||||
|
|
||||||
//self->button_state_data.rendering_active = FALSE;
|
|
||||||
|
|
||||||
//g_object_unref(render_engine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(file_name);
|
g_free(file_name);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ static void calculate_path_miter_points(struct vector_2d *a, struct vector_2d *b
|
|||||||
vector_2d_subtract(m2, m2, &v_vec);
|
vector_2d_subtract(m2, m2, &v_vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bounding_box_calculate_path_box(GList *vertices, double thickness,
|
void bounding_box_update_with_path(GList *vertices, double thickness,
|
||||||
conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
|
conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
|
||||||
{
|
{
|
||||||
GList *vertex_iterator;
|
GList *vertex_iterator;
|
||||||
@ -191,24 +191,40 @@ void bounding_box_update_point(union bounding_box *destination, conv_generic_to_
|
|||||||
destination->vectors.upper_right.y = MAX(destination->vectors.upper_right.y, point.y);
|
destination->vectors.upper_right.y = MAX(destination->vectors.upper_right.y, point.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void bounding_box_get_all_points(struct vector_2d *points, union bounding_box *box)
|
||||||
* @brief Apply transformations onto bounding box.
|
{
|
||||||
* @param scale Scaling factor
|
if (!points || !box)
|
||||||
* @param rotation_deg Roation of bounding box around the origin in degrees (counterclockwise)
|
return;
|
||||||
* @param flip_at_x Flip the boundig box on the x axis before rotating.
|
|
||||||
* @param box Bounding box the operations should be applied to.
|
points[0].x = box->vectors.lower_left.x;
|
||||||
*/
|
points[0].y = box->vectors.lower_left.y;
|
||||||
|
points[1].x = box->vectors.upper_right.x;
|
||||||
|
points[1].y = box->vectors.lower_left.y;
|
||||||
|
points[2].x = box->vectors.upper_right.x;
|
||||||
|
points[2].y = box->vectors.upper_right.y;
|
||||||
|
points[3].x = box->vectors.lower_left.x;
|
||||||
|
points[3].y = box->vectors.upper_right.y;
|
||||||
|
}
|
||||||
|
|
||||||
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box)
|
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
struct vector_2d input_points[4];
|
||||||
|
|
||||||
/* Due to linearity, the order of the operations does not matter.
|
if (!box)
|
||||||
* flip must be applied before rotation as defined by the GDS format
|
return;
|
||||||
*/
|
|
||||||
for (i = 0; i < 2; i++) {
|
bounding_box_get_all_points(input_points, box);
|
||||||
box->vector_array[i].y *= (flip_at_x ? -1 : 1);
|
|
||||||
vector_2d_rotate(&box->vector_array[i], rotation_deg * M_PI / 180);
|
/* Reset box */
|
||||||
vector_2d_scale(&box->vector_array[i], scale);
|
bounding_box_prepare_empty(box);
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
input_points[i].y *= (flip_at_x ? -1 : 1);
|
||||||
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gf
|
|||||||
* Please be aware if paths are the outmost elements of your cell.
|
* Please be aware if paths are the outmost elements of your cell.
|
||||||
* You might end up with a completely wrong calculated cell size.
|
* You might end up with a completely wrong calculated cell size.
|
||||||
*/
|
*/
|
||||||
bounding_box_calculate_path_box(gfx->vertices, gfx->width_absolute,
|
bounding_box_update_with_path(gfx->vertices, gfx->width_absolute,
|
||||||
(conv_generic_to_vector_2d_t)&convert_gds_point_to_2d_vector,
|
(conv_generic_to_vector_2d_t)&convert_gds_point_to_2d_vector,
|
||||||
¤t_box);
|
¤t_box);
|
||||||
break;
|
break;
|
||||||
|
@ -46,12 +46,75 @@ union bounding_box {
|
|||||||
|
|
||||||
typedef void (*conv_generic_to_vector_2d_t)(void *, struct vector_2d *);
|
typedef void (*conv_generic_to_vector_2d_t)(void *, struct vector_2d *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculate bounding box of polygon
|
||||||
|
* @param vertices List of vertices that describe the polygon
|
||||||
|
* @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_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_box(union bounding_box *destination, union bounding_box *update);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepare an empty bounding box.
|
||||||
|
*
|
||||||
|
* Updating this specially prepared box, results in a bounding box that is the same size as the update
|
||||||
|
*
|
||||||
|
* @param box Box to preapre
|
||||||
|
*/
|
||||||
void bounding_box_prepare_empty(union bounding_box *box);
|
void bounding_box_prepare_empty(union bounding_box *box);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update bounding box with a point
|
||||||
|
* @param destination Bounding box to update
|
||||||
|
* @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_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
|
||||||
|
* @param[out] points Array of 4 vector_2d structs that has to be allocated by the caller
|
||||||
|
* @param box Bounding box
|
||||||
|
*/
|
||||||
|
void bounding_box_get_all_points(struct vector_2d *points, union bounding_box *box);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Apply transformations onto bounding box.
|
||||||
|
*
|
||||||
|
* All corner points \f$ \vec{P_i} \f$ of the bounding box are transformed to output points \f$ \vec{P_o} \f$ by:
|
||||||
|
*
|
||||||
|
* \f$ \vec{P_o} = s \cdot \begin{pmatrix}\cos\left(\phi\right) & -\sin\left(\phi\right)\\ \sin\left(\phi\right) & \cos\left(\phi\right)\end{pmatrix} \cdot \begin{pmatrix} 1 & 0 \\ 0 & -1^{m} \end{pmatrix} \cdot \vec{P_i} \f$, with:
|
||||||
|
*
|
||||||
|
* * \f$s\f$: Scale
|
||||||
|
* * \f$m\f$: 1, if flipped_at_x is True, else 0
|
||||||
|
* * \f$\phi\f$: Rotation angle in radians. The conversion degrees => radians is done internally
|
||||||
|
*
|
||||||
|
* The result is the bounding box generated around all output points
|
||||||
|
*
|
||||||
|
* @param scale Scaling factor
|
||||||
|
* @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.
|
||||||
|
* It might be too big.
|
||||||
|
*/
|
||||||
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box);
|
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box);
|
||||||
void bounding_box_calculate_path_box(GList *vertices, double thickness, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
|
|
||||||
|
/**
|
||||||
|
* @brief Calculate the bounding box of a path and update the given bounding box
|
||||||
|
* @param vertices Vertices the path is made up of
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
void bounding_box_update_with_path(GList *vertices, double thickness, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
|
||||||
|
|
||||||
#endif /* _BOUNDING_BOX_H_ */
|
#endif /* _BOUNDING_BOX_H_ */
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This define is used to export a function from a shared object
|
||||||
|
*/
|
||||||
|
#define EXPORT_FUNC __attribute__((visibility("default")))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function name expected to be found in external library for rendering.
|
* @brief Function name expected to be found in external library for rendering.
|
||||||
*
|
*
|
||||||
@ -37,14 +42,15 @@
|
|||||||
*
|
*
|
||||||
* The pure presence of this symbol name causes forking. The content of this variable is don't care.
|
* The pure presence of this symbol name causes forking. The content of this variable is don't care.
|
||||||
* @note Use this if you mess with the internal structures of gds-render
|
* @note Use this if you mess with the internal structures of gds-render
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#define EXTERNAL_LIBRARY_FORK_REQUEST exported_fork_request
|
#define EXTERNAL_LIBRARY_FORK_REQUEST exported_fork_request
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define for declaring the exported functions
|
* @brief Define for declaring the exported functions.
|
||||||
|
*
|
||||||
|
* This not only helps with the declaration but also makes the symbols visible, so they can be called form outside the library
|
||||||
*/
|
*/
|
||||||
#define FUNC_DECL(FUNC) FUNC
|
#define EXPORTED_FUNC_DECL(FUNC) EXPORT_FUNC FUNC
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ static void layer_settings_class_init(LayerSettingsClass *klass)
|
|||||||
* @brief Copy layer_info struct
|
* @brief Copy layer_info struct
|
||||||
*
|
*
|
||||||
* This function copies a layer info struct.
|
* This function copies a layer info struct.
|
||||||
* Be aware, that it does not only copy the pointer to the
|
|
||||||
* layer name, but instead duplicates the string.
|
|
||||||
*
|
*
|
||||||
|
* @note Be aware, that it does not only copy the pointer to the
|
||||||
|
* layer name, but instead duplicates the string.
|
||||||
* @param info Info to copy
|
* @param info Info to copy
|
||||||
* @return new layer_info struct
|
* @return new layer_info struct
|
||||||
*/
|
*/
|
||||||
|
@ -10,3 +10,5 @@ link_libraries(${PYTHON_LDFLAGS} version)
|
|||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SOURCES})
|
add_library(${PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SOURCES})
|
||||||
add_dependencies(${PROJECT_NAME} version)
|
add_dependencies(${PROJECT_NAME} version)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES C_VISIBILITY_PRESET hidden)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||||
|
@ -1,9 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter example plugin
|
||||||
|
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
|
||||||
|
*
|
||||||
|
* This file is part of GDSII-Converter.
|
||||||
|
*
|
||||||
|
* GDSII-Converter is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup example-plugin Example Plugin for External Renderer
|
||||||
|
* @ingroup plugins
|
||||||
|
* This is a template / example for an external renderer plugin
|
||||||
|
* @addtogroup example-plugin
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gds-render/gds-utils/gds-types.h>
|
#include <gds-render/gds-utils/gds-types.h>
|
||||||
#include <gds-render/output-renderers/external-renderer-interfaces.h>
|
#include <gds-render/output-renderers/external-renderer-interfaces.h>
|
||||||
|
|
||||||
int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale)
|
int EXPORTED_FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale)
|
||||||
{
|
{
|
||||||
if (!toplevel)
|
if (!toplevel)
|
||||||
return -1000;
|
return -1000;
|
||||||
@ -12,8 +40,10 @@ int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *version)
|
int EXPORTED_FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *version)
|
||||||
{
|
{
|
||||||
printf("Init with params: %s\ngds-render version: %s\n", params, version);
|
printf("Init with params: %s\ngds-render version: %s\n", params, version);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user