Documentation de la bibliothèque MLV-0.5

MLV_image.h

Aller à la documentation de ce fichier.
00001 /*
00002  *   This file is part of the MLV Library.
00003  *
00004  *   Copyright (C) 2010 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_IMAGE_H__
00032 #define __MLV_IMAGE_H__
00033 
00034 #include "MLV_color.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00043 typedef struct _MLV_Image MLV_Image;
00044 
00066 MLV_Image* MLV_load_image( const char* file_image );
00067 
00068 
00078 int MLV_save_image_as_bmp( const MLV_Image* image,  const char* file_image );
00079 
00087 MLV_Image* MLV_create_image( int width, int height );
00088 
00094 void MLV_free_image( MLV_Image *image );
00095 
00106 MLV_Image* MLV_copy_image( MLV_Image* image );
00107 
00122 MLV_Image* MLV_copy_partial_image(
00123         MLV_Image* image, int x, int y, int width, int height
00124 );
00125 
00133 void MLV_get_image_size( MLV_Image* image, int* width, int* height );
00134 
00141 int MLV_get_image_width( MLV_Image* image );
00142 
00149 int MLV_get_image_height( MLV_Image* image );
00150 
00151 
00163 void MLV_resize_image( MLV_Image* image, int width, int height );
00164 
00170 void MLV_vertical_image_mirror( MLV_Image* image );
00171 
00177 void MLV_horizontal_image_mirror( MLV_Image* image );
00178 
00196 void MLV_resize_image_with_proportions(
00197         MLV_Image* image, int width, int height
00198 );
00199 
00207 void MLV_scale_image( MLV_Image* image, double scalar );
00208 
00215 void MLV_rotate_image( MLV_Image* image, double rotation );
00216 
00224 void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar );
00225 
00234 void MLV_scale_xy_image( MLV_Image* image, double scalar_x, double scalar_y );
00235 
00247 void MLV_rotate_and_scale_xy_image(
00248         MLV_Image* image, double rotation, double scalar_x, double scalar_y 
00249 );
00250 
00260 void MLV_draw_image( MLV_Image *image, int x, int y );
00261 
00279 void MLV_draw_partial_image(
00280          MLV_Image *image, int x_source, int y_source, 
00281         int width_source, int height_source, 
00282         int x, int y
00283 );
00284 
00285 
00305 void MLV_set_alpha_on_image( MLV_Alpha alpha, MLV_Image *image );
00306 
00317 void MLV_set_pixel_on_image(
00318         int x, int y,
00319         MLV_Color color, 
00320         MLV_Image *image
00321 );
00322 
00336 void MLV_get_pixel(
00337         int x, int y, int* red, int* green, int* blue, int* alpha
00338 );
00339 
00355 void MLV_get_pixel_on_image(
00356         MLV_Image* image, int x, int y,
00357         int* red, int* green, int* blue, int* alpha
00358 );
00359 
00378 void MLV_draw_partial_image_on_image(
00379         const MLV_Image* source_image,
00380         int source_x, int source_y,
00381         int width, int height,
00382         const MLV_Image* destination_image,
00383         int destination_x, int destination_y
00384 );
00385 
00398 void MLV_draw_image_on_image(
00399         const MLV_Image* source_image,
00400         const MLV_Image* destination_image,
00401         int destination_x, int destination_y
00402 );
00403 
00459 SDL_Surface* MLV_get_image_data( MLV_Image* image );
00460 
00461 // TODO
00462 #if 0
00463 
00467 typedef enum {
00468         MLV_NONE,
00469         MLV_REPLACE,
00470         MLV_MAX,
00471         MLV_MIN,
00472         MLV_BARYCENTER
00473 } MLV_Mathematic_operations;
00474 
00475 
00519 void MLV_draw_partial_image_on_image(
00520         const MLV_Image* source_image,
00521         int source_x, int source_y,
00522         int with, int height,
00523         const MLV_Image* destination_image,
00524         int destination_x, int destination_y,
00525         MLV_Mathematic_operations rgb_treatment,
00526         MLV_Mathematic_operations alpha_treatment
00527 );
00528 
00564 void MLV_draw_partial_image_on_image_FAST(
00565         const MLV_Image* source_image,
00566         int source_x, int source_y,
00567         int with, int height,
00568         const MLV_Image* destination_image,
00569         int destination_x, int destination_y
00570 );
00571 #endif
00572 
00573 /* TODO  : A Vérifier !
00574 void MLV_draw_rotated_image(  MLV_Image *image, int x, int y, double rotation );
00575 void MLV_draw_scaled_image(  MLV_Image *image, int x, int y, double scalar );
00576 void MLV_draw_scaled_rotated_image(  MLV_Image *image, int x, int y, double roation, double scalar );
00577 */
00578 
00579 #ifdef __cplusplus
00580 }
00581 #endif
00582 
00583 #endif