|
KiCad PCB EDA Suite
|
Go to the source code of this file.
Functions | |
| wxImage | ConvertImageToBilevel (const wxImage &aImage, double aThreshold, bool aInvert) |
| Reduce an image to pure black and white. | |
| wxImage | MakeBilevelPreview (const wxImage &aImage, double aThreshold, bool aInvert, const wxSize &aRoom) |
| Produce the black and white view of an image, shrunk to fit a preview area. | |
| SHAPE_POLY_SET | TraceBilevelImage (const wxImage &aBilevelImage, double aScaleX, double aScaleY, REPORTER &aReporter) |
| Trace the black regions of a black and white image into filled polygons. | |
| wxImage ConvertImageToBilevel | ( | const wxImage & | aImage, |
| double | aThreshold, | ||
| bool | aInvert ) |
Reduce an image to pure black and white.
A pixel becomes black when it is darker than the threshold and opaque enough. Masked areas become white.
| aImage | is the source image. |
| aThreshold | is the brightness cut, from 0 to 1. |
| aInvert | inverts the greyscale before the cut is applied. |
Definition at line 86 of file bitmap_tracing.cpp.
References source.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DRAWING_TOOL::ConvertImageToOutlines(), SCH_EDIT_TOOL::ConvertImageToOutlines(), BITMAP_IMPORT_PLUGIN::Import(), and MakeBilevelPreview().
| wxImage MakeBilevelPreview | ( | const wxImage & | aImage, |
| double | aThreshold, | ||
| bool | aInvert, | ||
| const wxSize & | aRoom ) |
Produce the black and white view of an image, shrunk to fit a preview area.
The aspect ratio is kept, and an image already smaller than the area is left alone.
| aImage | is the source image. |
| aThreshold | is the brightness cut, from 0 to 1. |
| aInvert | inverts the greyscale before the cut is applied. |
| aRoom | is the area the result has to fit inside. |
Definition at line 134 of file bitmap_tracing.cpp.
References ConvertImageToBilevel(), and KiROUND().
Referenced by DIALOG_IMPORT_GFX::updatePreview(), and DIALOG_IMPORT_GRAPHICS::updatePreview().
| SHAPE_POLY_SET TraceBilevelImage | ( | const wxImage & | aBilevelImage, |
| double | aScaleX, | ||
| double | aScaleY, | ||
| REPORTER & | aReporter ) |
Trace the black regions of a black and white image into filled polygons.
Holes are fractured into their outlines, so every returned outline is a simple polygon that can be drawn filled.
| aBilevelImage | is an image produced by ConvertImageToBilevel. |
| aScaleX | converts pixels to caller units on X. |
| aScaleY | converts pixels to caller units on Y. A negative value flips the Y axis. |
| aReporter | receives errors. |
Definition at line 153 of file bitmap_tracing.cpp.
References _, SHAPE_POLY_SET::Append(), BezierToPolyline(), SHAPE_POLY_SET::BooleanSubtract(), SHAPE_POLY_SET::Fracture(), KiROUND(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::NormalizeAreaOutlines(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), path, SHAPE_POLY_SET::RemoveAllContours(), REPORTER::Report(), result, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and SHAPE_POLY_SET::Simplify().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DRAWING_TOOL::ConvertImageToOutlines(), SCH_EDIT_TOOL::ConvertImageToOutlines(), and BITMAP_IMPORT_PLUGIN::Import().