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
37extern "C" {
38#endif
39
53typedef struct _MLV_Image MLV_Image;
54
76MLV_Image* MLV_load_image( const char* file_image );
77
78
88int MLV_save_image_as_bmp( const MLV_Image* image, const char* file_image );
89
97MLV_Image* MLV_create_image( int width, int height );
98
105
117
133 const MLV_Image* image, int x, int y, int width, int height
134);
135
143void MLV_get_image_size( const MLV_Image* image, int* width, int* height );
144
151int MLV_get_image_width( const MLV_Image* image );
152
159int MLV_get_image_height( const MLV_Image* image );
160
161
173void MLV_resize_image( MLV_Image* image, int width, int height );
174
181
188
207 MLV_Image* image, int width, int height
208);
209
217void MLV_scale_image( MLV_Image* image, double scalar );
218
225void MLV_rotate_image( MLV_Image* image, double rotation );
226
234void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar );
235
244void 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
270void 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
330
342 int x, int y,
343 MLV_Color color,
344 MLV_Image *image
345);
346
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
485SDL_Surface* MLV_get_image_data( MLV_Image* image );
486
493
500
507
508// TODO
509#if 0
514typedef 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
611void 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 !
621void MLV_draw_rotated_image( MLV_Image *image, int x, int y, double rotation );
622void MLV_draw_scaled_image( MLV_Image *image, int x, int y, double scalar );
623void 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
Uint32 MLV_Color
Définit un type couleur pour la bibliothèque MLV.
Definition: MLV_color.h:54
Définit toutes les couleurs disponibles dans la bibliothèque MLV.
Uint8 MLV_Alpha
Type codant la transparence dans MLV.
Definition: MLV_color.h:67
@ MLV_NONE
Definition: MLV_event.h:47
int MLV_get_image_width(const MLV_Image *image)
Retourne la largeur 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_horizontal_image_mirror(MLV_Image *image)
Modifie l'image en réalisant une réflexion horizontale.
MLV_Image * MLV_get_screen()
Renvoie l'image qui se trouve à l'écran.
MLV_Image * MLV_copy_image(const MLV_Image *image)
Copie une image.
SDL_Surface * MLV_get_image_data(MLV_Image *image)
Renvoie les données internes de l'image.
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_get_image_size(const MLV_Image *image, int *width, int *height)
Retourne la taille d'une image donnée.
void MLV_vertical_image_mirror(MLV_Image *image)
Modifie l'image en réalisant une réflexion verticale.
void MLV_resize_image(MLV_Image *image, int width, int height)
Redimensionne l'image en ne respectant pas les proportions de l'image originale.
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_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...
int MLV_save_image_as_bmp(const MLV_Image *image, const char *file_image)
Sauvegarde une image dans une fichier BMP.
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.
struct _MLV_Image MLV_Image
Définit le type Image dans la bibliothèque MLV.
Definition: MLV_image.h:53
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_scale_image(MLV_Image *image, double scalar)
Modifie l'image à l'aide d'une homotétie ( Étire l'image )
void MLV_free_image(MLV_Image *image)
Libère la mémoire utilisée par l'image.
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.
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...
int MLV_get_image_height(const MLV_Image *image)
Retourne la hauteur d'une image donnée.
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.
MLV_Image * MLV_create_image(int width, int height)
Créer une image de composante alpha opaque.
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...
void MLV_rotate_image(MLV_Image *image, double rotation)
Éffectue une rotation sur une image donnée.
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.
void MLV_rotate_and_scale_image(MLV_Image *image, double rotation, double scalar)
Éffectue une rotation suivie d'une homotétie.
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.
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_save_screen()
Enregistre l'image de l'écran dans un presse papier interne à la bibliothèque MLV....
void MLV_load_screen()
Charge l'image présent dans le presse papier interne de la bibliothèque MLV.