geometrize_sys/
bindings.rs

1#[repr(C)]
2pub struct std__Vector_base {
3    pub _M_impl: std__Vector_base__Vector_impl,
4}
5#[repr(C)]
6pub struct std__Vector_base__Vector_impl_data {
7    pub _M_start: usize,
8    pub _M_finish: usize,
9    pub _M_end_of_stor11age: usize,
10}
11#[repr(C)]
12pub struct std__Vector_base__Vector_impl {
13    pub _base_1: std__Vector_base__Vector_impl_data,
14}
15#[repr(C)]
16pub struct std_vector {
17    pub _base: std__Vector_base,
18}
19#[repr(C)]
20#[derive(Debug, Copy, Clone)]
21pub struct std_tuple {
22    pub _address: u8,
23}
24#[repr(C)]
25#[derive(Debug)]
26pub struct std_unique_ptr {
27    pub _M_t: u8,
28}
29#[repr(C)]
30#[derive(Debug)]
31pub struct std_shared_ptr {
32    pub _address: u8,
33}
34
35#[doc = " @brief The rgba struct is a helper for manipulating RGBA8888 color data.\n @author Sam Twidale (https://samcodes.co.uk/)"]
36#[repr(C)]
37#[derive(Debug, Copy, Clone)]
38pub struct geometrize_rgba {
39    pub r: u8,
40    #[doc = "> The red component (0-255)."]
41    pub g: u8,
42    #[doc = "> The green component (0-255)."]
43    pub b: u8,
44    #[doc = "> The blue component (0-255)."]
45    pub a: u8,
46}
47
48extern "C" {
49    #[doc = " @brief seedRandomGenerator Seeds the (thread-local) random number generators.\n @param seed The random seed."]
50    #[link_name = "\u{1}_ZN10geometrize10commonutil19seedRandomGeneratorEj"]
51    pub fn geometrize_commonutil_seedRandomGenerator(seed: ::std::os::raw::c_uint);
52}
53extern "C" {
54    #[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."]
55    #[link_name = "\u{1}_ZN10geometrize10commonutil11randomRangeEii"]
56    pub fn geometrize_commonutil_randomRange(
57        min: ::std::os::raw::c_int,
58        max: ::std::os::raw::c_int,
59    ) -> ::std::os::raw::c_int;
60}
61extern "C" {
62    #[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)."]
63    #[link_name = "\u{1}_ZN10geometrize10commonutil20getAverageImageColorERKNS_6BitmapE"]
64    pub fn geometrize_commonutil_getAverageImageColor(
65        image: *const geometrize_Bitmap,
66    ) -> geometrize_rgba;
67}
68
69#[repr(C)]
70pub struct bounds {
71	min_x: i32,
72	min_y: i32,
73	max_x: i32,
74	max_y: i32,
75}
76
77extern "C" {
78    #[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)"]
79    #[link_name = "\u{1}_ZN10geometrize10commonutil21mapShapeBoundsToImageERKNS_29ImageRunnerShapeBoundsOptionsERKNS_6BitmapE"]
80    pub fn geometrize_commonutil_mapShapeBoundsToImage(
81        options: *const geometrize_ImageRunnerShapeBoundsOptions,
82        image: *const geometrize_Bitmap,
83    ) -> bounds;
84}
85#[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/)"]
86#[repr(C)]
87#[derive(Debug)]
88pub struct geometrize_ShapeResult {
89    pub score: f64,
90    pub color: geometrize_rgba,
91    pub shape: std_shared_ptr,
92}
93#[doc = " @brief The Bitmap class is a helper class for working with bitmap data.\n @author Sam Twidale (https://samcodes.co.uk/)"]
94#[repr(C)]
95pub struct geometrize_Bitmap {
96    #[doc = "< The width of the bitmap."]
97    pub m_width: ::std::os::raw::c_uint,
98    #[doc = "< The height of the bitmap."]
99    pub m_height: ::std::os::raw::c_uint,
100    #[doc = "< The bitmap data."]
101    pub m_data: *mut u8,
102}
103extern "C" {
104    #[doc = " @brief getWidth Gets the width of the bitmap."]
105    #[link_name = "\u{1}_ZNK10geometrize6Bitmap8getWidthEv"]
106    pub fn geometrize_Bitmap_getWidth(this: *const geometrize_Bitmap) -> ::std::os::raw::c_uint;
107}
108extern "C" {
109    #[doc = " @brief getHeight Gets the height of the bitmap."]
110    #[link_name = "\u{1}_ZNK10geometrize6Bitmap9getHeightEv"]
111    pub fn geometrize_Bitmap_getHeight(this: *const geometrize_Bitmap) -> ::std::os::raw::c_uint;
112}
113extern "C" {
114    #[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."]
115    #[link_name = "\u{1}_ZNK10geometrize6Bitmap8getPixelEjj"]
116    pub fn geometrize_Bitmap_getPixel(
117        this: *const geometrize_Bitmap,
118        x: ::std::os::raw::c_uint,
119        y: ::std::os::raw::c_uint,
120    ) -> geometrize_rgba;
121}
122extern "C" {
123    #[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."]
124    #[link_name = "\u{1}_ZN10geometrize6Bitmap8setPixelEjjNS_4rgbaE"]
125    pub fn geometrize_Bitmap_setPixel(
126        this: *mut geometrize_Bitmap,
127        x: ::std::os::raw::c_uint,
128        y: ::std::os::raw::c_uint,
129        color: geometrize_rgba,
130    );
131}
132extern "C" {
133    #[doc = " @brief fill Fills the bitmap with the given color.\n @param color The color to fill the bitmap with."]
134    #[link_name = "\u{1}_ZN10geometrize6Bitmap4fillENS_4rgbaE"]
135    pub fn geometrize_Bitmap_fill(this: *mut geometrize_Bitmap, color: geometrize_rgba);
136}
137extern "C" {
138    #[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)."]
139    #[link_name = "\u{1}_ZN10geometrize6BitmapC1EjjNS_4rgbaE"]
140    pub fn geometrize_Bitmap_Bitmap(
141        this: *mut geometrize_Bitmap,
142        width: ::std::os::raw::c_uint,
143        height: ::std::os::raw::c_uint,
144        color: geometrize_rgba,
145    );
146}
147extern "C" {
148    #[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."]
149    #[link_name = "\u{1}_ZN10geometrize6BitmapC1EjjRKSt6vectorIhSaIhEE"]
150    pub fn geometrize_Bitmap_Bitmap1(
151        this: *mut geometrize_Bitmap,
152        width: ::std::os::raw::c_uint,
153        height: ::std::os::raw::c_uint,
154        data: *const u8,
155    );
156}
157impl geometrize_Bitmap {
158    #[inline]
159    pub unsafe fn getWidth(&self) -> ::std::os::raw::c_uint {
160        geometrize_Bitmap_getWidth(self)
161    }
162    #[inline]
163    pub unsafe fn getHeight(&self) -> ::std::os::raw::c_uint {
164        geometrize_Bitmap_getHeight(self)
165    }
166    #[inline]
167    pub unsafe fn getPixel(
168        &self,
169        x: ::std::os::raw::c_uint,
170        y: ::std::os::raw::c_uint,
171    ) -> geometrize_rgba {
172        geometrize_Bitmap_getPixel(self, x, y)
173    }
174    #[inline]
175    pub unsafe fn setPixel(
176        &mut self,
177        x: ::std::os::raw::c_uint,
178        y: ::std::os::raw::c_uint,
179        color: geometrize_rgba,
180    ) {
181        geometrize_Bitmap_setPixel(self, x, y, color)
182    }
183    #[inline]
184    pub unsafe fn fill(&mut self, color: geometrize_rgba) {
185        geometrize_Bitmap_fill(self, color)
186    }
187    #[inline]
188    pub unsafe fn new(
189        width: ::std::os::raw::c_uint,
190        height: ::std::os::raw::c_uint,
191        color: geometrize_rgba,
192    ) -> Self {
193        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
194        geometrize_Bitmap_Bitmap(__bindgen_tmp.as_mut_ptr(), width, height, color);
195        __bindgen_tmp.assume_init()
196    }
197    #[inline]
198    pub unsafe fn new1(
199        width: ::std::os::raw::c_uint,
200        height: ::std::os::raw::c_uint,
201        data: *const u8,
202    ) -> Self {
203        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
204        geometrize_Bitmap_Bitmap1(__bindgen_tmp.as_mut_ptr(), width, height, data);
205        __bindgen_tmp.assume_init()
206    }
207}
208#[doc = " @brief The Scanline class represents a scanline, a row of pixels running across a bitmap.\n @author Sam Twidale (https://samcodes.co.uk/)"]
209#[repr(C)]
210#[derive(Debug)]
211pub struct geometrize_Scanline {
212    #[doc = "< The y-coordinate of the scanline."]
213    pub y: ::std::os::raw::c_int,
214    #[doc = "< The leftmost x-coordinate of the scanline."]
215    pub x1: ::std::os::raw::c_int,
216    #[doc = "< The rightmost x-coordinate of the scanline."]
217    pub x2: ::std::os::raw::c_int,
218}
219extern "C" {
220    #[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."]
221    #[link_name = "\u{1}_ZN10geometrize8ScanlineC1Eiii"]
222    pub fn geometrize_Scanline_Scanline(
223        this: *mut geometrize_Scanline,
224        y: ::std::os::raw::c_int,
225        x1: ::std::os::raw::c_int,
226        x2: ::std::os::raw::c_int,
227    );
228}
229impl geometrize_Scanline {
230    #[inline]
231    pub unsafe fn new(
232        y: ::std::os::raw::c_int,
233        x1: ::std::os::raw::c_int,
234        x2: ::std::os::raw::c_int,
235    ) -> Self {
236        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
237        geometrize_Scanline_Scanline(__bindgen_tmp.as_mut_ptr(), y, x1, x2);
238        __bindgen_tmp.assume_init()
239    }
240}
241extern "C" {
242    #[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."]
243    #[link_name = "\u{1}_ZN10geometrize13trimScanlinesERKSt6vectorINS_8ScanlineESaIS1_EEiiii"]
244    pub fn geometrize_trimScanlines(
245        scanlines: *const std_vector,
246        minX: ::std::os::raw::c_int,
247        minY: ::std::os::raw::c_int,
248        maxX: ::std::os::raw::c_int,
249        maxY: ::std::os::raw::c_int,
250    ) -> std_vector;
251}
252#[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/)"]
253#[repr(C)]
254#[derive(Debug)]
255pub struct geometrize_State {
256    #[doc = "< The score of the state, a measure of the improvement applying the state to the current bitmap will have."]
257    pub m_score: f64,
258    #[doc = "< The alpha of the shape."]
259    pub m_alpha: ::std::os::raw::c_uchar,
260    #[doc = "< The geometric primitive owned by the state."]
261    pub m_shape: std_shared_ptr,
262}
263extern "C" {
264    #[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."]
265    #[link_name = "\u{1}_ZN10geometrize5State6mutateEv"]
266    pub fn geometrize_State_mutate(this: *mut geometrize_State) -> geometrize_State;
267}
268extern "C" {
269    #[link_name = "\u{1}_ZN10geometrize5StateC1Ev"]
270    pub fn geometrize_State_State(this: *mut geometrize_State);
271}
272extern "C" {
273    #[doc = " @brief Creates a new state.\n @param shape The shape.\n @param alpha The color alpha of the geometric shape."]
274    #[link_name = "\u{1}_ZN10geometrize5StateC1ERKSt10shared_ptrINS_5ShapeEEh"]
275    pub fn geometrize_State_State1(
276        this: *mut geometrize_State,
277        shape: *const std_shared_ptr,
278        alpha: ::std::os::raw::c_uchar,
279    );
280}
281extern "C" {
282    #[link_name = "\u{1}_ZN10geometrize5StateC1ERKS0_"]
283    pub fn geometrize_State_State2(this: *mut geometrize_State, other: *const geometrize_State);
284}
285impl geometrize_State {
286    #[inline]
287    pub unsafe fn mutate(&mut self) -> geometrize_State {
288        geometrize_State_mutate(self)
289    }
290    #[inline]
291    pub unsafe fn new() -> Self {
292        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
293        geometrize_State_State(__bindgen_tmp.as_mut_ptr());
294        __bindgen_tmp.assume_init()
295    }
296    #[inline]
297    pub unsafe fn new1(shape: *const std_shared_ptr, alpha: ::std::os::raw::c_uchar) -> Self {
298        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
299        geometrize_State_State1(__bindgen_tmp.as_mut_ptr(), shape, alpha);
300        __bindgen_tmp.assume_init()
301    }
302    #[inline]
303    pub unsafe fn new2(other: *const geometrize_State) -> Self {
304        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
305        geometrize_State_State2(__bindgen_tmp.as_mut_ptr(), other);
306        __bindgen_tmp.assume_init()
307    }
308}
309#[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."]
310pub type geometrize_core_EnergyFunction = [u64; 4usize];
311extern "C" {
312    #[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."]
313    #[link_name = "\u{1}_ZN10geometrize4core21defaultEnergyFunctionERKSt6vectorINS_8ScanlineESaIS2_EEjRKNS_6BitmapES9_RS7_d"]
314    pub fn geometrize_core_defaultEnergyFunction(
315        lines: *const std_vector,
316        alpha: ::std::os::raw::c_uint,
317        target: *const geometrize_Bitmap,
318        current: *const geometrize_Bitmap,
319        buffer: *mut geometrize_Bitmap,
320        score: f64,
321    ) -> f64;
322}
323extern "C" {
324    #[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."]
325    #[link_name = "\u{1}_ZN10geometrize4core12computeColorERKNS_6BitmapES3_RKSt6vectorINS_8ScanlineESaIS5_EEh"]
326    pub fn geometrize_core_computeColor(
327        target: *const geometrize_Bitmap,
328        current: *const geometrize_Bitmap,
329        lines: *const std_vector,
330        alpha: ::std::os::raw::c_uchar,
331    ) -> geometrize_rgba;
332}
333extern "C" {
334    #[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."]
335    #[link_name = "\u{1}_ZN10geometrize4core14differenceFullERKNS_6BitmapES3_"]
336    pub fn geometrize_core_differenceFull(
337        first: *const geometrize_Bitmap,
338        second: *const geometrize_Bitmap,
339    ) -> f64;
340}
341extern "C" {
342    #[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."]
343    #[link_name = "\u{1}_ZN10geometrize4core17differencePartialERKNS_6BitmapES3_S3_dRKSt6vectorINS_8ScanlineESaIS5_EE"]
344    pub fn geometrize_core_differencePartial(
345        target: *const geometrize_Bitmap,
346        before: *const geometrize_Bitmap,
347        after: *const geometrize_Bitmap,
348        score: f64,
349        lines: *const std_vector,
350    ) -> f64;
351}
352extern "C" {
353    #[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."]
354    #[link_name = "\u{1}_ZN10geometrize4core18bestHillClimbStateERKSt8functionIFSt10shared_ptrINS_5ShapeEEvEEjjjRKNS_6BitmapESB_RS9_dRKS1_IFdRKSt6vectorINS_8ScanlineESaISE_EEjSB_SB_SC_dEE"]
355    pub fn geometrize_core_bestHillClimbState(
356        shapeCreator: *const [u64; 4usize],
357        alpha: ::std::os::raw::c_uint,
358        n: ::std::os::raw::c_uint,
359        age: ::std::os::raw::c_uint,
360        target: *const geometrize_Bitmap,
361        current: *const geometrize_Bitmap,
362        buffer: *mut geometrize_Bitmap,
363        lastScore: f64,
364        customEnergyFunction: *const geometrize_core_EnergyFunction,
365    ) -> geometrize_State;
366}
367#[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"]
368pub type geometrize_ShapeAcceptancePreconditionFunction = [u64; 4usize];
369#[doc = " @brief The Model class is the model for the core optimization/fitting algorithm.\n @author Sam Twidale (https://samcodes.co.uk/)"]
370#[repr(C)]
371#[derive(Debug)]
372pub struct geometrize_Model {
373    pub d: std_unique_ptr,
374}
375extern "C" {
376    #[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."]
377    #[link_name = "\u{1}_ZN10geometrize5Model5resetENS_4rgbaE"]
378    pub fn geometrize_Model_reset(this: *mut geometrize_Model, backgroundColor: geometrize_rgba);
379}
380extern "C" {
381    #[doc = " @brief getWidth Gets the width of the target bitmap.\n @return The width of the target bitmap."]
382    #[link_name = "\u{1}_ZNK10geometrize5Model8getWidthEv"]
383    pub fn geometrize_Model_getWidth(this: *const geometrize_Model) -> ::std::os::raw::c_int;
384}
385extern "C" {
386    #[doc = " @brief getHeight Gets the height of the target bitmap.\n @return The height of the target bitmap."]
387    #[link_name = "\u{1}_ZNK10geometrize5Model9getHeightEv"]
388    pub fn geometrize_Model_getHeight(this: *const geometrize_Model) -> ::std::os::raw::c_int;
389}
390extern "C" {
391    #[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."]
392    #[link_name = "\u{1}_ZN10geometrize5Model4stepERKSt8functionIFSt10shared_ptrINS_5ShapeEEvEEhjjjRKS1_IFdRKSt6vectorINS_8ScanlineESaISA_EEjRKNS_6BitmapESH_RSF_dEERKS1_IFbddRKS3_SE_RKNS_4rgbaESH_SH_SH_EE"]
393    pub fn geometrize_Model_step(
394        this: *mut geometrize_Model,
395        shapeCreator: *const [u64; 4usize],
396        alpha: ::std::os::raw::c_uchar,
397        shapeCount: ::std::os::raw::c_uint,
398        maxShapeMutations: ::std::os::raw::c_uint,
399        maxThreads: ::std::os::raw::c_uint,
400        energyFunction: *const geometrize_core_EnergyFunction,
401        addShapePrecondition: *const geometrize_ShapeAcceptancePreconditionFunction,
402    ) -> std_vector;
403}
404extern "C" {
405    #[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."]
406    #[link_name = "\u{1}_ZN10geometrize5Model9drawShapeESt10shared_ptrINS_5ShapeEENS_4rgbaE"]
407    pub fn geometrize_Model_drawShape(
408        this: *mut geometrize_Model,
409        shape: std_shared_ptr,
410        color: geometrize_rgba,
411    ) -> geometrize_ShapeResult;
412}
413extern "C" {
414    #[doc = " @brief getCurrent Gets the current bitmap.\n @return The current bitmap."]
415    #[link_name = "\u{1}_ZN10geometrize5Model10getCurrentEv"]
416    pub fn geometrize_Model_getCurrent(this: *mut geometrize_Model) -> *mut geometrize_Bitmap;
417}
418extern "C" {
419    #[doc = " @brief getTarget Gets the target bitmap.\n @return The target bitmap."]
420    #[link_name = "\u{1}_ZN10geometrize5Model9getTargetEv"]
421    pub fn geometrize_Model_getTarget(this: *mut geometrize_Model) -> *mut geometrize_Bitmap;
422}
423extern "C" {
424    #[doc = " @brief getCurrent Gets the current bitmap, const-edition.\n @return The current bitmap."]
425    #[link_name = "\u{1}_ZNK10geometrize5Model10getCurrentEv"]
426    pub fn geometrize_Model_getCurrent1(this: *const geometrize_Model) -> *const geometrize_Bitmap;
427}
428extern "C" {
429    #[doc = " @brief getTarget Gets the target bitmap, const-edition.\n @return The target bitmap."]
430    #[link_name = "\u{1}_ZNK10geometrize5Model9getTargetEv"]
431    pub fn geometrize_Model_getTarget1(this: *const geometrize_Model) -> *const geometrize_Bitmap;
432}
433extern "C" {
434    #[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."]
435    #[link_name = "\u{1}_ZN10geometrize5Model7setSeedEj"]
436    pub fn geometrize_Model_setSeed(this: *mut geometrize_Model, seed: ::std::os::raw::c_uint);
437}
438extern "C" {
439    #[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."]
440    #[link_name = "\u{1}_ZN10geometrize5ModelC1ERKNS_6BitmapE"]
441    pub fn geometrize_Model_Model(this: *mut geometrize_Model, target: *const geometrize_Bitmap);
442}
443extern "C" {
444    #[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."]
445    #[link_name = "\u{1}_ZN10geometrize5ModelC1ERKNS_6BitmapES3_"]
446    pub fn geometrize_Model_Model1(
447        this: *mut geometrize_Model,
448        target: *const geometrize_Bitmap,
449        initial: *const geometrize_Bitmap,
450    );
451}
452extern "C" {
453    #[link_name = "\u{1}_ZN10geometrize5ModelD1Ev"]
454    pub fn geometrize_Model_Model_destructor(this: *mut geometrize_Model);
455}
456impl geometrize_Model {
457    #[inline]
458    pub unsafe fn reset(&mut self, backgroundColor: geometrize_rgba) {
459        geometrize_Model_reset(self, backgroundColor)
460    }
461    #[inline]
462    pub unsafe fn getWidth(&self) -> ::std::os::raw::c_int {
463        geometrize_Model_getWidth(self)
464    }
465    #[inline]
466    pub unsafe fn getHeight(&self) -> ::std::os::raw::c_int {
467        geometrize_Model_getHeight(self)
468    }
469    #[inline]
470    pub unsafe fn step(
471        &mut self,
472        shapeCreator: *const [u64; 4usize],
473        alpha: ::std::os::raw::c_uchar,
474        shapeCount: ::std::os::raw::c_uint,
475        maxShapeMutations: ::std::os::raw::c_uint,
476        maxThreads: ::std::os::raw::c_uint,
477        energyFunction: *const geometrize_core_EnergyFunction,
478        addShapePrecondition: *const geometrize_ShapeAcceptancePreconditionFunction,
479    ) -> std_vector {
480        geometrize_Model_step(
481            self,
482            shapeCreator,
483            alpha,
484            shapeCount,
485            maxShapeMutations,
486            maxThreads,
487            energyFunction,
488            addShapePrecondition,
489        )
490    }
491    #[inline]
492    pub unsafe fn drawShape(
493        &mut self,
494        shape: std_shared_ptr,
495        color: geometrize_rgba,
496    ) -> geometrize_ShapeResult {
497        geometrize_Model_drawShape(self, shape, color)
498    }
499    #[inline]
500    pub unsafe fn getCurrent(&mut self) -> *mut geometrize_Bitmap {
501        geometrize_Model_getCurrent(self)
502    }
503    #[inline]
504    pub unsafe fn getTarget(&mut self) -> *mut geometrize_Bitmap {
505        geometrize_Model_getTarget(self)
506    }
507    #[inline]
508    pub unsafe fn getCurrent1(&self) -> *const geometrize_Bitmap {
509        geometrize_Model_getCurrent1(self)
510    }
511    #[inline]
512    pub unsafe fn getTarget1(&self) -> *const geometrize_Bitmap {
513        geometrize_Model_getTarget1(self)
514    }
515    #[inline]
516    pub unsafe fn setSeed(&mut self, seed: ::std::os::raw::c_uint) {
517        geometrize_Model_setSeed(self, seed)
518    }
519    #[inline]
520    pub unsafe fn new(target: *const geometrize_Bitmap) -> Self {
521        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
522        geometrize_Model_Model(__bindgen_tmp.as_mut_ptr(), target);
523        __bindgen_tmp.assume_init()
524    }
525    #[inline]
526    pub unsafe fn new1(
527        target: *const geometrize_Bitmap,
528        initial: *const geometrize_Bitmap,
529    ) -> Self {
530        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
531        geometrize_Model_Model1(__bindgen_tmp.as_mut_ptr(), target, initial);
532        __bindgen_tmp.assume_init()
533    }
534    #[inline]
535    pub unsafe fn destruct(&mut self) {
536        geometrize_Model_Model_destructor(self)
537    }
538}
539#[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/)"]
540#[repr(C)]
541#[derive(Debug)]
542pub struct geometrize_ImageRunner {
543    pub d: std_unique_ptr,
544}
545extern "C" {
546    #[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."]
547    #[link_name = "\u{1}_ZN10geometrize11ImageRunner4stepERKNS_18ImageRunnerOptionsESt8functionIFSt10shared_ptrINS_5ShapeEEvEES4_IFdRKSt6vectorINS_8ScanlineESaISB_EEjRKNS_6BitmapESI_RSG_dEES4_IFbddRKS6_SF_RKNS_4rgbaESI_SI_SI_EE"]
548    pub fn geometrize_ImageRunner_step(
549        this: *mut geometrize_ImageRunner,
550        options: *const geometrize_ImageRunnerOptions,
551        shapeCreator: [u64; 4usize],
552        energyFunction: geometrize_core_EnergyFunction,
553        addShapePrecondition: geometrize_ShapeAcceptancePreconditionFunction,
554    ) -> std_vector;
555}
556extern "C" {
557    #[doc = " @brief getCurrent Gets the current bitmap with the primitives drawn on it.\n @return The current bitmap."]
558    #[link_name = "\u{1}_ZN10geometrize11ImageRunner10getCurrentEv"]
559    pub fn geometrize_ImageRunner_getCurrent(
560        this: *mut geometrize_ImageRunner,
561    ) -> *mut geometrize_Bitmap;
562}
563extern "C" {
564    #[doc = " @brief getTarget Gets the target bitmap.\n @return The target bitmap."]
565    #[link_name = "\u{1}_ZN10geometrize11ImageRunner9getTargetEv"]
566    pub fn geometrize_ImageRunner_getTarget(
567        this: *mut geometrize_ImageRunner,
568    ) -> *mut geometrize_Bitmap;
569}
570extern "C" {
571    #[doc = " @brief getCurrent Gets the current bitmap with the primitives drawn on it, const-edition.\n @return The current bitmap."]
572    #[link_name = "\u{1}_ZNK10geometrize11ImageRunner10getCurrentEv"]
573    pub fn geometrize_ImageRunner_getCurrent1(
574        this: *const geometrize_ImageRunner,
575    ) -> *const geometrize_Bitmap;
576}
577extern "C" {
578    #[doc = " @brief getTarget Gets the target bitmap, const-edition.\n @return The target bitmap."]
579    #[link_name = "\u{1}_ZNK10geometrize11ImageRunner9getTargetEv"]
580    pub fn geometrize_ImageRunner_getTarget1(
581        this: *const geometrize_ImageRunner,
582    ) -> *const geometrize_Bitmap;
583}
584extern "C" {
585    #[doc = " @brief getModel Gets the underlying model.\n @return The model."]
586    #[link_name = "\u{1}_ZN10geometrize11ImageRunner8getModelEv"]
587    pub fn geometrize_ImageRunner_getModel(
588        this: *mut geometrize_ImageRunner,
589    ) -> *mut geometrize_Model;
590}
591extern "C" {
592    #[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."]
593    #[link_name = "\u{1}_ZN10geometrize11ImageRunnerC1ERKNS_6BitmapE"]
594    pub fn geometrize_ImageRunner_ImageRunner(
595        this: *mut geometrize_ImageRunner,
596        targetBitmap: *const geometrize_Bitmap,
597    );
598}
599extern "C" {
600    #[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."]
601    #[link_name = "\u{1}_ZN10geometrize11ImageRunnerC1ERKNS_6BitmapES3_"]
602    pub fn geometrize_ImageRunner_ImageRunner1(
603        this: *mut geometrize_ImageRunner,
604        targetBitmap: *const geometrize_Bitmap,
605        initialBitmap: *const geometrize_Bitmap,
606    );
607}
608extern "C" {
609    #[link_name = "\u{1}_ZN10geometrize11ImageRunnerD1Ev"]
610    pub fn geometrize_ImageRunner_ImageRunner_destructor(this: *mut geometrize_ImageRunner);
611}
612impl geometrize_ImageRunner {
613    #[inline]
614    pub unsafe fn step(
615        &mut self,
616        options: *const geometrize_ImageRunnerOptions,
617        shapeCreator: [u64; 4usize],
618        energyFunction: geometrize_core_EnergyFunction,
619        addShapePrecondition: geometrize_ShapeAcceptancePreconditionFunction,
620    ) -> std_vector {
621        geometrize_ImageRunner_step(
622            self,
623            options,
624            shapeCreator,
625            energyFunction,
626            addShapePrecondition,
627        )
628    }
629    #[inline]
630    pub unsafe fn getCurrent(&mut self) -> *mut geometrize_Bitmap {
631        geometrize_ImageRunner_getCurrent(self)
632    }
633    #[inline]
634    pub unsafe fn getTarget(&mut self) -> *mut geometrize_Bitmap {
635        geometrize_ImageRunner_getTarget(self)
636    }
637    #[inline]
638    pub unsafe fn getCurrent1(&self) -> *const geometrize_Bitmap {
639        geometrize_ImageRunner_getCurrent1(self)
640    }
641    #[inline]
642    pub unsafe fn getTarget1(&self) -> *const geometrize_Bitmap {
643        geometrize_ImageRunner_getTarget1(self)
644    }
645    #[inline]
646    pub unsafe fn getModel(&mut self) -> *mut geometrize_Model {
647        geometrize_ImageRunner_getModel(self)
648    }
649    #[inline]
650    pub unsafe fn new(targetBitmap: *const geometrize_Bitmap) -> Self {
651        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
652        geometrize_ImageRunner_ImageRunner(__bindgen_tmp.as_mut_ptr(), targetBitmap);
653        __bindgen_tmp.assume_init()
654    }
655    #[inline]
656    pub unsafe fn new1(
657        targetBitmap: *const geometrize_Bitmap,
658        initialBitmap: *const geometrize_Bitmap,
659    ) -> Self {
660        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
661        geometrize_ImageRunner_ImageRunner1(
662            __bindgen_tmp.as_mut_ptr(),
663            targetBitmap,
664            initialBitmap,
665        );
666        __bindgen_tmp.assume_init()
667    }
668    #[inline]
669    pub unsafe fn destruct(&mut self) {
670        geometrize_ImageRunner_ImageRunner_destructor(self)
671    }
672}
673pub const RECTANGLE: geometrize_ShapeTypes = 1;
674pub const ROTATED_RECTANGLE: geometrize_ShapeTypes = 2;
675pub const TRIANGLE: geometrize_ShapeTypes = 4;
676pub const ELLIPSE: geometrize_ShapeTypes = 8;
677pub const ROTATED_ELLIPSE: geometrize_ShapeTypes = 16;
678pub const CIRCLE: geometrize_ShapeTypes = 32;
679pub const LINE: geometrize_ShapeTypes = 64;
680pub const QUADRATIC_BEZIER: geometrize_ShapeTypes = 128;
681pub const POLYLINE: geometrize_ShapeTypes = 256;
682pub const SHAPE_COUNT: geometrize_ShapeTypes = 9;
683#[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/)"]
684pub type geometrize_ShapeTypes = ::std::os::raw::c_uint;
685extern "C" {
686    #[doc = " @brief allShapes is a convenient array of all of the members of ShapeTypes."]
687    #[link_name = "\u{1}_ZN10geometrize9allShapesE"]
688    pub static geometrize_allShapes: u8;
689}
690extern "C" {
691    #[doc = " @brief shapeTypeNames provides a convenient mapping to names of types of shape (all lower case, underscores instead of spaces e.g. rotated_ellipse)."]
692    #[link_name = "\u{1}_ZN10geometrize14shapeTypeNamesB5cxx11E"]
693    pub static geometrize_shapeTypeNames: std_vector;
694}
695#[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/)"]
696#[repr(C)]
697#[derive(Debug, Copy, Clone)]
698pub struct geometrize_ImageRunnerShapeBoundsOptions {
699    pub enabled: bool,
700    pub xMinPercent: f64,
701    pub yMinPercent: f64,
702    pub xMaxPercent: f64,
703    pub yMaxPercent: f64,
704}
705#[doc = " @brief The ImageRunnerOptions class encapsulates preferences/options that the image runner uses.\n @author Sam Twidale (https://samcodes.co.uk/)"]
706#[repr(C)]
707#[derive(Debug, Copy, Clone)]
708pub struct geometrize_ImageRunnerOptions {
709    #[doc = "< The shape types that the image runner shall use."]
710    pub shapeTypes: geometrize_ShapeTypes,
711    #[doc = "< The alpha/opacity of the shapes (0-255)."]
712    pub alpha: ::std::os::raw::c_uchar,
713    #[doc = "< The number of candidate shapes that will be tried per model step."]
714    pub shapeCount: ::std::os::raw::c_uint,
715    #[doc = "< The maximum number of times each candidate shape will be modified to attempt to find a better fit."]
716    pub maxShapeMutations: ::std::os::raw::c_uint,
717    #[doc = "< The seed for the random number generators used by the image runner."]
718    pub seed: ::std::os::raw::c_uint,
719    #[doc = "< The maximum number of separate threads for the implementation to use. 0 lets the implementation choose a reasonable number."]
720    pub maxThreads: ::std::os::raw::c_uint,
721    #[doc = "< If zero or do not form a rectangle, the entire target image is used i.e. (0, 0, imageWidth, imageHeight)"]
722    pub shapeBounds: geometrize_ImageRunnerShapeBoundsOptions,
723}
724#[repr(C)]
725pub struct geometrize_Shape__bindgen_vtable(::std::os::raw::c_void);
726#[doc = " Base class for shape rasterization and manipulation.\n @author Sam Twidale (https://samcodes.co.uk/)"]
727#[repr(C)]
728#[derive(Debug)]
729pub struct geometrize_Shape {
730    pub vtable_: *const geometrize_Shape__bindgen_vtable,
731    pub setup: [u64; 4usize],
732    pub mutate: [u64; 4usize],
733    pub rasterize: [u64; 4usize],
734}
735#[doc = " @brief The Rectangle class represents a rectangle.\n @author Sam Twidale (https://samcodes.co.uk/)"]
736#[repr(C)]
737#[derive(Debug)]
738pub struct geometrize_Rectangle {
739    pub _base: geometrize_Shape,
740    #[doc = "< Left coordinate."]
741    pub m_x1: f32,
742    #[doc = "< Top coordinate."]
743    pub m_y1: f32,
744    #[doc = "< Right coordinate."]
745    pub m_x2: f32,
746    #[doc = "< Bottom coordinate."]
747    pub m_y2: f32,
748}
749extern "C" {
750    #[link_name = "\u{1}_ZN10geometrize9RectangleC1Effff"]
751    pub fn geometrize_Rectangle_Rectangle(
752        this: *mut geometrize_Rectangle,
753        x1: f32,
754        y1: f32,
755        x2: f32,
756        y2: f32,
757    );
758}
759impl geometrize_Rectangle {
760    #[inline]
761    pub unsafe fn new(x1: f32, y1: f32, x2: f32, y2: f32) -> Self {
762        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
763        geometrize_Rectangle_Rectangle(__bindgen_tmp.as_mut_ptr(), x1, y1, x2, y2);
764        __bindgen_tmp.assume_init()
765    }
766}
767extern "C" {
768    #[link_name = "\u{1}_ZNK10geometrize9Rectangle5cloneEv"]
769    pub fn geometrize_Rectangle_clone(this: *mut ::std::os::raw::c_void) -> std_shared_ptr;
770}
771extern "C" {
772    #[link_name = "\u{1}_ZNK10geometrize9Rectangle7getTypeEv"]
773    pub fn geometrize_Rectangle_getType(this: *mut ::std::os::raw::c_void)
774        -> geometrize_ShapeTypes;
775}
776extern "C" {
777    #[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."]
778    #[link_name = "\u{1}_ZN10geometrize25createDefaultShapeCreatorENS_10ShapeTypesEiiii"]
779    pub fn geometrize_createDefaultShapeCreator(
780        types: geometrize_ShapeTypes,
781        xMin: ::std::os::raw::c_int,
782        yMin: ::std::os::raw::c_int,
783        xMax: ::std::os::raw::c_int,
784        yMax: ::std::os::raw::c_int,
785    ) -> [u64; 4usize];
786}
787extern "C" {
788    #[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."]
789    #[link_name = "\u{1}_ZN10geometrize6createENS_10ShapeTypesE"]
790    pub fn geometrize_create(t: geometrize_ShapeTypes) -> std_shared_ptr;
791}
792extern "C" {
793    #[doc = " @brief randomShape Creates a random shape.\n @return The new shape."]
794    #[link_name = "\u{1}_ZN10geometrize11randomShapeEv"]
795    pub fn geometrize_randomShape() -> std_shared_ptr;
796}
797extern "C" {
798    #[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."]
799    #[link_name = "\u{1}_ZN10geometrize13randomShapeOfENS_10ShapeTypesE"]
800    pub fn geometrize_randomShapeOf(t: geometrize_ShapeTypes) -> std_shared_ptr;
801}