Documentation of the MLV-2.0.2 library

MLV_image.h
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 
132 MLV_Image* MLV_copy_partial_image(
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 
187 void MLV_horizontal_image_mirror( MLV_Image* image );
188 
206 void MLV_resize_image_with_proportions(
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 
257 void MLV_rotate_and_scale_xy_image(
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 
287 void MLV_draw_partial_image(
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 
341 void MLV_set_pixel_on_image(
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 
379 void MLV_get_pixel_on_image(
380  const MLV_Image* image, int x, int y,
381  int* red, int* green, int* blue, int* alpha
382 );
383 
402 void MLV_draw_partial_image_on_image(
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 
422 void MLV_draw_image_on_image(
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 
559 void MLV_draw_partial_image_on_image(
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