![]() |
Geometrize 1.0
C++ library for geometrizing images into geometric primitives
|
Functions | |
static thread_local std::mt19937 | mt (std::random_device{}()) |
void | seedRandomGenerator (std::uint32_t seed) |
seedRandomGenerator Seeds the (thread-local) random number generators. More... | |
std::int32_t | randomRange (std::int32_t min, std::int32_t max) |
randomRange Returns a random integer in the range, inclusive. Uses thread-local random number generators under the hood. To ensure deterministic shape generation that can be repeated for different seeds, this should be used for shape mutation, but nothing else. More... | |
geometrize::rgba | getAverageImageColor (const geometrize::Bitmap &image) |
getAverageImageColor Computes the average RGB color of the pixels in the bitmap. More... | |
bool | scanlinesContainTransparentPixels (const std::vector< geometrize::Scanline > &scanlines, const geometrize::Bitmap &image, int minAlpha) |
scanlinesContainTransparentPixels Returns true if the scanlines contain transparent pixels in the given image More... | |
std::tuple< std::int32_t, std::int32_t, std::int32_t, std::int32_t > | mapShapeBoundsToImage (const geometrize::ImageRunnerShapeBoundsOptions &options, const geometrize::Bitmap &image) |
mapShapeBoundsToImage Maps the given shape bound percentages to the given image, returning a bounding rectangle, or the whole image if the bounds were invalid More... | |
template<typename T > | |
T | clamp (const T &value, const T &lower, const T &upper) |
clamp Clamps a value within a range. More... | |
Variables | |
static thread_local std::uniform_int_distribution< std::int32_t > | pick |
T geometrize::commonutil::clamp | ( | const T & | value, |
const T & | lower, | ||
const T & | upper | ||
) |
clamp Clamps a value within a range.
value | The value to clamp. |
lower | The lower bound of the range. |
upper | The upper bound of the range. |
geometrize::rgba geometrize::commonutil::getAverageImageColor | ( | const geometrize::Bitmap & | image | ) |
getAverageImageColor Computes the average RGB color of the pixels in the bitmap.
image | The image whose average color will be calculated. |
std::tuple< std::int32_t, std::int32_t, std::int32_t, std::int32_t > geometrize::commonutil::mapShapeBoundsToImage | ( | const geometrize::ImageRunnerShapeBoundsOptions & | options, |
const geometrize::Bitmap & | image | ||
) |
mapShapeBoundsToImage Maps the given shape bound percentages to the given image, returning a bounding rectangle, or the whole image if the bounds were invalid
The | options to map to the image |
The | image to map the options around |
|
static |
std::int32_t geometrize::commonutil::randomRange | ( | std::int32_t | min, |
std::int32_t | max | ||
) |
randomRange Returns a random integer in the range, inclusive. Uses thread-local random number generators under the hood. To ensure deterministic shape generation that can be repeated for different seeds, this should be used for shape mutation, but nothing else.
min | The lower bound. |
max | The upper bound. |
bool geometrize::commonutil::scanlinesContainTransparentPixels | ( | const std::vector< geometrize::Scanline > & | scanlines, |
const geometrize::Bitmap & | image, | ||
int | minAlpha | ||
) |
scanlinesContainTransparentPixels Returns true if the scanlines contain transparent pixels in the given image
scanlines | The scanlines to check |
image | The image whose pixels to check |
minAlpha | The minimum alpha level (0-255) to consider transparent |
void geometrize::commonutil::seedRandomGenerator | ( | std::uint32_t | seed | ) |
seedRandomGenerator Seeds the (thread-local) random number generators.
seed | The random seed. |
|
static |