Documentation de la bibliothèque MLV-3.1.0

MLV_image.h
Aller à la documentation de ce fichier.
1 /*
2  * This file is part of the MLV Library.
3  *
4  * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein
5  *
6  *
7  * This Library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This Library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this Library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
31 #ifndef __MLV__MLV_IMAGE_H__
32 #define __MLV__MLV_IMAGE_H__
33 
34 #include "MLV_color.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
53 typedef struct _MLV_Image MLV_Image;
54 
76 MLV_Image* MLV_load_image( const char* file_image );
77 
78 
88 int MLV_save_image_as_bmp( const MLV_Image* image, const char* file_image );
89 
97 MLV_Image* MLV_create_image( int width, int height );
98 
104 void MLV_free_image( MLV_Image *image );
105 
116 MLV_Image* MLV_copy_image( const MLV_Image* image );
117 
133  const MLV_Image* image, int x, int y, int width, int height
134 );
135 
143 void MLV_get_image_size( const MLV_Image* image, int* width, int* height );
144 
151 int MLV_get_image_width( const MLV_Image* image );
152 
159 int MLV_get_image_height( const MLV_Image* image );
160 
161 
173 void MLV_resize_image( MLV_Image* image, int width, int height );
174 
180 void MLV_vertical_image_mirror( MLV_Image* image );
181 
188 
207  MLV_Image* image, int width, int height
208 );
209 
217 void MLV_scale_image( MLV_Image* image, double scalar );
218 
225 void MLV_rotate_image( MLV_Image* image, double rotation );
226 
234 void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar );
235 
244 void MLV_scale_xy_image( MLV_Image* image, double scalar_x, double scalar_y );
245 
258  MLV_Image* image, double rotation, double scalar_x, double scalar_y
259 );
260 
270 void MLV_draw_image( const MLV_Image *image, int x, int y );
271 
288  const MLV_Image *image, int x_source, int y_source,
289  int width_source, int height_source,
290  int x, int y
291 );
292 
293 
329 void MLV_set_alpha_on_image( MLV_Alpha alpha, MLV_Image *image );
330 
342  int x, int y,
343  MLV_Color color,
344  MLV_Image *image
345 );
346 
360 void MLV_get_pixel(
361  int x, int y, int* red, int* green, int* blue, int* alpha
362 );
363 
380  const MLV_Image* image, int x, int y,
381  int* red, int* green, int* blue, int* alpha
382 );
383 
403  const MLV_Image* source_image,
404  int source_x, int source_y,
405  int width, int height,
406  MLV_Image* destination_image,
407  int destination_x, int destination_y
408 );
409 
423  const MLV_Image* source_image,
424  MLV_Image* destination_image,
425  int destination_x, int destination_y
426 );
427 
485 SDL_Surface* MLV_get_image_data( MLV_Image* image );
486 
492 void MLV_save_screen();
493 
500 
506 void MLV_load_screen();
507 
508 // TODO
509 #if 0
510 
514 typedef enum {
515  MLV_NONE,
516  MLV_REPLACE,
517  MLV_MAX,
518  MLV_MIN,
519  MLV_BARYCENTER
520 } MLV_Mathematic_operations;
521 
522 
567  const MLV_Image* source_image,
568  int source_x, int source_y,
569  int with, int height,
570  MLV_Image* destination_image,
571  int destination_x, int destination_y,
572  MLV_Mathematic_operations rgb_treatment,
573  MLV_Mathematic_operations alpha_treatment
574 );
575 
611 void MLV_draw_partial_image_on_image_FAST(
612  const MLV_Image* source_image,
613  int source_x, int source_y,
614  int with, int height,
615  const MLV_Image* destination_image,
616  int destination_x, int destination_y
617 );
618 #endif
619 
620 /* TODO : A Vérifier !
621 void MLV_draw_rotated_image( MLV_Image *image, int x, int y, double rotation );
622 void MLV_draw_scaled_image( MLV_Image *image, int x, int y, double scalar );
623 void MLV_draw_scaled_rotated_image( MLV_Image *image, int x, int y, double roation, double scalar );
624 */
625 
626 #ifdef __cplusplus
627 }
628 #endif
629 
630 #endif
int MLV_get_image_height(const MLV_Image *image)
Retourne la hauteur d&#39;une image donnée.
void MLV_draw_image(const MLV_Image *image, int x, int y)
Dessine une image donnée à une position donnée de la fenêtre.
void MLV_rotate_and_scale_xy_image(MLV_Image *image, double rotation, double scalar_x, double scalar_y)
Éffectue une rotation, puis étire l&#39;image suivant l&#39;axe X et l&#39;axe Y avec des coefficients de propo...
void MLV_set_pixel_on_image(int x, int y, MLV_Color color, MLV_Image *image)
Écrase les composantes rouge, bleue, vert et alpha d&#39;un pixel par celles passées en paramètre de l...
Uint8 MLV_Alpha
Type codant la transparence dans MLV.
Definition: MLV_color.h:67
Définit toutes les couleurs disponibles dans la bibliothèque MLV.
void MLV_rotate_image(MLV_Image *image, double rotation)
Éffectue une rotation sur une image donnée.
void MLV_free_image(MLV_Image *image)
Libère la mémoire utilisée par l&#39;image.
MLV_Image * MLV_get_screen()
Renvoie l&#39;image qui se trouve à l&#39;écran.
void MLV_horizontal_image_mirror(MLV_Image *image)
Modifie l&#39;image en réalisant une réflexion horizontale.
void MLV_scale_xy_image(MLV_Image *image, double scalar_x, double scalar_y)
Étire l&#39;image suivant l&#39;axe X et l&#39;axe Y avec des coefficients de proportionnalité différents pour...
void MLV_draw_image_on_image(const MLV_Image *source_image, MLV_Image *destination_image, int destination_x, int destination_y)
Dessine une image dans une image destination.
struct _MLV_Image MLV_Image
Définit le type Image dans la bibliothèque MLV.
Definition: MLV_image.h:53
Uint32 MLV_Color
Définit un type couleur pour la bibliothèque MLV.
Definition: MLV_color.h:54
MLV_Image * MLV_copy_image(const MLV_Image *image)
Copie une image.
MLV_Image * MLV_create_image(int width, int height)
Créer une image de composante alpha opaque.
void MLV_resize_image(MLV_Image *image, int width, int height)
Redimensionne l&#39;image en ne respectant pas les proportions de l&#39;image originale.
int MLV_get_image_width(const MLV_Image *image)
Retourne la largeur d&#39;une image donnée.
void MLV_resize_image_with_proportions(MLV_Image *image, int width, int height)
Cette fonction redimensionne l&#39;image en repsectant les proportions de l&#39;image originale.
void MLV_draw_partial_image(const MLV_Image *image, int x_source, int y_source, int width_source, int height_source, int x, int y)
Dessine une partie d&#39;une image donnée à une position donnée sur la fenêtre.
void MLV_get_image_size(const MLV_Image *image, int *width, int *height)
Retourne la taille d&#39;une image donnée.
MLV_Image * MLV_load_image(const char *file_image)
Charge en mémoire une image contenue dans un fichier.
void MLV_get_pixel(int x, int y, int *red, int *green, int *blue, int *alpha)
Renvoie la couleur du pixel de l&#39;écran pour une position donnée.
SDL_Surface * MLV_get_image_data(MLV_Image *image)
Renvoie les données internes de l&#39;image.
void MLV_set_alpha_on_image(MLV_Alpha alpha, MLV_Image *image)
La composante alpha de l&#39;image est remplacée par une composante alpha homogène dont la valeur est d...
void MLV_get_pixel_on_image(const MLV_Image *image, int x, int y, int *red, int *green, int *blue, int *alpha)
Renvoie la couleur du pixel présent à une position donnée d&#39;une image donnée. ...
int MLV_save_image_as_bmp(const MLV_Image *image, const char *file_image)
Sauvegarde une image dans une fichier BMP.
void MLV_rotate_and_scale_image(MLV_Image *image, double rotation, double scalar)
Éffectue une rotation suivie d&#39;une homotétie.
MLV_Image * MLV_copy_partial_image(const MLV_Image *image, int x, int y, int width, int height)
Copie une partie de l&#39;image.
void MLV_scale_image(MLV_Image *image, double scalar)
Modifie l&#39;image à l&#39;aide d&#39;une homotétie ( Étire l&#39;image )
void MLV_vertical_image_mirror(MLV_Image *image)
Modifie l&#39;image en réalisant une réflexion verticale.
Definition: MLV_event.h:47
void MLV_save_screen()
Enregistre l&#39;image de l&#39;écran dans un presse papier interne à la bibliothèque MLV..
void MLV_draw_partial_image_on_image(const MLV_Image *source_image, int source_x, int source_y, int width, int height, MLV_Image *destination_image, int destination_x, int destination_y)
Dessine une image dans une image destination.
void MLV_load_screen()
Charge l&#39;image présent dans le presse papier interne de la bibliothèque MLV.