SDL Pango 0.1.2 as released by Upstream
[sdlpango.git] / src / SDL_Pango.h
blob2433661aed6c23daa30b4d813766d7804726d503
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
30 #include "SDL.h"
32 #include "begin_code.h"
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
40 typedef struct _contextImpl SDLPango_Context;
42 /*!
43 General 4 X 4 matrix struct.
45 typedef struct _SDLPango_Matrix {
46 Uint8 m[4][4]; /*! Matrix variables */
47 } SDLPango_Matrix;
49 const SDLPango_Matrix _MATRIX_WHITE_BACK
50 = {255, 0, 0, 0,
51 255, 0, 0, 0,
52 255, 0, 0, 0,
53 255, 255, 0, 0,};
55 /*!
56 Specifies white back and black letter.
58 const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
60 const SDLPango_Matrix _MATRIX_BLACK_BACK
61 = {0, 255, 0, 0,
62 0, 255, 0, 0,
63 0, 255, 0, 0,
64 255, 255, 0, 0,};
65 /*!
66 Specifies black back and white letter.
68 const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
70 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
71 = {0, 0, 0, 0,
72 0, 0, 0, 0,
73 0, 0, 0, 0,
74 0, 255, 0, 0,};
75 /*!
76 Specifies transparent back and black letter.
78 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
80 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
81 = {255, 255, 0, 0,
82 255, 255, 0, 0,
83 255, 255, 0, 0,
84 0, 255, 0, 0,};
85 /*!
86 Specifies transparent back and white letter.
88 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
90 const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
91 = {255, 255, 0, 0,
92 255, 255, 0, 0,
93 255, 255, 0, 0,
94 0, 0, 0, 0,};
95 /*!
96 Specifies transparent back and transparent letter.
97 This is useful for KARAOKE like rendering.
99 const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
102 Specifies direction of text. See Pango reference for detail
104 typedef enum {
105 SDLPANGO_DIRECTION_LTR, /*! Left to right */
106 SDLPANGO_DIRECTION_RTL, /*! Right to left */
107 SDLPANGO_DIRECTION_WEAK_LTR, /*! Left to right (weak) */
108 SDLPANGO_DIRECTION_WEAK_RTL, /*! Right to left (weak) */
109 SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
110 } SDLPango_Direction;
114 extern DECLSPEC int SDLCALL SDLPango_Init();
116 extern DECLSPEC int SDLCALL SDLPango_WasInit();
118 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
120 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
121 SDLPango_Context *context);
123 extern DECLSPEC void SDLCALL SDLPango_SetSurfaceCreateArgs(
124 SDLPango_Context *context,
125 Uint32 flags,
126 int depth,
127 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
129 extern DECLSPEC SDL_Surface * SDLCALL SDLPango_CreateSurfaceDraw(
130 SDLPango_Context *context);
132 extern DECLSPEC void SDLCALL SDLPango_Draw(
133 SDLPango_Context *context,
134 SDL_Surface *surface,
135 int x, int y);
137 extern DECLSPEC void SDLCALL SDLPango_SetDpi(
138 SDLPango_Context *context,
139 double dpi_x, double dpi_y);
141 extern DECLSPEC void SDLCALL SDLPango_SetMinimumSize(
142 SDLPango_Context *context,
143 int width, int height);
145 extern DECLSPEC void SDLCALL SDLPango_SetDefaultColor(
146 SDLPango_Context *context,
147 const SDLPango_Matrix *color_matrix);
149 extern DECLSPEC int SDLCALL SDLPango_GetLayoutWidth(
150 SDLPango_Context *context);
152 extern DECLSPEC int SDLCALL SDLPango_GetLayoutHeight(
153 SDLPango_Context *context);
155 extern DECLSPEC void SDLCALL SDLPango_SetMarkup(
156 SDLPango_Context *context,
157 const char *markup,
158 int length);
160 extern DECLSPEC void SDLCALL SDLPango_SetText(
161 SDLPango_Context *context,
162 const char *markup,
163 int length);
165 extern DECLSPEC void SDLCALL SDLPango_SetLanguage(
166 SDLPango_Context *context,
167 const char *language_tag);
169 extern DECLSPEC void SDLCALL SDLPango_SetBaseDirection(
170 SDLPango_Context *context,
171 SDLPango_Direction direction);
174 #ifdef __FT2_BUILD_UNIX_H__
176 extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface(
177 const FT_Bitmap *bitmap,
178 SDL_Surface *surface,
179 const SDLPango_Matrix *matrix,
180 SDL_Rect *rect);
182 #endif /* __FT2_BUILD_UNIX_H__ */
185 #ifdef __PANGO_H__
187 extern DECLSPEC PangoFontMap* SDLCALL SDLPango_GetPangoFontMap(
188 SDLPango_Context *context);
190 extern DECLSPEC PangoFontDescription* SDLCALL SDLPango_GetPangoFontDescription(
191 SDLPango_Context *context);
193 extern DECLSPEC PangoLayout* SDLCALL SDLPango_GetPangoLayout(
194 SDLPango_Context *context);
196 #endif /* __PANGO_H__ */
199 #ifdef __cplusplus
201 #endif
203 #include "close_code.h"
205 #endif /* SDL_PANGO_H */