libmoldeo (Moldeo 1.0 Core)
1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
moTypes.cpp
Ir a la documentación de este archivo.
1
/*******************************************************************************
2
3
moTypes.cpp
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
29
*******************************************************************************/
30
31
#include "
moTypes.h
"
32
33
36
LIBMOLDEO_API
MOfloat
morand
() {
37
//randomize();
38
return
((
double
)rand() /(
double
)(RAND_MAX+1));
39
}
40
41
LIBMOLDEO_API
MOint
moRand
(
MOint
n) {
42
//randomize();
43
double
nf;
44
MOint
ni;
45
nf =(double)(
morand
() *(double)(n));
46
ni =(int) nf;
47
return
(ni);
48
}
49
50
//entrada entre 0..255, salida entre 0..1
51
LIBMOLDEO_API
void
HSVtoRGB
(
short
iInHue,
short
iInSaturation,
short
iInValue,
float
* piRed,
float
* piGreen,
float
* piBlue)
52
{
53
if
(iInSaturation == 0) {
54
float
fInValue;
55
fInValue =(float)(iInValue) / 255.0;
56
*piRed = fInValue;
57
*piGreen = fInValue;
58
*piBlue = fInValue;
59
}
else
{
60
float
fHue, fValue, fSaturation;
61
int
i;
62
float
f;
63
float
p,q,t;
64
65
if
(iInHue == 360) iInHue = 0;
66
67
fHue =(float)iInHue / 60;
68
69
i = (int)fHue;
70
f = fHue -(float)i;
71
72
fValue =(float)iInValue / 255;
73
fSaturation =(float)iInSaturation / 255;
74
p = fValue *(1.0 - fSaturation);
75
q = fValue *(1.0 -(fSaturation *f));
76
t = fValue *(1.0 -(fSaturation *(1.0 - f)));
77
78
switch
(i) {
79
case
0:
80
*piRed = fValue ;
//* 255;
81
*piGreen = t ;
//* 255;
82
*piBlue = p ;
//* 255;
83
break
;
84
case
1:
85
*piRed = q ;
//* 255;
86
*piGreen = fValue;
// * 255;
87
*piBlue = p ;
//* 255;
88
break
;
89
case
2:
90
*piRed = p ;
//* 255;
91
*piGreen = fValue ;
//* 255;
92
*piBlue = t ;
//* 255;
93
break
;
94
case
3:
95
*piRed = p ;
//* 255;
96
*piGreen = q ;
//* 255;
97
*piBlue = fValue ;
//* 255;
98
break
;
99
case
4:
100
*piRed = t ;
//* 255;
101
*piGreen = p ;
//* 255;
102
*piBlue = fValue ;
//* 255;
103
break
;
104
case
5:
105
*piRed = fValue ;
//* 255;
106
*piGreen = p ;
//* 255;
107
*piBlue = q ;
//* 255;
108
break
;
109
}
110
}
111
}
112
154
#include "config.h"
155
moText
moGetVersionStr
() {
156
157
return
moText
(PACKAGE_VERSION);
158
159
}
160
moRand
LIBMOLDEO_API MOint moRand(MOint n)
Definition:
moTypes.cpp:41
HSVtoRGB
LIBMOLDEO_API void HSVtoRGB(short iInHue, short iInSaturation, short iInValue, float *piRed, float *piGreen, float *piBlue)
Definition:
moTypes.cpp:51
moGetVersionStr
moText moGetVersionStr()
Devuelve la versión de libmoldeo.
Definition:
moTypes.cpp:159
LIBMOLDEO_API
#define LIBMOLDEO_API
Definition:
moTypes.h:180
MOfloat
#define MOfloat
Definition:
moTypes.h:403
moText0
clase de para manejar textos
Definition:
moText.h:75
moText
moText0 moText
Definition:
moText.h:291
MOint
#define MOint
Definition:
moTypes.h:388
morand
LIBMOLDEO_API MOfloat morand()
Definition:
moTypes.cpp:36
moTypes.h
libmoldeotest
moTypes.cpp
Generado el Martes, 10 de Septiembre de 2019 21:28:25 para libmoldeo (Moldeo 1.0 Core) por
1.8.13