Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:15:00

0001 /*
0002  * FTGL - OpenGL font library
0003  *
0004  * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net>
0005  *
0006  * Permission is hereby granted, free of charge, to any person obtaining
0007  * a copy of this software and associated documentation files (the
0008  * "Software"), to deal in the Software without restriction, including
0009  * without limitation the rights to use, copy, modify, merge, publish,
0010  * distribute, sublicense, and/or sell copies of the Software, and to
0011  * permit persons to whom the Software is furnished to do so, subject to
0012  * the following conditions:
0013  *
0014  * The above copyright notice and this permission notice shall be
0015  * included in all copies or substantial portions of the Software.
0016  *
0017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0018  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0020  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0021  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0022  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0023  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0024  */
0025 
0026 #ifndef __ftgl__
0027 #   warning Please use <FTGL/ftgl.h> instead of <FTBuffer.h>.
0028 #   include <FTGL/ftgl.h>
0029 #endif
0030 
0031 #ifndef __FTBuffer__
0032 #define __FTBuffer__
0033 
0034 #ifdef __cplusplus
0035 
0036 /**
0037  * FTBuffer is a helper class for pixel buffers.
0038  *
0039  * It provides the interface between FTBufferFont and FTBufferGlyph to
0040  * optimise rendering operations.
0041  *
0042  * @see FTBufferGlyph
0043  * @see FTBufferFont
0044  */
0045 class FTGL_EXPORT FTBuffer
0046 {
0047     public:
0048         /**
0049          * Default constructor.
0050          */
0051         FTBuffer();
0052 
0053         /**
0054          * Destructor
0055          */
0056         ~FTBuffer();
0057 
0058         /**
0059          * Get the pen's position in the buffer.
0060          *
0061          * @return  The pen's position as an FTPoint object.
0062          */
0063         inline FTPoint Pos() const
0064         {
0065             return pos;
0066         }
0067 
0068         /**
0069          * Set the pen's position in the buffer.
0070          *
0071          * @param arg  An FTPoint object with the desired pen's position.
0072          */
0073         inline void Pos(FTPoint arg)
0074         {
0075             pos = arg;
0076         }
0077 
0078         /**
0079          * Set the buffer's size.
0080          *
0081          * @param w  The buffer's desired width, in pixels.
0082          * @param h  The buffer's desired height, in pixels.
0083          */
0084         void Size(int w, int h);
0085 
0086         /**
0087          * Get the buffer's width.
0088          *
0089          * @return  The buffer's width, in pixels.
0090          */
0091         inline int Width() const { return width; }
0092 
0093         /**
0094          * Get the buffer's height.
0095          *
0096          * @return  The buffer's height, in pixels.
0097          */
0098         inline int Height() const { return height; }
0099 
0100         /**
0101          * Get the buffer's direct pixel buffer.
0102          *
0103          * @return  A read-write pointer to the buffer's pixels.
0104          */
0105         inline unsigned char *Pixels() const { return pixels; }
0106 
0107     private:
0108         /**
0109          * Buffer's width and height.
0110          */
0111         int width, height;
0112 
0113         /**
0114          * Buffer's pixel buffer.
0115          */
0116         unsigned char *pixels;
0117 
0118         /**
0119          * Buffer's internal pen position.
0120          */
0121         FTPoint pos;
0122 };
0123 
0124 #endif //__cplusplus
0125 
0126 #endif // __FTBuffer__
0127