-
Notifications
You must be signed in to change notification settings - Fork 1
/
ofkglImageRenderer.h
executable file
·79 lines (60 loc) · 1.58 KB
/
ofkglImageRenderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// Created by Shunichi Kasahara on 12/03/04.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
// 2012.06.04 add useImageSize() function
#ifndef eventsExample_ofkglImageRenderer_h
#define eventsExample_ofkglImageRenderer_h
#include "ofMain.h"
class ofkglImageRenderer
{
public:
//how to render the image rectangle
enum RECTMODE
{
RECTMODE_CENTER = 0,
RECTMODE_LEFTSIDE,
RECTMODE_RIGHTSIDE,
RECTMODE_UPPERSIDE,
RECTMODE_BOTTOMSIDE,
RECTMODE_LEFTTOP,
RECTMODE_LEFTBOTTOM,
RECTMODE_RIGTHTOP,
RECTMODE_RIGTHBOTTOM
};
/*
+------+
| |
| |
+------+
*/
ofkglImageRenderer();
~ofkglImageRenderer();
void update();
void render();
void setImageFile(string imageFileName);
void setImage(ofImage image);
void setTexture(ofTexture tex);
void useImageSize();
//void setUV(float * uvArray);
void setSize(float width, float height);
bool upsideDown;
float r, b, g, a;
float x, y, z;
float rx, ry, rz;
float scaleX, scaleY;
RECTMODE rectMode;
float getWidth(){ return mWidth; }
float getHeight(){ return mHeight; }
float getImgRatio() {return (mHeight / mWidth);}
bool isHitTest(ofPoint FrameBufferPoint);
bool isImageLoaded();
private:
float mWidth;
float mHeight;
float squareTexCoord[8];
virtual void internalDraw(float x, float y, float w, float h);
ofTexture mTexture;
ofImage mImage;
};
#endif