Patch from Guillaume Cottenceau to add some missing functions
[sdlpango.git] / src / SDL_Pango.h
blob6ebdf7820e955b7fe60daeb2b25d3b1f76887f98
1 /* SDL_Pango.h -- A companion library to SDL for working with Pango.
2 Copyright (C) 2004 NAKAMURA Ken'ichi
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 /*! @file
20 @brief Header file of SDL_Pango
22 @author NAKAMURA Ken'ichi
23 @date 2004/08/26
24 $Revision: 1.3 $
27 #ifndef SDL_PANGO_H
28 #define SDL_PANGO_H
29 #define SDL_PANGO_HAS_GC_EXTENSIONS
31 #include "SDL.h"
33 #include "begin_code.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
41 typedef struct _contextImpl SDLPango_Context;
43 /*!
44 General 4 X 4 matrix struct.
46 typedef struct _SDLPango_Matrix {
47 Uint8 m[4][4]; /*! Matrix variables */
48 } SDLPango_Matrix;
50 const SDLPango_Matrix _MATRIX_WHITE_BACK
51 = {255, 0, 0, 0,
52 255, 0, 0, 0,
53 255, 0, 0, 0,
54 255, 255, 0, 0,};
56 /*!
57 Specifies white back and black letter.
59 const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
61 const SDLPango_Matrix _MATRIX_BLACK_BACK
62 = {0, 255, 0, 0,
63 0, 255, 0, 0,
64 0, 255, 0, 0,
65 255, 255, 0, 0,};
66 /*!
67 Specifies black back and white letter.
69 const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
71 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
72 = {0, 0, 0, 0,
73 0, 0, 0, 0,
74 0, 0, 0, 0,
75 0, 255, 0, 0,};
76 /*!
77 Specifies transparent back and black letter.
79 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
81 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
82 = {255, 255, 0, 0,
83 255, 255, 0, 0,
84 255, 255, 0, 0,
85 0, 255, 0, 0,};
86 /*!
87 Specifies transparent back and white letter.
89 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
91 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
92 = {255, 255, 0, 0,
93 255, 255, 0, 0,
94 255, 255, 0, 0,
95 0, 0, 0, 0,};
96 /*!
97 Specifies transparent back and transparent letter.
98 This is useful for KARAOKE like rendering.
100 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
103 Specifies direction of text. See Pango reference for detail
105 typedef enum {
106 SDLPANGO_DIRECTION_LTR, /*! Left to right */
107 SDLPANGO_DIRECTION_RTL, /*! Right to left */
108 SDLPANGO_DIRECTION_WEAK_LTR, /*! Left to right (weak) */
109 SDLPANGO_DIRECTION_WEAK_RTL, /*! Right to left (weak) */
110 SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
111 } SDLPango_Direction;
114 Specifies alignment of text. See Pango reference for detail
116 typedef enum {
117 SDLPANGO_ALIGN_LEFT,
118 SDLPANGO_ALIGN_CENTER,
119 SDLPANGO_ALIGN_RIGHT
120 } SDLPango_Alignment;
122 extern DECLSPEC int SDLCALL SDLPango_Init();
124 extern DECLSPEC int SDLCALL SDLPango_WasInit();
126 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
127 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
129 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
130 SDLPango_Context *context);
132 extern DECLSPEC void SDLCALL SDLPango_SetSurfaceCreateArgs(
133 SDLPango_Context *context,
134 Uint32 flags,
135 int depth,
136 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
138 extern DECLSPEC SDL_Surface * SDLCALL SDLPango_CreateSurfaceDraw(
139 SDLPango_Context *context);
141 extern DECLSPEC void SDLCALL SDLPango_Draw(
142 SDLPango_Context *context,
143 SDL_Surface *surface,
144 int x, int y);
146 extern DECLSPEC void SDLCALL SDLPango_SetDpi(
147 SDLPango_Context *context,
148 double dpi_x, double dpi_y);
150 extern DECLSPEC void SDLCALL SDLPango_SetMinimumSize(
151 SDLPango_Context *context,
152 int width, int height);
154 extern DECLSPEC void SDLCALL SDLPango_SetDefaultColor(
155 SDLPango_Context *context,
156 const SDLPango_Matrix *color_matrix);
158 extern DECLSPEC int SDLCALL SDLPango_GetLayoutWidth(
159 SDLPango_Context *context);
161 extern DECLSPEC int SDLCALL SDLPango_GetLayoutHeight(
162 SDLPango_Context *context);
164 extern DECLSPEC void SDLCALL SDLPango_SetMarkup(
165 SDLPango_Context *context,
166 const char *markup,
167 int length);
169 extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
170 SDLPango_Context *context,
171 const char *text,
172 int length,
173 SDLPango_Alignment alignment);
175 extern DECLSPEC void SDLCALL SDLPango_SetText(
176 SDLPango_Context *context,
177 const char *markup,
178 int length);
180 extern DECLSPEC void SDLCALL SDLPango_SetLanguage(
181 SDLPango_Context *context,
182 const char *language_tag);
184 extern DECLSPEC void SDLCALL SDLPango_SetBaseDirection(
185 SDLPango_Context *context,
186 SDLPango_Direction direction);
189 #ifdef __FT2_BUILD_UNIX_H__
191 extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface(
192 const FT_Bitmap *bitmap,
193 SDL_Surface *surface,
194 const SDLPango_Matrix *matrix,
195 SDL_Rect *rect);
197 #endif /* __FT2_BUILD_UNIX_H__ */
200 #ifdef __PANGO_H__
202 extern DECLSPEC PangoFontMap* SDLCALL SDLPango_GetPangoFontMap(
203 SDLPango_Context *context);
205 extern DECLSPEC PangoFontDescription* SDLCALL SDLPango_GetPangoFontDescription(
206 SDLPango_Context *context);
208 extern DECLSPEC PangoLayout* SDLCALL SDLPango_GetPangoLayout(
209 SDLPango_Context *context);
211 #endif /* __PANGO_H__ */
214 #ifdef __cplusplus
216 #endif
218 #include "close_code.h"
220 #endif /* SDL_PANGO_H */