openEmbroider  0.1
an open source embroidery software
OE_pointcurve.h
1 /*
2  * Copyright (c) 2015 Tricoire Sebastien 3dsman@free.fr
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  *
20  */
21 
22 #ifndef OE_POINTCURVE_H
23 #define OE_POINTCURVE_H
24 
25 #include "OE_utils.h"
26 #include "OE_curve.h"
27 #include <stdint.h>
28 #include <vector>
29 
30 class OE_pointcurve : public OE_curve
31 {
32  public:
33 
35  OE_pointcurve();
36  OE_pointcurve(std::vector<vector_2d> points, bool closed);
38  virtual ~OE_pointcurve();
39 
41  bool getPoint(uint16_t nb, float* x, float* y);
42  bool getPoint(uint16_t nb, vector_2d* pt);
43 
45  bool setPoint(uint16_t nb, float x, float y);
46 
48  bool addPoint( float x, float y);
49  bool addPoint( vector_2d pt);
50 
52  void lineTo(float x, float y);
53  void lineTo(vector_2d pt);
54 
55  void cubicBezTo(float cpx1, float cpy1, float cpx2, float cpy2, float x, float y);
56 
58  virtual void refresh(){};
59 
60  protected:
61  private:
62 
64  static unsigned char controlLineColor[4] ;
65 
67  static unsigned char controlPointColor[4] ;
68 
70  static unsigned char controlEndPointColor[4] ;
71 };
72 
73 #endif // OE_POINTCURVE_H
OE_pointcurve()
Definition: OE_pointcurve.cpp:37
Definition: OE_pointcurve.h:30
virtual void refresh()
refresh the pts array.
Definition: OE_pointcurve.h:58
void lineTo(float x, float y)
to add a linear segment at the end of the curve.
Definition: OE_pointcurve.cpp:96
virtual ~OE_pointcurve()
Definition: OE_pointcurve.cpp:45
Definition: OE_curve.h:30
bool closed
Flag indicating if shapes should be treated as closed.
Definition: OE_curve.h:103
bool getPoint(uint16_t nb, float *x, float *y)
to get a point in the curve.
Definition: OE_pointcurve.cpp:49
bool addPoint(float x, float y)
to add a point at the end of the curve.
Definition: OE_pointcurve.cpp:82
bool setPoint(uint16_t nb, float x, float y)
to set a point in the curve.
Definition: OE_pointcurve.cpp:71
Definition: OE_utils.h:28