|
KiCad PCB EDA Suite
|
#include "gerber_to_png.h"#include "gerber_file_image.h"#include "gerber_draw_item.h"#include "dcode.h"#include "excellon_image.h"#include "excellon_defaults.h"#include <convert_basic_shapes_to_polygon.h>#include <jobs/job_gerber_export_png.h>#include <plotters/plotter_png.h>#include <geometry/shape_poly_set.h>#include <base_units.h>#include <cmath>#include <wx/filename.h>Go to the source code of this file.
Functions | |
| bool | IsExcellonFile (const wxString &aPath) |
| Determine if a file is an Excellon drill file based on extension. | |
| BOX2I | CalculateGerberBoundingBox (GERBER_FILE_IMAGE *aImage) |
| Calculate bounding box for all draw items in a gerber image. | |
| std::unique_ptr< GERBER_FILE_IMAGE > | LoadGerberOrExcellon (const wxString &aPath, wxString *aErrorMsg, wxArrayString *aMessages) |
| Load a Gerber or Excellon file, auto-detecting by extension. | |
| GERBER_PLOTTER_VIEWPORT | CalculatePlotterViewport (const BOX2I &aBBox, int aDpi, int aWidth, int aHeight) |
| Compute pixel dimensions and plotter scale from a bounding box and DPI/size settings. | |
| bool | RenderGerberToPng (const wxString &aInputPath, const wxString &aOutputPath, const GERBER_RENDER_OPTIONS &aOptions, wxString *aErrorMsg, wxArrayString *aMessages) |
| Render a Gerber or Excellon file to PNG. | |
| bool | RenderGerberToPng (const wxString &aInputPath, const wxString &aOutputPath, const JOB_GERBER_EXPORT_PNG &aJob, wxString *aErrorMsg, wxArrayString *aMessages) |
| Render a Gerber or Excellon file to PNG using job parameters. | |
| BOX2I CalculateGerberBoundingBox | ( | GERBER_FILE_IMAGE * | aImage | ) |
Calculate bounding box for all draw items in a gerber image.
Definition at line 43 of file gerber_to_png.cpp.
References GERBER_FILE_IMAGE::GetItems(), and BOX2< Vec >::Merge().
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberInfo(), and RenderGerberToPng().
| GERBER_PLOTTER_VIEWPORT CalculatePlotterViewport | ( | const BOX2I & | aBBox, |
| int | aDpi, | ||
| int | aWidth, | ||
| int | aHeight ) |
Compute pixel dimensions and plotter scale from a bounding box and DPI/size settings.
| aBBox | Bounding box in gerber IU |
| aDpi | DPI for auto-sizing |
| aWidth | Requested width (0 = auto from DPI) |
| aHeight | Requested height (0 = auto from DPI) |
Definition at line 179 of file gerber_to_png.cpp.
References gerbIUScale, BOX2< Vec >::GetHeight(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::GetWidth(), GERBER_PLOTTER_VIEWPORT::height, GERBER_PLOTTER_VIEWPORT::iuPerDecimil, MIN_PIXEL_SIZE, GERBER_PLOTTER_VIEWPORT::offset, GERBER_PLOTTER_VIEWPORT::plotScale, and GERBER_PLOTTER_VIEWPORT::width.
Referenced by RenderDiffToPng(), and RenderGerberToPng().
| bool IsExcellonFile | ( | const wxString & | aPath | ) |
Determine if a file is an Excellon drill file based on extension.
Definition at line 35 of file gerber_to_png.cpp.
Referenced by LoadGerberOrExcellon().
| std::unique_ptr< GERBER_FILE_IMAGE > LoadGerberOrExcellon | ( | const wxString & | aPath, |
| wxString * | aErrorMsg, | ||
| wxArrayString * | aMessages = nullptr ) |
Load a Gerber or Excellon file, auto-detecting by extension.
Definition at line 67 of file gerber_to_png.cpp.
References image, and IsExcellonFile().
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff(), GERBVIEW_JOBS_HANDLER::JobGerberInfo(), and RenderGerberToPng().
| bool RenderGerberToPng | ( | const wxString & | aInputPath, |
| const wxString & | aOutputPath, | ||
| const GERBER_RENDER_OPTIONS & | aOptions, | ||
| wxString * | aErrorMsg = nullptr, | ||
| wxArrayString * | aMessages = nullptr ) |
Render a Gerber or Excellon file to PNG.
Loads the file, converts all draw items to polygons, and renders using PNG_PLOTTER with Cairo.
| aInputPath | Path to the Gerber or Excellon file |
| aOutputPath | Path for the output PNG file |
| aOptions | Rendering options |
| aErrorMsg | Optional pointer to receive error messages |
| aMessages | Optional pointer to receive parse messages |
Definition at line 222 of file gerber_to_png.cpp.
References KIGFX::COLOR4D::a, GERBER_RENDER_OPTIONS::antialias, GERBER_RENDER_OPTIONS::backgroundColor, CalculateGerberBoundingBox(), CalculatePlotterViewport(), GERBER_RENDER_OPTIONS::dpi, PNG_PLOTTER::EndPlot(), GERBER_RENDER_OPTIONS::foregroundColor, gerbIUScale, BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), GERBER_RENDER_OPTIONS::HasViewportOverride(), GERBER_PLOTTER_VIEWPORT::height, GERBER_RENDER_OPTIONS::height, image, GERBER_PLOTTER_VIEWPORT::iuPerDecimil, LoadGerberOrExcellon(), GERBER_PLOTTER_VIEWPORT::offset, GERBER_RENDER_OPTIONS::originXMm, GERBER_RENDER_OPTIONS::originYMm, GERBER_PLOTTER_VIEWPORT::plotScale, PNG_PLOTTER::SaveFile(), PNG_PLOTTER::SetAntialias(), PNG_PLOTTER::SetBackgroundColor(), PNG_PLOTTER::SetClearCompositing(), PNG_PLOTTER::SetPixelSize(), PNG_PLOTTER::SetResolution(), PNG_PLOTTER::SetViewport(), PNG_PLOTTER::StartPlot(), GERBER_PLOTTER_VIEWPORT::width, GERBER_RENDER_OPTIONS::width, GERBER_RENDER_OPTIONS::windowHeightMm, and GERBER_RENDER_OPTIONS::windowWidthMm.
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberExportPng(), and RenderGerberToPng().
| bool RenderGerberToPng | ( | const wxString & | aInputPath, |
| const wxString & | aOutputPath, | ||
| const JOB_GERBER_EXPORT_PNG & | aJob, | ||
| wxString * | aErrorMsg = nullptr, | ||
| wxArrayString * | aMessages = nullptr ) |
Render a Gerber or Excellon file to PNG using job parameters.
| aInputPath | Path to the Gerber or Excellon file |
| aOutputPath | Path for the output PNG file |
| aJob | Job containing render parameters |
| aErrorMsg | Optional pointer to receive error messages |
| aMessages | Optional pointer to receive parse messages |
Definition at line 331 of file gerber_to_png.cpp.
References GERBER_RENDER_OPTIONS::antialias, GERBER_RENDER_OPTIONS::backgroundColor, GERBER_RENDER_OPTIONS::dpi, GERBER_RENDER_OPTIONS::foregroundColor, GERBER_RENDER_OPTIONS::height, JOB_GERBER_EXPORT_PNG::INCH, JOB_GERBER_EXPORT_PNG::m_antialias, JOB_GERBER_EXPORT_PNG::m_backgroundColor, JOB_GERBER_EXPORT_PNG::m_dpi, JOB_GERBER_EXPORT_PNG::m_foregroundColor, JOB_GERBER_EXPORT_PNG::m_height, JOB_GERBER_EXPORT_PNG::m_originX, JOB_GERBER_EXPORT_PNG::m_originY, JOB_GERBER_EXPORT_PNG::m_transparentBackground, JOB_GERBER_EXPORT_PNG::m_units, JOB_GERBER_EXPORT_PNG::m_width, JOB_GERBER_EXPORT_PNG::m_windowHeight, JOB_GERBER_EXPORT_PNG::m_windowWidth, JOB_GERBER_EXPORT_PNG::MILS, JOB_GERBER_EXPORT_PNG::MM, GERBER_RENDER_OPTIONS::originXMm, GERBER_RENDER_OPTIONS::originYMm, RenderGerberToPng(), KIGFX::COLOR4D::WHITE, GERBER_RENDER_OPTIONS::width, GERBER_RENDER_OPTIONS::windowHeightMm, and GERBER_RENDER_OPTIONS::windowWidthMm.