libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moP5.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moP5.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_P5_H__
33 #define __MO_P5_H__
34 
35 #include "moAbstract.h"
36 
42 {
43 public:
44  moP5();
45 
57  void triangle(float x1, float y1, float x2, float y2, float x3, float y3);
58 
72  void line(float x1, float y1, float x2, float y2);
73 
84  void line(float x1, float y1, float z1, float x2, float y2, float z2);
85 
97  void arc(float x, float y, float width, float height, float start, float stop, int slices = 24, float band = 0.0 );
98 
105  void point(float x, float y);
106 
113  void point(float x, float y, float z);
114 
129  void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
130 
141  void ellipse(float x, float y, float width, float height, int slices=24 );
142 
153  void rect(float x, float y, float width, float height);
154 
160  void strokeWeight(float width);
161 
162 /*
163  //Draws all geometry with smooth (anti-aliased) edges. This will slow down the frame rate of the application, but will enhance the visual refinement.
164  void smooth();
165 
166  //Draws all geometry with jagged (aliased) edges.
167  void noSmooth();
168 
169  //Sets the style of the joints which connect line segments. These joints are either mitered, beveled, or rounded and specified with the corresponding parameters MITER, BEVEL, and ROUND. The default joint is MITER.
170  void strokeJoin(moP5StrokeJoinMode MODE);
171 
172  //The origin of the ellipse is modified by the ellipseMode() function. The default configuration is ellipseMode(CENTER), which specifies the location of the ellipse as the center of the shape. The RADIUS mode is the same, but the width and height parameters to ellipse() specify the radius of the ellipse, rather than the diameter. The CORNER mode draws the shape from the upper-left corner of its bounding box. The CORNERS mode uses the four parameters to ellipse() to set two opposing corners of the ellipse's bounding box.
173  void ellipseMode(moP5ShapeMode MODE);
174 
175  //Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters of rect() to specify the image's width and height. The syntax rectMode(RADIUS) draws the image from its center point and uses the third and forth parameters of rect() to specify half of the image's width and height.
176  void rectMode(moP5ShapeMode MODE);
177 
178  //Sets the style for rendering line endings. These ends are either squared, extended, or rounded and specified with the corresponding parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND.
179  void strokeCap(moP5StrokeCapMode MODE);
180 */
181 
190  void background(float gray);
191  void background(float gray, float alpha);
192  void background(float value1, float value2, float value3);
193  void background(float value1, float value2, float value3, float alpha);
194 
208  void colorMode(int mode);
209  void colorMode(int mode, float range);
210  void colorMode(int mode, float range1, float range2, float range3);
211  void colorMode(int mode, float range1, float range2, float range3, float range4);
212 
221  void stroke(float gray);
222  void stroke(float gray, float alpha);
223  void stroke(float value1, float value2, float value3);
224  void stroke(float value1, float value2, float value3, float alpha);
225 
230  void noFill();
231 
236  void noStroke();
237 
249  void fill(float gray);
250  void fill(float gray, float alpha);
251  void fill(float value1, float value2, float value3);
252  void fill(float value1, float value2, float value3, float alpha);
253 
261  void pushMatrix();
262 
270  void popMatrix();
271 
275  void resetMatrix();
276 
290  void scale(float size);
291  void scale(float x, float y, float z=1.0f);
292 
305  void translate(float x, float y, float z = 0.0f);
306 
319  void rotate(float angle, float x=0.0f, float y=0.0f, float z=1.0f );
320 
322  {
323  MO_P5_MITER = 0,
324  MO_P5_BEVEL = 1,
325  MO_P5_ROUND = 2
326  };
327 
329  {
330  MO_P5_CENTER = 0,
331  MO_P5_RADIUS = 1,
332  MO_P5_CORNER = 2,
333  MO_P5_CORNERS = 3
334  };
335 
337  {
338  MO_P5_SQUARE = 0,
339  MO_P5_PROJECT = 1,
340  };
341 
343  {
344  MO_P5_RGB = 0,
345  MO_P5_HSB = 1
346  };
347 
349  {
350  MO_P5_NOFILL = 0,
351  MO_P5_FILL = 1
352  };
353 
354  static const float MO_P5_HALF_PI;
355  static const float MO_P5_TWO_PI;
356  static const float MO_P5_PI;
357 protected:
358 
359 
360 
362  float colorRGBCoeff[4];
363  float colorHSBCoeff[4];
364 
366  float tmpColor[4];
367  float strokeColor[4];
368  float fillColor[4];
369 
370  void generateTmpColor(float comp1, float comp2, float comp3);
371  void generateTmpColor(float comp1, float comp2, float comp3, float comp4);
372  void convertHSLtoRGB(float h, float s, float l, float& r, float& g, float& b);
373  float HuetoRGB(float m1, float m2, float h);
374 };
375 
376 
377 
378 #endif
379 
static const float MO_P5_PI
Definition: moP5.h:356
static const float MO_P5_HALF_PI
Definition: moP5.h:354
moP5StrokeJoinMode
Definition: moP5.h:321
static const float MO_P5_TWO_PI
Definition: moP5.h:355
moP5ShapeMode
Definition: moP5.h:328
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
#define LIBMOLDEO_API
Definition: moTypes.h:180
moP5StrokeCapMode
Definition: moP5.h:336
moP5FillMode fillMode
Definition: moP5.h:365
Definition: moP5.h:41
moP5FillMode
Definition: moP5.h:348
moP5ColorMode
Definition: moP5.h:342
int currColorMode
Definition: moP5.h:361