FTGL 2.4.0
FTBuffer.h
Go to the documentation of this file.
1/*
2 * FTGL - OpenGL font library
3 *
4 * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#ifndef __ftgl__
27# warning Please use <FTGL/ftgl.h> instead of <FTBuffer.h>.
28# include <FTGL/ftgl.h>
29#endif
30
31#ifndef __FTBuffer__
32#define __FTBuffer__
33
34#ifdef __cplusplus
35
46{
47 public:
52
57
63 inline FTPoint Pos() const
64 {
65 return pos;
66 }
67
73 inline void Pos(FTPoint arg)
74 {
75 pos = arg;
76 }
77
84 void Size(int w, int h);
85
91 inline int Width() const { return width; }
92
98 inline int Height() const { return height; }
99
105 inline unsigned char *Pixels() const { return pixels; }
106
107 private:
111 int width, height;
112
116 unsigned char *pixels;
117
121 FTPoint pos;
122};
123
124#endif //__cplusplus
125
126#endif // __FTBuffer__
127
FTBuffer is a helper class for pixel buffers.
Definition FTBuffer.h:46
FTPoint Pos() const
Get the pen's position in the buffer.
Definition FTBuffer.h:63
~FTBuffer()
Destructor.
unsigned char * Pixels() const
Get the buffer's direct pixel buffer.
Definition FTBuffer.h:105
FTBuffer()
Default constructor.
int Width() const
Get the buffer's width.
Definition FTBuffer.h:91
int Height() const
Get the buffer's height.
Definition FTBuffer.h:98
void Size(int w, int h)
Set the buffer's size.
void Pos(FTPoint arg)
Set the pen's position in the buffer.
Definition FTBuffer.h:73
FTPoint class is a basic 3-dimensional point or vector.
Definition FTPoint.h:43
#define FTGL_EXPORT
Definition ftgl.h:134