5ae20971ece03ec181ccda23b3420467eaa368af
[GPU.git] / WCudaMSE / BilatTools_Cuda_Image / src / core / cudaImageTools / bitmap / cpp / Image.cpp
1 #include <iostream>
2 #include <assert.h>
3 #include <math.h>
4
5 #include "Image.h"
6 #include "StringTools.h"
7 #include "MathTools.h"
8
9 using std::cout;
10 using std::endl;
11
12 /*----------------------------------------------------------------------*\
13 |* Declaration *|
14 \*---------------------------------------------------------------------*/
15
16 /*--------------------------------------*\
17 |* Imported *|
18 \*-------------------------------------*/
19
20 /*--------------------------------------*\
21 |* Public *|
22 \*-------------------------------------*/
23
24 /*--------------------------------------*\
25 |* Private *|
26 \*-------------------------------------*/
27
28 /*----------------------------------------------------------------------*\
29 |* Implementation *|
30 \*---------------------------------------------------------------------*/
31
32 /*--------------------------------------*\
33 |* Public *|
34 \*-------------------------------------*/
35
36 Image::Image(Animable_I* ptrAnimable,ColorRGB_01* ptrColorTitreRGB) :
37 ImageMOOs_A(ptrAnimable->getW(), ptrAnimable->getH())
38 {
39 this->ptrAnimable = ptrAnimable;
40 this->ptrColorTitreRGB=ptrColorTitreRGB;
41 }
42
43 Image::~Image(void)
44 {
45 delete ptrAnimable;
46 }
47
48 /**
49 * Override
50 */
51 void Image::animationStep(bool& isNeedUpdateView)
52 {
53 // cout << "[CBI] : Image : animationStep" <<endl;
54
55 ptrAnimable->animationStep();
56 isNeedUpdateView = true; // true par default
57 }
58
59 /**
60 * Override
61 */
62 void Image::fillImageGL(uchar4* ptrDevImageGL, int w, int h)
63 {
64 // cout << "[CBI] : Image : fillImageGL" <<endl;
65
66 ptrAnimable->runGPU(ptrDevImageGL);
67 }
68
69 /**
70 * Override
71 */
72 void Image::paintPrimitives(Graphic2Ds& graphic2D) // redefinition
73 {
74 const Font_A* ptrfont = graphic2D.getFont(TIMES_ROMAN_24);
75
76 float r = ptrColorTitreRGB->r;
77 float g = ptrColorTitreRGB->g;
78 float b = ptrColorTitreRGB->b;
79 graphic2D.setColorRGB(r, g, b);
80
81 // top
82 {
83 float t = ptrAnimable->getT();
84 string message = "t = " + StringTools::toString(t);
85 graphic2D.drawTitleTop(message, ptrfont);
86 }
87
88 // bottom
89 {
90 string title = ptrAnimable->getTitle();
91 graphic2D.drawTitleBottom(title, ptrfont);
92 }
93 }
94
95 /*--------------------------------------*\
96 |* Private *|
97 \*-------------------------------------*/
98
99 /*----------------------------------------------------------------------*\
100 |* End *|
101 \*---------------------------------------------------------------------*/