Documentation of the MLV-0.6.713 library

MLV_image.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_IMAGE_H__
00032 #define __MLV__MLV_IMAGE_H__
00033 
00034 #include "MLV_color.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00053 typedef struct _MLV_Image MLV_Image;
00054 
00076 MLV_Image* MLV_load_image( const char* file_image );
00077 
00078 
00088 int MLV_save_image_as_bmp( const MLV_Image* image,  const char* file_image );
00089 
00097 MLV_Image* MLV_create_image( int width, int height );
00098 
00104 void MLV_free_image( MLV_Image *image );
00105 
00116 MLV_Image* MLV_copy_image( const MLV_Image* image );
00117 
00132 MLV_Image* MLV_copy_partial_image(
00133         const MLV_Image* image, int x, int y, int width, int height
00134 );
00135 
00143 void MLV_get_image_size( const MLV_Image* image, int* width, int* height );
00144 
00151 int MLV_get_image_width( const MLV_Image* image );
00152 
00159 int MLV_get_image_height( const MLV_Image* image );
00160 
00161 
00173 void MLV_resize_image( MLV_Image* image, int width, int height );
00174 
00180 void MLV_vertical_image_mirror( MLV_Image* image );
00181 
00187 void MLV_horizontal_image_mirror( MLV_Image* image );
00188 
00206 void MLV_resize_image_with_proportions(
00207         MLV_Image* image, int width, int height
00208 );
00209 
00217 void MLV_scale_image( MLV_Image* image, double scalar );
00218 
00225 void MLV_rotate_image( MLV_Image* image, double rotation );
00226 
00234 void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar );
00235 
00244 void MLV_scale_xy_image( MLV_Image* image, double scalar_x, double scalar_y );
00245 
00257 void MLV_rotate_and_scale_xy_image(
00258         MLV_Image* image, double rotation, double scalar_x, double scalar_y 
00259 );
00260 
00270 void MLV_draw_image( const MLV_Image *image, int x, int y );
00271 
00287 void MLV_draw_partial_image(
00288         const MLV_Image *image, int x_source, int y_source, 
00289         int width_source, int height_source, 
00290         int x, int y
00291 );
00292 
00293 
00329 void MLV_set_alpha_on_image( MLV_Alpha alpha, MLV_Image *image );
00330 
00341 void MLV_set_pixel_on_image(
00342         int x, int y,
00343         MLV_Color color, 
00344         MLV_Image *image
00345 );
00346 
00360 void MLV_get_pixel(
00361         int x, int y, int* red, int* green, int* blue, int* alpha
00362 );
00363 
00379 void MLV_get_pixel_on_image(
00380         const MLV_Image* image, int x, int y,
00381         int* red, int* green, int* blue, int* alpha
00382 );
00383 
00402 void MLV_draw_partial_image_on_image(
00403         const MLV_Image* source_image,
00404         int source_x, int source_y,
00405         int width, int height,
00406         MLV_Image* destination_image,
00407         int destination_x, int destination_y
00408 );
00409 
00422 void MLV_draw_image_on_image(
00423         const MLV_Image* source_image,
00424         MLV_Image* destination_image,
00425         int destination_x, int destination_y
00426 );
00427 
00485 SDL_Surface* MLV_get_image_data( MLV_Image* image );
00486 
00487 // TODO
00488 #if 0
00489 
00493 typedef enum {
00494         MLV_NONE,
00495         MLV_REPLACE,
00496         MLV_MAX,
00497         MLV_MIN,
00498         MLV_BARYCENTER
00499 } MLV_Mathematic_operations;
00500 
00501 
00545 void MLV_draw_partial_image_on_image(
00546         const MLV_Image* source_image,
00547         int source_x, int source_y,
00548         int with, int height,
00549         MLV_Image* destination_image,
00550         int destination_x, int destination_y,
00551         MLV_Mathematic_operations rgb_treatment,
00552         MLV_Mathematic_operations alpha_treatment
00553 );
00554 
00590 void MLV_draw_partial_image_on_image_FAST(
00591         const MLV_Image* source_image,
00592         int source_x, int source_y,
00593         int with, int height,
00594         const MLV_Image* destination_image,
00595         int destination_x, int destination_y
00596 );
00597 #endif
00598 
00599 /* TODO  : A Vérifier !
00600 void MLV_draw_rotated_image(  MLV_Image *image, int x, int y, double rotation );
00601 void MLV_draw_scaled_image(  MLV_Image *image, int x, int y, double scalar );
00602 void MLV_draw_scaled_rotated_image(  MLV_Image *image, int x, int y, double roation, double scalar );
00603 */
00604 
00605 #ifdef __cplusplus
00606 }
00607 #endif
00608 
00609 #endif