| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2010 Johannes Loehnert <[email protected]> |
| 3 | |
| 4 | SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef PALAPELISLICERS_GOLDBERG_ENGINE_H |
| 8 | #define PALAPELISLICERS_GOLDBERG_ENGINE_Hcxx . . $ `slicers/goldberg/goldberg-engine.h:8:9`! |
| 9 | |
| 10 | #include <Pala/SlicerJob>cxx . . $ `<file>/build/libpala/Pala/SlicerJob`/ |
| 11 | #include <QPainterPath> |
| 12 | |
| 13 | struct GBClassicPlugParamscxx . . $ GBClassicPlugParams# { |
| 14 | bool flippedcxx . . $ GBClassicPlugParams#flipped.; |
| 15 | bool is_pluglesscxx . . $ GBClassicPlugParams#is_plugless.; |
| 16 | bool is_straightcxx . . $ GBClassicPlugParams#is_straight.; |
| 17 | QLineFcxx . . $ QLineF# unit_xcxx . . $ GBClassicPlugParams#unit_x.; |
| 18 | qrealcxx . . $ qreal# size_correctioncxx . . $ GBClassicPlugParams#size_correction.; |
| 19 | |
| 20 | // the rendered segment, so it only has to be rendered once. |
| 21 | QPainterPathcxx . . $ QPainterPath# pathcxx . . $ GBClassicPlugParams#path.; |
| 22 | bool path_is_renderedcxx . . $ GBClassicPlugParams#path_is_rendered.; |
| 23 | |
| 24 | // start, end-angle: angle of ctl point at first and last node |
| 25 | qrealcxx . . $ qreal# startanglecxx . . $ GBClassicPlugParams#startangle., endanglecxx . . $ GBClassicPlugParams#endangle.; |
| 26 | // base roundness: how "curvy" the baseline is. 0..1. |
| 27 | qrealcxx . . $ qreal# baseroundnesscxx . . $ GBClassicPlugParams#baseroundness.; |
| 28 | // basepos, basewidth: x-center and distance of base points |
| 29 | qrealcxx . . $ qreal# baseposcxx . . $ GBClassicPlugParams#basepos., basewidthcxx . . $ GBClassicPlugParams#basewidth.; |
| 30 | // knobsize: distance of knob ctl points from base points |
| 31 | // knobangle, knobtilt: hard to describe.. they determine width |
| 32 | // and asymmetry of the knob. |
| 33 | qrealcxx . . $ qreal# knobsizecxx . . $ GBClassicPlugParams#knobsize., knobanglecxx . . $ GBClassicPlugParams#knobangle., knobtiltcxx . . $ GBClassicPlugParams#knobtilt.; |
| 34 | |
| 35 | }; |
| 36 | |
| 37 | |
| 38 | class GoldbergEnginecxx . . $ GoldbergEngine# { |
| 39 | public: |
| 40 | int m_quickpresetcxx . . $ GoldbergEngine#m_quickpreset.; |
| 41 | int m_flip_thresholdcxx . . $ GoldbergEngine#m_flip_threshold.; |
| 42 | bool m_alternate_flipcxx . . $ GoldbergEngine#m_alternate_flip.; |
| 43 | int m_edge_curvinesscxx . . $ GoldbergEngine#m_edge_curviness.; |
| 44 | qrealcxx . . $ qreal# m_plug_sizecxx . . $ GoldbergEngine#m_plug_size.; |
| 45 | qrealcxx . . $ qreal# m_sigma_curvinesscxx . . $ GoldbergEngine#m_sigma_curviness.; |
| 46 | qrealcxx . . $ qreal# m_sigma_baseposcxx . . $ GoldbergEngine#m_sigma_basepos.; |
| 47 | qrealcxx . . $ qreal# m_sigma_plugscxx . . $ GoldbergEngine#m_sigma_plugs.; |
| 48 | int m_irregular_relaxation_stepscxx . . $ GoldbergEngine#m_irregular_relaxation_steps.; |
| 49 | bool m_outlinescxx . . $ GoldbergEngine#m_outlines.; |
| 50 | // length of a "normal" border. |
| 51 | // determines the actual size of the knob. |
| 52 | qrealcxx . . $ qreal# m_length_basecxx . . $ GoldbergEngine#m_length_base.; |
| 53 | |
| 54 | explicit GoldbergEnginecxx . . $ GoldbergEngine#GoldbergEngine(21c4451fd171e192).(Palacxx . . $ Pala/::SlicerJobcxx . . $ Pala/SlicerJob# *job); |
| 55 | |
| 56 | void set_dump_gridcxx . . $ GoldbergEngine#set_dump_grid(b45ddcbc8423892c).(bool dump); |
| 57 | bool get_dump_gridcxx . . $ GoldbergEngine#get_dump_grid(c9857a73d68e59ba).(); |
| 58 | |
| 59 | int get_image_widthcxx . . $ GoldbergEngine#get_image_width(b126dc7c1de90089).(); |
| 60 | int get_image_heightcxx . . $ GoldbergEngine#get_image_height(b126dc7c1de90089).(); |
| 61 | |
| 62 | GBClassicPlugParamscxx . . $ GBClassicPlugParams# initEdgecxx . . $ GoldbergEngine#initEdge(86be2d02e07eb1ff).(bool is_straight); |
| 63 | void reRandomizeEdgecxx . . $ GoldbergEngine#reRandomizeEdge(2e5ce4801adab2f6).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# ¶ms, bool keep_endangles=false); |
| 64 | // changes ctl point angles at the common end point to be equal. |
| 65 | // the common endpoint of border1 and border2 is autodetected. |
| 66 | void smooth_joincxx . . $ GoldbergEngine#smooth_join(61889fbc35c0b263).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# &border1, GBClassicPlugParamscxx . . $ GBClassicPlugParams# &border2); |
| 67 | |
| 68 | void makePieceFromPathcxx . . $ GoldbergEngine#makePieceFromPath(3af9aede909ef5e1).(int piece_id, QPainterPathcxx . . $ QPainterPath# path); |
| 69 | void addRelationcxx . . $ GoldbergEngine#addRelation(3e454b8ccf442868).(int piece1, int piece2); |
| 70 | // checks if candidate intersects with an already set border. |
| 71 | // If *offenders is given and the plugs intersect, a reference to the "other" border is added to the list. |
| 72 | // If any plug is not rendered yet, this is done beforehands. |
| 73 | bool plugsIntersectcxx . . $ GoldbergEngine#plugsIntersect(b257d71b9754dd1b).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# &candidate, GBClassicPlugParamscxx . . $ GBClassicPlugParams# &other, QListcxx . . $ QList#<GBClassicPlugParamscxx . . $ GBClassicPlugParams#*>* offenders = nullptr); |
| 74 | // checks if candidate is out of bounds (image frame). |
| 75 | // If candidate is not rendered yet, this is done beforehands. |
| 76 | bool plugOutOfBoundscxx . . $ GoldbergEngine#plugOutOfBounds(99cc605556fb842a).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# &candidate); |
| 77 | void makePluglesscxx . . $ GoldbergEngine#makePlugless(d605898320c8d45c).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# ¶meters); |
| 78 | |
| 79 | void addPlugToPathcxx . . $ GoldbergEngine#addPlugToPath(a4196ae260c7585).(QPainterPathcxx . . $ QPainterPath#& path, bool reverse, GBClassicPlugParamscxx . . $ GBClassicPlugParams# ¶meters); |
| 80 | void renderClassicPlugcxx . . $ GoldbergEngine#renderClassicPlug(d605898320c8d45c).(GBClassicPlugParamscxx . . $ GBClassicPlugParams# ¶meters); |
| 81 | |
| 82 | void dump_grid_imagecxx . . $ GoldbergEngine#dump_grid_image(49f6e7a06ebc5aa8).(); |
| 83 | |
| 84 | protected: |
| 85 | Palacxx . . $ Pala/::SlicerJobcxx . . $ Pala/SlicerJob# *m_jobcxx . . $ GoldbergEngine#m_job.; |
| 86 | QImagecxx . . $ QImage# m_imagecxx . . $ GoldbergEngine#m_image.; |
| 87 | bool m_dump_gridcxx . . $ GoldbergEngine#m_dump_grid.; |
| 88 | QImagecxx . . $ QImage# *m_grid_imagecxx . . $ GoldbergEngine#m_grid_image.; |
| 89 | }; |
| 90 | |
| 91 | #endif // PALAPELISLICERS_GOLDBERG_ENGINE_H |