#[repr(C)] pub struct std__Vector_base { pub _M_impl: std__Vector_base__Vector_impl, } #[repr(C)] pub struct std__Vector_base__Vector_impl_data { pub _M_start: usize, pub _M_finish: usize, pub _M_end_of_stor11age: usize, } #[repr(C)] pub struct std__Vector_base__Vector_impl { pub _base_1: std__Vector_base__Vector_impl_data, } #[repr(C)] pub struct std_vector { pub _base: std__Vector_base, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct std_tuple { pub _address: u8, } #[repr(C)] #[derive(Debug)] pub struct std_unique_ptr { pub _M_t: u8, } #[repr(C)] #[derive(Debug)] pub struct std_shared_ptr { pub _address: u8, } #[doc = " @brief The rgba struct is a helper for manipulating RGBA8888 color data.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct geometrize_rgba { pub r: u8, #[doc = "> The red component (0-255)."] pub g: u8, #[doc = "> The green component (0-255)."] pub b: u8, #[doc = "> The blue component (0-255)."] pub a: u8, } extern "C" { #[doc = " @brief seedRandomGenerator Seeds the (thread-local) random number generators.\n @param seed The random seed."] #[link_name = "\u{1}_ZN10geometrize10commonutil19seedRandomGeneratorEj"] pub fn geometrize_commonutil_seedRandomGenerator(seed: ::std::os::raw::c_uint); } extern "C" { #[doc = " @brief randomRange Returns a random integer in the range, inclusive. Uses thread-local random number generators under the hood.\n To ensure deterministic shape generation that can be repeated for different seeds, this should be used for shape mutation, but nothing else.\n @param min The lower bound.\n @param max The upper bound.\n @return The random integer in the range."] #[link_name = "\u{1}_ZN10geometrize10commonutil11randomRangeEii"] pub fn geometrize_commonutil_randomRange( min: ::std::os::raw::c_int, max: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } extern "C" { #[doc = " @brief getAverageImageColor Computes the average RGB color of the pixels in the bitmap.\n @param image The image whose average color will be calculated.\n @return The average RGB color of the image, RGBA8888 format. Alpha is set to opaque (255)."] #[link_name = "\u{1}_ZN10geometrize10commonutil20getAverageImageColorERKNS_6BitmapE"] pub fn geometrize_commonutil_getAverageImageColor( image: *const geometrize_Bitmap, ) -> geometrize_rgba; } #[repr(C)] pub struct bounds { min_x: i32, min_y: i32, max_x: i32, max_y: i32, } extern "C" { #[doc = " @brief mapShapeBoundsToImage Maps the given shape bound percentages to the given image, returning a bounding rectangle, or the whole image if the bounds were invalid\n @param The options to map to the image\n @param The image to map the options around\n @return The mapped shape bounds (xMin, yMin, xMax, yMax)"] #[link_name = "\u{1}_ZN10geometrize10commonutil21mapShapeBoundsToImageERKNS_29ImageRunnerShapeBoundsOptionsERKNS_6BitmapE"] pub fn geometrize_commonutil_mapShapeBoundsToImage( options: *const geometrize_ImageRunnerShapeBoundsOptions, image: *const geometrize_Bitmap, ) -> bounds; } #[doc = " @brief The ShapeResult struct is a container for info about a shape added to the model.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_ShapeResult { pub score: f64, pub color: geometrize_rgba, pub shape: std_shared_ptr, } #[doc = " @brief The Bitmap class is a helper class for working with bitmap data.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] pub struct geometrize_Bitmap { #[doc = "< The width of the bitmap."] pub m_width: ::std::os::raw::c_uint, #[doc = "< The height of the bitmap."] pub m_height: ::std::os::raw::c_uint, #[doc = "< The bitmap data."] pub m_data: *mut u8, } extern "C" { #[doc = " @brief getWidth Gets the width of the bitmap."] #[link_name = "\u{1}_ZNK10geometrize6Bitmap8getWidthEv"] pub fn geometrize_Bitmap_getWidth(this: *const geometrize_Bitmap) -> ::std::os::raw::c_uint; } extern "C" { #[doc = " @brief getHeight Gets the height of the bitmap."] #[link_name = "\u{1}_ZNK10geometrize6Bitmap9getHeightEv"] pub fn geometrize_Bitmap_getHeight(this: *const geometrize_Bitmap) -> ::std::os::raw::c_uint; } extern "C" { #[doc = " @brief getPixel Gets a pixel color value.\n @param x The x-coordinate of the pixel.\n @param y The y-coordinate of the pixel.\n @return The pixel RGBA color value."] #[link_name = "\u{1}_ZNK10geometrize6Bitmap8getPixelEjj"] pub fn geometrize_Bitmap_getPixel( this: *const geometrize_Bitmap, x: ::std::os::raw::c_uint, y: ::std::os::raw::c_uint, ) -> geometrize_rgba; } extern "C" { #[doc = " @brief setPixel Sets a pixel color value.\n @param x The x-coordinate of the pixel.\n @param y The y-coordinate of the pixel.\n @param color The pixel RGBA color value."] #[link_name = "\u{1}_ZN10geometrize6Bitmap8setPixelEjjNS_4rgbaE"] pub fn geometrize_Bitmap_setPixel( this: *mut geometrize_Bitmap, x: ::std::os::raw::c_uint, y: ::std::os::raw::c_uint, color: geometrize_rgba, ); } extern "C" { #[doc = " @brief fill Fills the bitmap with the given color.\n @param color The color to fill the bitmap with."] #[link_name = "\u{1}_ZN10geometrize6Bitmap4fillENS_4rgbaE"] pub fn geometrize_Bitmap_fill(this: *mut geometrize_Bitmap, color: geometrize_rgba); } extern "C" { #[doc = " @brief Bitmap Creates a new bitmap.\n @param width The width of the bitmap.\n @param height The height of the bitmap.\n @param color The starting color of the bitmap (RGBA format)."] #[link_name = "\u{1}_ZN10geometrize6BitmapC1EjjNS_4rgbaE"] pub fn geometrize_Bitmap_Bitmap( this: *mut geometrize_Bitmap, width: ::std::os::raw::c_uint, height: ::std::os::raw::c_uint, color: geometrize_rgba, ); } extern "C" { #[doc = " @brief Bitmap Creates a new bitmap from the supplied byte data.\n @param width The width of the bitmap.\n @param height The height of the bitmap.\n @param data The byte data to fill the bitmap with, must be width * height * depth (4) long."] #[link_name = "\u{1}_ZN10geometrize6BitmapC1EjjRKSt6vectorIhSaIhEE"] pub fn geometrize_Bitmap_Bitmap1( this: *mut geometrize_Bitmap, width: ::std::os::raw::c_uint, height: ::std::os::raw::c_uint, data: *const u8, ); } impl geometrize_Bitmap { #[inline] pub unsafe fn getWidth(&self) -> ::std::os::raw::c_uint { geometrize_Bitmap_getWidth(self) } #[inline] pub unsafe fn getHeight(&self) -> ::std::os::raw::c_uint { geometrize_Bitmap_getHeight(self) } #[inline] pub unsafe fn getPixel( &self, x: ::std::os::raw::c_uint, y: ::std::os::raw::c_uint, ) -> geometrize_rgba { geometrize_Bitmap_getPixel(self, x, y) } #[inline] pub unsafe fn setPixel( &mut self, x: ::std::os::raw::c_uint, y: ::std::os::raw::c_uint, color: geometrize_rgba, ) { geometrize_Bitmap_setPixel(self, x, y, color) } #[inline] pub unsafe fn fill(&mut self, color: geometrize_rgba) { geometrize_Bitmap_fill(self, color) } #[inline] pub unsafe fn new( width: ::std::os::raw::c_uint, height: ::std::os::raw::c_uint, color: geometrize_rgba, ) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Bitmap_Bitmap(__bindgen_tmp.as_mut_ptr(), width, height, color); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn new1( width: ::std::os::raw::c_uint, height: ::std::os::raw::c_uint, data: *const u8, ) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Bitmap_Bitmap1(__bindgen_tmp.as_mut_ptr(), width, height, data); __bindgen_tmp.assume_init() } } #[doc = " @brief The Scanline class represents a scanline, a row of pixels running across a bitmap.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_Scanline { #[doc = "< The y-coordinate of the scanline."] pub y: ::std::os::raw::c_int, #[doc = "< The leftmost x-coordinate of the scanline."] pub x1: ::std::os::raw::c_int, #[doc = "< The rightmost x-coordinate of the scanline."] pub x2: ::std::os::raw::c_int, } extern "C" { #[doc = " @brief Scanline Creates a new scanline.\n @param y The y-coordinate.\n @param x1 The leftmost x-coordinate.\n @param x2 The rightmost x-coordinate."] #[link_name = "\u{1}_ZN10geometrize8ScanlineC1Eiii"] pub fn geometrize_Scanline_Scanline( this: *mut geometrize_Scanline, y: ::std::os::raw::c_int, x1: ::std::os::raw::c_int, x2: ::std::os::raw::c_int, ); } impl geometrize_Scanline { #[inline] pub unsafe fn new( y: ::std::os::raw::c_int, x1: ::std::os::raw::c_int, x2: ::std::os::raw::c_int, ) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Scanline_Scanline(__bindgen_tmp.as_mut_ptr(), y, x1, x2); __bindgen_tmp.assume_init() } } extern "C" { #[doc = " @brief trimScanlines Crops the scanning width of an array of scanlines so they do not scan outside of the given area.\n @param scanlines The scanlines to crop.\n @param minX The minimum x value to crop to.\n @param minY The minimum y value to crop to.\n @param maxX The maximum x value to crop to.\n @param maxY The maximum y value to crop to.\n @return A new vector of cropped scanlines."] #[link_name = "\u{1}_ZN10geometrize13trimScanlinesERKSt6vectorINS_8ScanlineESaIS1_EEiiii"] pub fn geometrize_trimScanlines( scanlines: *const std_vector, minX: ::std::os::raw::c_int, minY: ::std::os::raw::c_int, maxX: ::std::os::raw::c_int, maxY: ::std::os::raw::c_int, ) -> std_vector; } #[doc = " @brief The State class relates a shape and related properties to a measure of how close it brings the working image to the target image.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_State { #[doc = "< The score of the state, a measure of the improvement applying the state to the current bitmap will have."] pub m_score: f64, #[doc = "< The alpha of the shape."] pub m_alpha: ::std::os::raw::c_uchar, #[doc = "< The geometric primitive owned by the state."] pub m_shape: std_shared_ptr, } extern "C" { #[doc = " @brief mutate Modifies the current state in a random fashion.\n @return The old state, useful for undoing the mutation or keeping track of previous states."] #[link_name = "\u{1}_ZN10geometrize5State6mutateEv"] pub fn geometrize_State_mutate(this: *mut geometrize_State) -> geometrize_State; } extern "C" { #[link_name = "\u{1}_ZN10geometrize5StateC1Ev"] pub fn geometrize_State_State(this: *mut geometrize_State); } extern "C" { #[doc = " @brief Creates a new state.\n @param shape The shape.\n @param alpha The color alpha of the geometric shape."] #[link_name = "\u{1}_ZN10geometrize5StateC1ERKSt10shared_ptrINS_5ShapeEEh"] pub fn geometrize_State_State1( this: *mut geometrize_State, shape: *const std_shared_ptr, alpha: ::std::os::raw::c_uchar, ); } extern "C" { #[link_name = "\u{1}_ZN10geometrize5StateC1ERKS0_"] pub fn geometrize_State_State2(this: *mut geometrize_State, other: *const geometrize_State); } impl geometrize_State { #[inline] pub unsafe fn mutate(&mut self) -> geometrize_State { geometrize_State_mutate(self) } #[inline] pub unsafe fn new() -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_State_State(__bindgen_tmp.as_mut_ptr()); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn new1(shape: *const std_shared_ptr, alpha: ::std::os::raw::c_uchar) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_State_State1(__bindgen_tmp.as_mut_ptr(), shape, alpha); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn new2(other: *const geometrize_State) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_State_State2(__bindgen_tmp.as_mut_ptr(), other); __bindgen_tmp.assume_init() } } #[doc = " @brief EnergyFunction Type alias for a function that calculates a measure of the improvement adding the scanlines of a shape provides - lower energy is better.\n @param lines The scanlines of the shape.\n @param alpha The alpha of the scanlines.\n @param target The target bitmap.\n @param current The current bitmap.\n @param buffer The buffer bitmap.\n @param score The score.\n @return The energy measure."] pub type geometrize_core_EnergyFunction = [u64; 4usize]; extern "C" { #[doc = " @brief defaultEnergyFunction The default/built-in energy function that calculates a measure of the improvement adding the scanlines of a shape provides - lower energy is better.\n @param lines The scanlines of the shape.\n @param alpha The alpha of the scanlines.\n @param target The target bitmap.\n @param current The current bitmap.\n @param buffer The buffer bitmap.\n @param score The score.\n @return The energy measure."] #[link_name = "\u{1}_ZN10geometrize4core21defaultEnergyFunctionERKSt6vectorINS_8ScanlineESaIS2_EEjRKNS_6BitmapES9_RS7_d"] pub fn geometrize_core_defaultEnergyFunction( lines: *const std_vector, alpha: ::std::os::raw::c_uint, target: *const geometrize_Bitmap, current: *const geometrize_Bitmap, buffer: *mut geometrize_Bitmap, score: f64, ) -> f64; } extern "C" { #[doc = " @brief computeColor Calculates the color of the scanlines.\n @param target The target image.\n @param current The current image.\n @param lines The scanlines.\n @param alpha The alpha of the scanline.\n @return The color of the scanlines."] #[link_name = "\u{1}_ZN10geometrize4core12computeColorERKNS_6BitmapES3_RKSt6vectorINS_8ScanlineESaIS5_EEh"] pub fn geometrize_core_computeColor( target: *const geometrize_Bitmap, current: *const geometrize_Bitmap, lines: *const std_vector, alpha: ::std::os::raw::c_uchar, ) -> geometrize_rgba; } extern "C" { #[doc = " @brief differenceFull Calculates the root-mean-square error between two bitmaps.\n @param first The first bitmap.\n @param second The second bitmap.\n @return The difference/error measure between the two bitmaps."] #[link_name = "\u{1}_ZN10geometrize4core14differenceFullERKNS_6BitmapES3_"] pub fn geometrize_core_differenceFull( first: *const geometrize_Bitmap, second: *const geometrize_Bitmap, ) -> f64; } extern "C" { #[doc = " @brief differencePartial Calculates the root-mean-square error between the parts of the two bitmaps within the scanline mask.\n This is for optimization purposes, it lets us calculate new error values only for parts of the image we know have changed.\n @param target The target bitmap.\n @param before The bitmap before the change.\n @param after The bitmap after the change.\n @param score The score.\n @param lines The scanlines.\n @return The difference/error between the two bitmaps, masked by the scanlines."] #[link_name = "\u{1}_ZN10geometrize4core17differencePartialERKNS_6BitmapES3_S3_dRKSt6vectorINS_8ScanlineESaIS5_EE"] pub fn geometrize_core_differencePartial( target: *const geometrize_Bitmap, before: *const geometrize_Bitmap, after: *const geometrize_Bitmap, score: f64, lines: *const std_vector, ) -> f64; } extern "C" { #[doc = " @brief bestHillClimbState Gets the best state using a hill climbing algorithm.\n @param shapeCreator A function that will create the shapes that will be chosen from.\n @param alpha The opacity of the shape.\n @param n The number of random states to generate.\n @param age The number of hillclimbing steps.\n @param target The target bitmap.\n @param current The current bitmap.\n @param buffer The buffer bitmap.\n @param lastScore The last score.\n @param customEnergyFunction An optional function to calculate the energy (if unspecified a default implementation is used).\n @return The best state acquired from hill climbing i.e. the one with the lowest energy."] #[link_name = "\u{1}_ZN10geometrize4core18bestHillClimbStateERKSt8functionIFSt10shared_ptrINS_5ShapeEEvEEjjjRKNS_6BitmapESB_RS9_dRKS1_IFdRKSt6vectorINS_8ScanlineESaISE_EEjSB_SB_SC_dEE"] pub fn geometrize_core_bestHillClimbState( shapeCreator: *const [u64; 4usize], alpha: ::std::os::raw::c_uint, n: ::std::os::raw::c_uint, age: ::std::os::raw::c_uint, target: *const geometrize_Bitmap, current: *const geometrize_Bitmap, buffer: *mut geometrize_Bitmap, lastScore: f64, customEnergyFunction: *const geometrize_core_EnergyFunction, ) -> geometrize_State; } #[doc = " @brief ShapeAcceptancePreconditionFunction Type alias for a function that is used to decide whether or not to finally add a shape to the image\n @param lastScore The image similarity score prior to adding the shape\n @param newScore What the image similarity score would be after adding the shape\n @param shape The shape that this function shall decide whether to add\n @param lines The scanlines for the pixels in the shape\n @param color The colour of the shape\n @param before The image prior to adding the shape\n @param after The image as it would be after adding the shape\n @param target The image that we are trying to replicate\n @return True to add the shape to the image, false not to"] pub type geometrize_ShapeAcceptancePreconditionFunction = [u64; 4usize]; #[doc = " @brief The Model class is the model for the core optimization/fitting algorithm.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_Model { pub d: std_unique_ptr, } extern "C" { #[doc = " @brief reset Resets the model back to the state it was in when it was created.\n @param backgroundColor The starting background color to use."] #[link_name = "\u{1}_ZN10geometrize5Model5resetENS_4rgbaE"] pub fn geometrize_Model_reset(this: *mut geometrize_Model, backgroundColor: geometrize_rgba); } extern "C" { #[doc = " @brief getWidth Gets the width of the target bitmap.\n @return The width of the target bitmap."] #[link_name = "\u{1}_ZNK10geometrize5Model8getWidthEv"] pub fn geometrize_Model_getWidth(this: *const geometrize_Model) -> ::std::os::raw::c_int; } extern "C" { #[doc = " @brief getHeight Gets the height of the target bitmap.\n @return The height of the target bitmap."] #[link_name = "\u{1}_ZNK10geometrize5Model9getHeightEv"] pub fn geometrize_Model_getHeight(this: *const geometrize_Model) -> ::std::os::raw::c_int; } extern "C" { #[doc = " @brief step Steps the primitive optimization/fitting algorithm.\n @param shapeCreator A function that will produce the shapes.\n @param alpha The alpha of the shape.\n @param shapeCount The number of random shapes to generate (only 1 is chosen in the end).\n @param maxShapeMutations The maximum number of times to mutate each random shape.\n @param maxThreads The maximum number of threads to use during this step.\n @param energyFunction An optional function to calculate the energy (if unspecified a default implementation is used).\n @param addShapePrecondition An optional function to determine whether to accept a shape (if unspecified a default implementation is used).\n @return A vector containing data about the shapes added to the model in this step. This may be empty if no shape that improved the image could be found."] #[link_name = "\u{1}_ZN10geometrize5Model4stepERKSt8functionIFSt10shared_ptrINS_5ShapeEEvEEhjjjRKS1_IFdRKSt6vectorINS_8ScanlineESaISA_EEjRKNS_6BitmapESH_RSF_dEERKS1_IFbddRKS3_SE_RKNS_4rgbaESH_SH_SH_EE"] pub fn geometrize_Model_step( this: *mut geometrize_Model, shapeCreator: *const [u64; 4usize], alpha: ::std::os::raw::c_uchar, shapeCount: ::std::os::raw::c_uint, maxShapeMutations: ::std::os::raw::c_uint, maxThreads: ::std::os::raw::c_uint, energyFunction: *const geometrize_core_EnergyFunction, addShapePrecondition: *const geometrize_ShapeAcceptancePreconditionFunction, ) -> std_vector; } extern "C" { #[doc = " @brief drawShape Draws a shape on the model. Typically used when to manually add a shape to the image (e.g. when setting an initial background).\n NOTE this unconditionally draws the shape, even if it increases the difference between the source and target image.\n @param shape The shape to draw.\n @param color The color (including alpha) of the shape.\n @return Data about the shape drawn on the model."] #[link_name = "\u{1}_ZN10geometrize5Model9drawShapeESt10shared_ptrINS_5ShapeEENS_4rgbaE"] pub fn geometrize_Model_drawShape( this: *mut geometrize_Model, shape: std_shared_ptr, color: geometrize_rgba, ) -> geometrize_ShapeResult; } extern "C" { #[doc = " @brief getCurrent Gets the current bitmap.\n @return The current bitmap."] #[link_name = "\u{1}_ZN10geometrize5Model10getCurrentEv"] pub fn geometrize_Model_getCurrent(this: *mut geometrize_Model) -> *mut geometrize_Bitmap; } extern "C" { #[doc = " @brief getTarget Gets the target bitmap.\n @return The target bitmap."] #[link_name = "\u{1}_ZN10geometrize5Model9getTargetEv"] pub fn geometrize_Model_getTarget(this: *mut geometrize_Model) -> *mut geometrize_Bitmap; } extern "C" { #[doc = " @brief getCurrent Gets the current bitmap, const-edition.\n @return The current bitmap."] #[link_name = "\u{1}_ZNK10geometrize5Model10getCurrentEv"] pub fn geometrize_Model_getCurrent1(this: *const geometrize_Model) -> *const geometrize_Bitmap; } extern "C" { #[doc = " @brief getTarget Gets the target bitmap, const-edition.\n @return The target bitmap."] #[link_name = "\u{1}_ZNK10geometrize5Model9getTargetEv"] pub fn geometrize_Model_getTarget1(this: *const geometrize_Model) -> *const geometrize_Bitmap; } extern "C" { #[doc = " @brief setSeed Sets the seed that the random number generators of this model use. Note that the model also uses an internal seed offset which is incremented when the model is stepped.\n @param seed The random number generator seed."] #[link_name = "\u{1}_ZN10geometrize5Model7setSeedEj"] pub fn geometrize_Model_setSeed(this: *mut geometrize_Model, seed: ::std::os::raw::c_uint); } extern "C" { #[doc = " @brief Model Creates a model that will aim to replicate the target bitmap with shapes.\n @param target The target bitmap to replicate with shapes."] #[link_name = "\u{1}_ZN10geometrize5ModelC1ERKNS_6BitmapE"] pub fn geometrize_Model_Model(this: *mut geometrize_Model, target: *const geometrize_Bitmap); } extern "C" { #[doc = " @brief Model Creates a model that will optimize for the given target bitmap, starting from the given initial bitmap.\n The target bitmap and initial bitmap must be the same size (width and height).\n @param target The target bitmap to replicate with shapes.\n @param initial The starting bitmap."] #[link_name = "\u{1}_ZN10geometrize5ModelC1ERKNS_6BitmapES3_"] pub fn geometrize_Model_Model1( this: *mut geometrize_Model, target: *const geometrize_Bitmap, initial: *const geometrize_Bitmap, ); } extern "C" { #[link_name = "\u{1}_ZN10geometrize5ModelD1Ev"] pub fn geometrize_Model_Model_destructor(this: *mut geometrize_Model); } impl geometrize_Model { #[inline] pub unsafe fn reset(&mut self, backgroundColor: geometrize_rgba) { geometrize_Model_reset(self, backgroundColor) } #[inline] pub unsafe fn getWidth(&self) -> ::std::os::raw::c_int { geometrize_Model_getWidth(self) } #[inline] pub unsafe fn getHeight(&self) -> ::std::os::raw::c_int { geometrize_Model_getHeight(self) } #[inline] pub unsafe fn step( &mut self, shapeCreator: *const [u64; 4usize], alpha: ::std::os::raw::c_uchar, shapeCount: ::std::os::raw::c_uint, maxShapeMutations: ::std::os::raw::c_uint, maxThreads: ::std::os::raw::c_uint, energyFunction: *const geometrize_core_EnergyFunction, addShapePrecondition: *const geometrize_ShapeAcceptancePreconditionFunction, ) -> std_vector { geometrize_Model_step( self, shapeCreator, alpha, shapeCount, maxShapeMutations, maxThreads, energyFunction, addShapePrecondition, ) } #[inline] pub unsafe fn drawShape( &mut self, shape: std_shared_ptr, color: geometrize_rgba, ) -> geometrize_ShapeResult { geometrize_Model_drawShape(self, shape, color) } #[inline] pub unsafe fn getCurrent(&mut self) -> *mut geometrize_Bitmap { geometrize_Model_getCurrent(self) } #[inline] pub unsafe fn getTarget(&mut self) -> *mut geometrize_Bitmap { geometrize_Model_getTarget(self) } #[inline] pub unsafe fn getCurrent1(&self) -> *const geometrize_Bitmap { geometrize_Model_getCurrent1(self) } #[inline] pub unsafe fn getTarget1(&self) -> *const geometrize_Bitmap { geometrize_Model_getTarget1(self) } #[inline] pub unsafe fn setSeed(&mut self, seed: ::std::os::raw::c_uint) { geometrize_Model_setSeed(self, seed) } #[inline] pub unsafe fn new(target: *const geometrize_Bitmap) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Model_Model(__bindgen_tmp.as_mut_ptr(), target); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn new1( target: *const geometrize_Bitmap, initial: *const geometrize_Bitmap, ) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Model_Model1(__bindgen_tmp.as_mut_ptr(), target, initial); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn destruct(&mut self) { geometrize_Model_Model_destructor(self) } } #[doc = " @brief The ImageRunner class is a helper class for creating a set of primitives from a source image.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_ImageRunner { pub d: std_unique_ptr, } extern "C" { #[doc = " @brief step Updates the internal model once.\n @param options Various configurable settings for doing the step e.g. the shape types to consider.\n @param shapeCreator An optional function for creating and mutating shapes\n @param energyFunction An optional function to calculate the energy (if unspecified a default implementation is used).\n @param addShapePrecondition An optional function to determine whether to accept a shape (if unspecified a default implementation is used).\n @return A vector containing data about the shapes just added to the internal model."] #[link_name = "\u{1}_ZN10geometrize11ImageRunner4stepERKNS_18ImageRunnerOptionsESt8functionIFSt10shared_ptrINS_5ShapeEEvEES4_IFdRKSt6vectorINS_8ScanlineESaISB_EEjRKNS_6BitmapESI_RSG_dEES4_IFbddRKS6_SF_RKNS_4rgbaESI_SI_SI_EE"] pub fn geometrize_ImageRunner_step( this: *mut geometrize_ImageRunner, options: *const geometrize_ImageRunnerOptions, shapeCreator: [u64; 4usize], energyFunction: geometrize_core_EnergyFunction, addShapePrecondition: geometrize_ShapeAcceptancePreconditionFunction, ) -> std_vector; } extern "C" { #[doc = " @brief getCurrent Gets the current bitmap with the primitives drawn on it.\n @return The current bitmap."] #[link_name = "\u{1}_ZN10geometrize11ImageRunner10getCurrentEv"] pub fn geometrize_ImageRunner_getCurrent( this: *mut geometrize_ImageRunner, ) -> *mut geometrize_Bitmap; } extern "C" { #[doc = " @brief getTarget Gets the target bitmap.\n @return The target bitmap."] #[link_name = "\u{1}_ZN10geometrize11ImageRunner9getTargetEv"] pub fn geometrize_ImageRunner_getTarget( this: *mut geometrize_ImageRunner, ) -> *mut geometrize_Bitmap; } extern "C" { #[doc = " @brief getCurrent Gets the current bitmap with the primitives drawn on it, const-edition.\n @return The current bitmap."] #[link_name = "\u{1}_ZNK10geometrize11ImageRunner10getCurrentEv"] pub fn geometrize_ImageRunner_getCurrent1( this: *const geometrize_ImageRunner, ) -> *const geometrize_Bitmap; } extern "C" { #[doc = " @brief getTarget Gets the target bitmap, const-edition.\n @return The target bitmap."] #[link_name = "\u{1}_ZNK10geometrize11ImageRunner9getTargetEv"] pub fn geometrize_ImageRunner_getTarget1( this: *const geometrize_ImageRunner, ) -> *const geometrize_Bitmap; } extern "C" { #[doc = " @brief getModel Gets the underlying model.\n @return The model."] #[link_name = "\u{1}_ZN10geometrize11ImageRunner8getModelEv"] pub fn geometrize_ImageRunner_getModel( this: *mut geometrize_ImageRunner, ) -> *mut geometrize_Model; } extern "C" { #[doc = " @brief ImageRunner Creates an new image runner with the given target bitmap. Uses the average color of the target as the starting image.\n @param targetBitmap The target bitmap to replicate with shapes."] #[link_name = "\u{1}_ZN10geometrize11ImageRunnerC1ERKNS_6BitmapE"] pub fn geometrize_ImageRunner_ImageRunner( this: *mut geometrize_ImageRunner, targetBitmap: *const geometrize_Bitmap, ); } extern "C" { #[doc = " @brief ImageRunner Creates an image runner with the given target bitmap, starting from the given initial bitmap.\n The target bitmap and initial bitmap must be the same size (width and height).\n @param targetBitmap The target bitmap to replicate with shapes.\n @param initialBitmap The starting bitmap."] #[link_name = "\u{1}_ZN10geometrize11ImageRunnerC1ERKNS_6BitmapES3_"] pub fn geometrize_ImageRunner_ImageRunner1( this: *mut geometrize_ImageRunner, targetBitmap: *const geometrize_Bitmap, initialBitmap: *const geometrize_Bitmap, ); } extern "C" { #[link_name = "\u{1}_ZN10geometrize11ImageRunnerD1Ev"] pub fn geometrize_ImageRunner_ImageRunner_destructor(this: *mut geometrize_ImageRunner); } impl geometrize_ImageRunner { #[inline] pub unsafe fn step( &mut self, options: *const geometrize_ImageRunnerOptions, shapeCreator: [u64; 4usize], energyFunction: geometrize_core_EnergyFunction, addShapePrecondition: geometrize_ShapeAcceptancePreconditionFunction, ) -> std_vector { geometrize_ImageRunner_step( self, options, shapeCreator, energyFunction, addShapePrecondition, ) } #[inline] pub unsafe fn getCurrent(&mut self) -> *mut geometrize_Bitmap { geometrize_ImageRunner_getCurrent(self) } #[inline] pub unsafe fn getTarget(&mut self) -> *mut geometrize_Bitmap { geometrize_ImageRunner_getTarget(self) } #[inline] pub unsafe fn getCurrent1(&self) -> *const geometrize_Bitmap { geometrize_ImageRunner_getCurrent1(self) } #[inline] pub unsafe fn getTarget1(&self) -> *const geometrize_Bitmap { geometrize_ImageRunner_getTarget1(self) } #[inline] pub unsafe fn getModel(&mut self) -> *mut geometrize_Model { geometrize_ImageRunner_getModel(self) } #[inline] pub unsafe fn new(targetBitmap: *const geometrize_Bitmap) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_ImageRunner_ImageRunner(__bindgen_tmp.as_mut_ptr(), targetBitmap); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn new1( targetBitmap: *const geometrize_Bitmap, initialBitmap: *const geometrize_Bitmap, ) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_ImageRunner_ImageRunner1( __bindgen_tmp.as_mut_ptr(), targetBitmap, initialBitmap, ); __bindgen_tmp.assume_init() } #[inline] pub unsafe fn destruct(&mut self) { geometrize_ImageRunner_ImageRunner_destructor(self) } } pub const RECTANGLE: geometrize_ShapeTypes = 1; pub const ROTATED_RECTANGLE: geometrize_ShapeTypes = 2; pub const TRIANGLE: geometrize_ShapeTypes = 4; pub const ELLIPSE: geometrize_ShapeTypes = 8; pub const ROTATED_ELLIPSE: geometrize_ShapeTypes = 16; pub const CIRCLE: geometrize_ShapeTypes = 32; pub const LINE: geometrize_ShapeTypes = 64; pub const QUADRATIC_BEZIER: geometrize_ShapeTypes = 128; pub const POLYLINE: geometrize_ShapeTypes = 256; pub const SHAPE_COUNT: geometrize_ShapeTypes = 9; #[doc = " @brief The ShapeTypes enum specifies the types of shapes that can be used. These can be combined to produce images composed of multiple primitive types.\n @author Sam Twidale (https://samcodes.co.uk/)"] pub type geometrize_ShapeTypes = ::std::os::raw::c_uint; extern "C" { #[doc = " @brief allShapes is a convenient array of all of the members of ShapeTypes."] #[link_name = "\u{1}_ZN10geometrize9allShapesE"] pub static geometrize_allShapes: u8; } extern "C" { #[doc = " @brief shapeTypeNames provides a convenient mapping to names of types of shape (all lower case, underscores instead of spaces e.g. rotated_ellipse)."] #[link_name = "\u{1}_ZN10geometrize14shapeTypeNamesB5cxx11E"] pub static geometrize_shapeTypeNames: std_vector; } #[doc = " @brief The ImageRunnerShapeBoundsOptions struct encapsulates options for where shapes may be drawn within the image.\n Defines a rectangle expressed as percentages (0-100%) of the target image dimensions\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct geometrize_ImageRunnerShapeBoundsOptions { pub enabled: bool, pub xMinPercent: f64, pub yMinPercent: f64, pub xMaxPercent: f64, pub yMaxPercent: f64, } #[doc = " @brief The ImageRunnerOptions class encapsulates preferences/options that the image runner uses.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct geometrize_ImageRunnerOptions { #[doc = "< The shape types that the image runner shall use."] pub shapeTypes: geometrize_ShapeTypes, #[doc = "< The alpha/opacity of the shapes (0-255)."] pub alpha: ::std::os::raw::c_uchar, #[doc = "< The number of candidate shapes that will be tried per model step."] pub shapeCount: ::std::os::raw::c_uint, #[doc = "< The maximum number of times each candidate shape will be modified to attempt to find a better fit."] pub maxShapeMutations: ::std::os::raw::c_uint, #[doc = "< The seed for the random number generators used by the image runner."] pub seed: ::std::os::raw::c_uint, #[doc = "< The maximum number of separate threads for the implementation to use. 0 lets the implementation choose a reasonable number."] pub maxThreads: ::std::os::raw::c_uint, #[doc = "< If zero or do not form a rectangle, the entire target image is used i.e. (0, 0, imageWidth, imageHeight)"] pub shapeBounds: geometrize_ImageRunnerShapeBoundsOptions, } #[repr(C)] pub struct geometrize_Shape__bindgen_vtable(::std::os::raw::c_void); #[doc = " Base class for shape rasterization and manipulation.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_Shape { pub vtable_: *const geometrize_Shape__bindgen_vtable, pub setup: [u64; 4usize], pub mutate: [u64; 4usize], pub rasterize: [u64; 4usize], } #[doc = " @brief The Rectangle class represents a rectangle.\n @author Sam Twidale (https://samcodes.co.uk/)"] #[repr(C)] #[derive(Debug)] pub struct geometrize_Rectangle { pub _base: geometrize_Shape, #[doc = "< Left coordinate."] pub m_x1: f32, #[doc = "< Top coordinate."] pub m_y1: f32, #[doc = "< Right coordinate."] pub m_x2: f32, #[doc = "< Bottom coordinate."] pub m_y2: f32, } extern "C" { #[link_name = "\u{1}_ZN10geometrize9RectangleC1Effff"] pub fn geometrize_Rectangle_Rectangle( this: *mut geometrize_Rectangle, x1: f32, y1: f32, x2: f32, y2: f32, ); } impl geometrize_Rectangle { #[inline] pub unsafe fn new(x1: f32, y1: f32, x2: f32, y2: f32) -> Self { let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); geometrize_Rectangle_Rectangle(__bindgen_tmp.as_mut_ptr(), x1, y1, x2, y2); __bindgen_tmp.assume_init() } } extern "C" { #[link_name = "\u{1}_ZNK10geometrize9Rectangle5cloneEv"] pub fn geometrize_Rectangle_clone(this: *mut ::std::os::raw::c_void) -> std_shared_ptr; } extern "C" { #[link_name = "\u{1}_ZNK10geometrize9Rectangle7getTypeEv"] pub fn geometrize_Rectangle_getType(this: *mut ::std::os::raw::c_void) -> geometrize_ShapeTypes; } extern "C" { #[doc = " @brief createDefaultShapeCreator Creates an instance of the default shape creator object.\n The setup, mutate and rasterize methods are bound with default methods.\n @param types The types of shapes to create.\n @param xMin The minimum x coordinate of the shapes created.\n @param yMin The minimum y coordinate of the shapes created.\n @param xMax The maximum x coordinate of the shapes created.\n @param yMax The maximum y coordinate of the shapes created.\n @return The default shape creator."] #[link_name = "\u{1}_ZN10geometrize25createDefaultShapeCreatorENS_10ShapeTypesEiiii"] pub fn geometrize_createDefaultShapeCreator( types: geometrize_ShapeTypes, xMin: ::std::os::raw::c_int, yMin: ::std::os::raw::c_int, xMax: ::std::os::raw::c_int, yMax: ::std::os::raw::c_int, ) -> [u64; 4usize]; } extern "C" { #[doc = " @brief create Creates a new shape of the specified type.\n @param t The type of shape to create.\n @return The new shape."] #[link_name = "\u{1}_ZN10geometrize6createENS_10ShapeTypesE"] pub fn geometrize_create(t: geometrize_ShapeTypes) -> std_shared_ptr; } extern "C" { #[doc = " @brief randomShape Creates a random shape.\n @return The new shape."] #[link_name = "\u{1}_ZN10geometrize11randomShapeEv"] pub fn geometrize_randomShape() -> std_shared_ptr; } extern "C" { #[doc = " @brief randomShapeOf Creates a random shape from the types supplied.\n @param t The types of shape to possibly create.\n @return The new shape."] #[link_name = "\u{1}_ZN10geometrize13randomShapeOfENS_10ShapeTypesE"] pub fn geometrize_randomShapeOf(t: geometrize_ShapeTypes) -> std_shared_ptr; }