1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /** @file 3 * TODO: insert short description here 4 *//* 5 * Authors: 6 * see git history 7 * Fred 8 * 9 * Copyright (C) 2018 Authors 10 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 11 */ 12 13 #ifndef my_defs 14 #define my_defs 15 16 #include <cstdint> 17 18 // error codes (mostly obsolete) 19 enum 20 { 21 avl_no_err = 0, // 0 is the error code for "everything OK" 22 avl_bal_err = 1, 23 avl_rm_err = 2, 24 avl_ins_err = 3, 25 shape_euler_err = 4, // computations result in a non-eulerian graph, thus the function cannot do a proper polygon 26 // despite the rounding sheme, this still happen with uber-complex graphs 27 // note that coordinates are stored in double => double precision for the computation is not even 28 // enough to get exact results (need quadruple precision, i think). 29 shape_input_err = 5, // the function was given an incorrect input (not a polygon, or not eulerian) 30 shape_nothing_to_do = 6 // the function had nothing to do (zero offset, etc) 31 }; 32 33 // return codes for the find function in the AVL tree (private) 34 enum 35 { 36 not_found = 0, 37 found_exact = 1, 38 found_on_left = 2, 39 found_on_right = 3, 40 found_between = 4 41 }; 42 43 // types of cap for stroking polylines 44 enum butt_typ 45 { 46 butt_straight, // straight line 47 butt_square, // half square 48 butt_round, // half circle 49 butt_pointy // a little pointy hat 50 }; 51 // types of joins for stroking paths 52 enum join_typ 53 { 54 join_straight, // a straight line 55 join_round, // arc of circle (in fact, one or two quadratic bezier curve chunks) 56 join_pointy // a miter join (uses the miter parameter) 57 }; 58 typedef enum butt_typ ButtType; 59 typedef enum join_typ JoinType; 60 61 enum fill_typ 62 { 63 fill_oddEven = 0, 64 fill_nonZero = 1, 65 fill_positive = 2, 66 fill_justDont = 3 67 }; 68 typedef enum fill_typ FillRule; 69 70 // info for a run of pixel to fill 71 struct raster_info { 72 int startPix,endPix; // start and end pixel from the polygon POV 73 int sth,stv; // coordinates for the first pixel in the run, in (possibly another) POV 74 uint32_t* buffer; // pointer to the first pixel in the run 75 }; 76 typedef void (*RasterInRunFunc) (raster_info &dest,void *data,int nst,float vst,int nen,float ven); // init for position ph,pv; the last parameter is a pointer 77 78 79 enum Side { 80 LEFT = 0, 81 RIGHT = 1 82 }; 83 84 enum FirstOrLast { 85 FIRST = 0, 86 LAST = 1 87 }; 88 89 #endif 90