Documentation of the MLV-0.6.713 library

MLV_text.h

00001 /*
00002  *   This file is part of the MLV Library.
00003  *
00004  *   Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein
00005  *
00006  *
00007  *    This Library is free software: you can redistribute it and/or modify
00008  *    it under the terms of the GNU General Public License as published by
00009  *    the Free Software Foundation, either version 3 of the License, or
00010  *    (at your option) any later version.
00011  *
00012  *    This Library is distributed in the hope that it will be useful,
00013  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *    GNU General Public License for more details.
00016  *
00017  *    You should have received a copy of the GNU General Public License
00018  *    along with this Library.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00031 #ifndef __MLV__MLV_TEXT_H__
00032 #define __MLV__MLV_TEXT_H__
00033 
00034 #include "MLV_color.h"
00035 #include "MLV_image.h"
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00044 typedef enum {
00045         MLV_TEXT_CENTER, 
00046         MLV_TEXT_LEFT, 
00047         MLV_TEXT_RIGHT 
00048 } MLV_Text_justification;
00049 
00053 typedef enum {
00054         MLV_HORIZONTAL_CENTER, 
00056         MLV_HORIZONTAL_LEFT, 
00058         MLV_HORIZONTAL_RIGHT 
00060 } MLV_Horizontal_position;
00061 
00065 typedef enum {
00066         MLV_VERTICAL_CENTER, 
00068         MLV_VERTICAL_TOP, 
00070         MLV_VERTICAL_BOTTOM 
00072 } MLV_Vertical_position;
00073 
00077 typedef struct _MLV_Font MLV_Font;
00078 
00091 MLV_Font* MLV_load_font( const char* file_font, int size );
00092 
00099 void MLV_free_font( MLV_Font* font );
00100 
00109 void MLV_get_size_of_text( const char *text, int *width, int *height );
00110 
00120 void MLV_get_size_of_text_with_font(
00121         const char *text, int *width, int *height, const MLV_Font* font
00122 );
00123 
00135 void MLV_draw_text(int x, int y, const char *text, MLV_Color color);
00136 
00147 void MLV_draw_text_with_font(
00148         int x, int y, const char *text, const MLV_Font* font, MLV_Color color
00149 );
00150 
00164 void MLV_draw_text_on_image(
00165         int x, int y, const char *text, MLV_Color color, MLV_Image* image
00166 );
00167 
00179 void MLV_draw_text_with_font_on_image(
00180         int x, int y, const char *text, const MLV_Font* font, MLV_Color color, 
00181         MLV_Image* image
00182 );
00183 
00205 void MLV_draw_adapted_text_box(
00206         int x, int y,
00207         const char* message,
00208         int sizeInterligne,
00209         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00210         MLV_Text_justification text_justification
00211 );
00212 
00227 void MLV_draw_adapted_text_box_on_image(
00228         int x, int y,
00229         const char* message,
00230         int sizeInterligne,
00231         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00232         MLV_Text_justification text_justification,
00233         MLV_Image* image
00234 );
00235 
00250 int MLV_get_size_of_adapted_text_box(
00251         const char* message,
00252         int sizeInterligne,
00253         int *result_width, int *result_height
00254 );
00255 
00270 void MLV_draw_adapted_text_box_with_font(
00271         int x, int y,
00272         const char* message,
00273         const MLV_Font* font, 
00274         int sizeInterligne,
00275         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00276         MLV_Text_justification text_justification
00277 );
00278 
00294 void MLV_draw_adapted_text_box_with_font_on_image(
00295         int x, int y,
00296         const char* message,
00297         const MLV_Font* font, 
00298         int sizeInterligne,
00299         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00300         MLV_Text_justification text_justification,
00301         MLV_Image* image
00302 );
00303 
00304 
00319 int MLV_get_size_of_adapted_text_box_with_font(
00320         const char* message,
00321         const MLV_Font* font, 
00322         int sizeInterligne,
00323         int *result_width, int *result_height
00324 );
00325 
00358 void MLV_draw_text_box( 
00359         int x, int y, 
00360         int width, int height, 
00361         const char* message , 
00362         int sizeInterligne,
00363         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00364         MLV_Text_justification text_justification,
00365         MLV_Horizontal_position horizontal_position,
00366         MLV_Vertical_position vertical_position
00367 );
00368 
00387 void MLV_draw_text_box_on_image( 
00388         int x, int y, 
00389         int width, int height, 
00390         const char* message , 
00391         int sizeInterligne,
00392         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00393         MLV_Text_justification text_justification,
00394         MLV_Horizontal_position horizontal_position,
00395         MLV_Vertical_position vertical_position,
00396         MLV_Image* image
00397 );
00398 
00418 void MLV_draw_text_box_with_font( 
00419         int x, int y, 
00420         int width, int height, 
00421         const char* message , 
00422         const MLV_Font* font, 
00423         int sizeInterligne,
00424         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00425         MLV_Text_justification text_justification,
00426         MLV_Horizontal_position horizontal_position,
00427         MLV_Vertical_position vertical_position
00428 );
00429 
00450 void MLV_draw_text_box_with_font_on_image( 
00451         int x, int y, 
00452         int width, int height, 
00453         const char* message , 
00454         MLV_Font* font, 
00455         int sizeInterligne,
00456         MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
00457         MLV_Text_justification text_justification,
00458         MLV_Horizontal_position horizontal_position,
00459         MLV_Vertical_position vertical_position,
00460         MLV_Image* image
00461 );
00462 
00474 char* MLV_convert_unicode_to_string( int unicode );
00475 
00476 #ifdef __cplusplus
00477 }
00478 #endif
00479 
00480 #endif
00481