Documentation de la bibliothèque MLV-2.0.2

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 
499 void MLV_load_screen();
500 
501 // TODO
502 #if 0
503 
507 typedef enum {
508  MLV_NONE,
509  MLV_REPLACE,
510  MLV_MAX,
511  MLV_MIN,
512  MLV_BARYCENTER
513 } MLV_Mathematic_operations;
514 
515 
560  const MLV_Image* source_image,
561  int source_x, int source_y,
562  int with, int height,
563  MLV_Image* destination_image,
564  int destination_x, int destination_y,
565  MLV_Mathematic_operations rgb_treatment,
566  MLV_Mathematic_operations alpha_treatment
567 );
568 
604 void MLV_draw_partial_image_on_image_FAST(
605  const MLV_Image* source_image,
606  int source_x, int source_y,
607  int with, int height,
608  const MLV_Image* destination_image,
609  int destination_x, int destination_y
610 );
611 #endif
612 
613 /* TODO : A Vérifier !
614 void MLV_draw_rotated_image( MLV_Image *image, int x, int y, double rotation );
615 void MLV_draw_scaled_image( MLV_Image *image, int x, int y, double scalar );
616 void MLV_draw_scaled_rotated_image( MLV_Image *image, int x, int y, double roation, double scalar );
617 */
618 
619 #ifdef __cplusplus
620 }
621 #endif
622 
623 #endif
int MLV_get_image_height(const MLV_Image *image)
Retourne la hauteur d'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'image suivant l'axe X et l'axe Y avec des coefficients de proport...
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'un pixel par celles passées en paramètre de la f...
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'image.
void MLV_horizontal_image_mirror(MLV_Image *image)
Modifie l'image en réalisant une réflexion horizontale.
void MLV_scale_xy_image(MLV_Image *image, double scalar_x, double scalar_y)
Étire l'image suivant l'axe X et l'axe Y avec des coefficients de proportionnalité différents pour le...
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'image en ne respectant pas les proportions de l'image originale.
int MLV_get_image_width(const MLV_Image *image)
Retourne la largeur d'une image donnée.
void MLV_resize_image_with_proportions(MLV_Image *image, int width, int height)
Cette fonction redimensionne l'image en repsectant les proportions de l'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'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'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'écran pour une position donnée.
SDL_Surface * MLV_get_image_data(MLV_Image *image)
Renvoie les données internes de l'image.
void MLV_set_alpha_on_image(MLV_Alpha alpha, MLV_Image *image)
La composante alpha de l'image est remplacée par une composante alpha homogène dont la valeur est don...
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'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'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'image.
void MLV_scale_image(MLV_Image *image, double scalar)
Modifie l'image à l'aide d'une homotétie ( Étire l'image )
void MLV_vertical_image_mirror(MLV_Image *image)
Modifie l'image en réalisant une réflexion verticale.
Definition: MLV_event.h:47
void MLV_save_screen()
Enregistre l'image de l'é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'image présent dans le presse papier interne de la bibliothèque MLV.