~ubuntu-branches/ubuntu/trusty/grafx2/trusty

« back to all changes in this revision

Viewing changes to misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Gürkan Sengün
  • Date: 2009-09-21 14:24:19 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090921142419-lhpqq102buior0ol
Tags: 2.1-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  Grafx2 - The Ultimate 256-color bitmap paint program
2
 
 
3
 
    Copyright 2007 Adrien Destugues
4
 
    Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
5
 
 
6
 
    Grafx2 is free software; you can redistribute it and/or
7
 
    modify it under the terms of the GNU General Public License
8
 
    as published by the Free Software Foundation; version 2
9
 
    of the License.
10
 
 
11
 
    Grafx2 is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
    GNU General Public License for more details.
15
 
 
16
 
    You should have received a copy of the GNU General Public License
17
 
    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
18
 
*/
19
 
//////////////////////////////////////////////////////////////////////////////
20
 
///@file misc.h
21
 
/// Miscellanous unsorted functions.
22
 
//////////////////////////////////////////////////////////////////////////////
23
 
 
24
 
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
25
 
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
26
 
void Scroll_picture(short x_offset,short y_offset);
27
 
void Wait_end_of_click(void);
28
 
void Set_color(byte color, byte red, byte green, byte blue);
29
 
void Set_palette(T_Palette palette);
30
 
void Palette_256_to_64(T_Palette palette);
31
 
void Palette_64_to_256(T_Palette palette);
32
 
void Hide_current_image(byte color);
33
 
void Hide_current_image_with_stencil(byte color, byte * stencil);
34
 
void Slider_timer(byte speed);
35
 
dword Round_div(dword numerator,dword divisor);
36
 
word Count_used_colors(dword * usage);
37
 
word Count_used_colors_area(dword* usage, word start_x, word start_y, word width, word height);
38
 
void Pixel_in_current_screen      (word x,word y,byte color);
39
 
void Pixel_in_brush             (word x,word y,byte color);
40
 
byte Read_pixel_from_current_screen  (word x,word y);
41
 
byte Read_pixel_from_spare_screen(word x,word y);
42
 
byte Read_pixel_from_backup_screen   (word x,word y);
43
 
byte Read_pixel_from_feedback_screen (word x,word y);
44
 
byte Read_pixel_from_brush         (word x,word y);
45
 
 
46
 
void Ellipse_compute_limites(short horizontal_radius,short vertical_radius);
47
 
// Calcule les valeurs suivantes en fonction des deux param�tres:
48
 
//
49
 
// Ellipse_vertical_radius_squared
50
 
// Ellipse_horizontal_radius_squared
51
 
// Ellipse_Limit_High
52
 
// Ellipse_Limit_Low
53
 
 
54
 
 
55
 
byte Pixel_in_ellipse(void);
56
 
//   Indique si le pixel se trouvant � Ellipse_cursor_X pixels
57
 
// (Ellipse_cursor_X>0 = � droite, Ellipse_cursor_X<0 = � gauche) et �
58
 
// Ellipse_cursor_Y pixels (Ellipse_cursor_Y>0 = en bas,
59
 
// Ellipse_cursor_Y<0 = en haut) du centre se trouve dans l'ellipse en
60
 
// cours.
61
 
 
62
 
byte Pixel_in_circle(void);
63
 
//   Indique si le pixel se trouvant � Circle_cursor_X pixels
64
 
// (Circle_cursor_X>0 = � droite, Circle_cursor_X<0 = � gauche) et �
65
 
// Circle_cursor_Y pixels (Circle_cursor_Y>0 = en bas,
66
 
// Circle_cursor_Y<0 = en haut) du centre se trouve dans le cercle en
67
 
// cours.
68
 
 
69
 
// Gestion du chrono dans les fileselects
70
 
void Init_chrono(dword delay);
71
 
void Check_timer(void);
72
 
 
73
 
void Replace_a_color(byte old_color, byte New_color);
74
 
void Replace_colors_within_limits(byte * replace_table);
75
 
 
76
 
byte Effect_interpolated_colorize  (word x,word y,byte color);
77
 
byte Effect_additive_colorize    (word x,word y,byte color);
78
 
byte Effect_substractive_colorize(word x,word y,byte color);
79
 
byte Effect_sieve(word x,word y);
80
 
 
81
 
///
82
 
/// Inverts a pixel buffer, according to a horizontal axis.
83
 
/// @param src    Pointer to the pixel buffer to process.
84
 
/// @param width  Width of the buffer.
85
 
/// @param height Height of the buffer.
86
 
void Flip_Y_lowlevel(byte *src, short width, short height);
87
 
 
88
 
///
89
 
/// Inverts a pixel buffer, according to a vertical axis.
90
 
/// @param src    Pointer to the pixel buffer to process.
91
 
/// @param width  Width of the buffer.
92
 
/// @param height Height of the buffer.
93
 
void Flip_X_lowlevel(byte *src, short width, short height);
94
 
///
95
 
/// Rotate a pixel buffer by 90 degrees, clockwise.
96
 
/// @param source Source pixel buffer.
97
 
/// @param dest Destination pixel buffer.
98
 
/// @param width Width of the original buffer (height of the destination one).
99
 
/// @param height Height of the original buffer (width of the destination one).
100
 
void Rotate_90_deg_lowlevel(byte * source, byte * dest, short width, short height);
101
 
///
102
 
/// Rotate a pixel buffer by 90 degrees, counter-clockwise.
103
 
/// @param source Source pixel buffer.
104
 
/// @param dest Destination pixel buffer.
105
 
/// @param width Width of the original buffer (height of the destination one).
106
 
/// @param height Height of the original buffer (width of the destination one).
107
 
void Rotate_270_deg_lowlevel(byte * source, byte * dest, short width, short height);
108
 
///
109
 
/// Rotate a pixel buffer by 180 degrees.
110
 
/// @param src The pixel buffer (source and destination).
111
 
/// @param width Width of the buffer.
112
 
/// @param height Height of the buffer.
113
 
void Rotate_180_deg_lowlevel(byte *src, short width, short height);
114
 
 
115
 
///
116
 
/// Copies an image to another, rescaling it and optionally flipping it.
117
 
/// @param src_buffer Original image (address of first byte)
118
 
/// @param src_width  Original image's width in pixels
119
 
/// @param src_height Original image's height in pixels
120
 
/// @param dst_buffer Destination image (address of first byte)
121
 
/// @param dst_width  Destination image's width in pixels
122
 
/// @param dst_height Destination image's height in pixels
123
 
/// @param x_flipped  Boolean, true to flip the image horizontally
124
 
/// @param y_flipped  Boolean, true to flip the image vertically
125
 
void Rescale(byte *src_buffer, short src_width, short src_height, byte *dst_buffer, short dst_width, short dst_height, short x_flipped, short y_flipped);
126
 
 
127
 
void Zoom_a_line(byte * original_line,byte * zoomed_line,word factor,word width);
128
 
void Copy_part_of_image_to_another(byte * source,word source_x,word source_y,word width,word height,word source_width,byte * dest,word dest_x,word dest_y,word destination_width);
129
 
 
130
 
// -- Gestion du chrono --
131
 
byte Timer_state; // State du chrono: 0=Attente d'un X�me de seconde
132
 
                  //                 1=Il faut afficher la preview
133
 
                  //                 2=Plus de chrono � gerer pour l'instant
134
 
dword Timer_delay;     // Nombre de 18.2�me de secondes demand�s
135
 
dword Timer_start;       // Heure de d�part du chrono
136
 
byte New_preview_is_needed; // Bool�en "Il faut relancer le chrono de preview"
137
 
 
138
 
 
139
 
unsigned long Memory_free(void);
140
 
 
141
 
void  Num2str(dword number,char * str,byte nb_char);
142
 
 
143
 
short Round(float value);
144
 
short Round_div_max(short numerator,short divisor);
145
 
 
146
 
int Min(int a,int b);
147
 
int Max(int a,int b);
148
 
 
149
 
char* Mode_label(int mode);
150
 
int Convert_videomode_arg(const char *argument);
 
1
/*  Grafx2 - The Ultimate 256-color bitmap paint program
 
2
 
 
3
    Copyright 2007 Adrien Destugues
 
4
    Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
 
5
 
 
6
    Grafx2 is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU General Public License
 
8
    as published by the Free Software Foundation; version 2
 
9
    of the License.
 
10
 
 
11
    Grafx2 is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU General Public License
 
17
    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
 
18
*/
 
19
//////////////////////////////////////////////////////////////////////////////
 
20
///@file misc.h
 
21
/// Miscellanous unsorted functions.
 
22
//////////////////////////////////////////////////////////////////////////////
 
23
 
 
24
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
 
25
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
 
26
void Scroll_picture(short x_offset,short y_offset);
 
27
void Wait_end_of_click(void);
 
28
void Set_color(byte color, byte red, byte green, byte blue);
 
29
void Set_palette(T_Palette palette);
 
30
void Palette_256_to_64(T_Palette palette);
 
31
void Palette_64_to_256(T_Palette palette);
 
32
void Hide_current_image(byte color);
 
33
void Hide_current_image_with_stencil(byte color, byte * stencil);
 
34
void Slider_timer(byte speed);
 
35
dword Round_div(dword numerator,dword divisor);
 
36
word Count_used_colors(dword * usage);
 
37
word Count_used_colors_area(dword* usage, word start_x, word start_y, word width, word height);
 
38
word Count_used_colors_screen_area(dword* usage, word start_x, word start_y, word width, word height);
 
39
void Pixel_in_current_screen      (word x,word y,byte color);
 
40
void Pixel_in_brush             (word x,word y,byte color);
 
41
byte Read_pixel_from_current_screen  (word x,word y);
 
42
byte Read_pixel_from_spare_screen(word x,word y);
 
43
byte Read_pixel_from_backup_screen   (word x,word y);
 
44
byte Read_pixel_from_feedback_screen (word x,word y);
 
45
byte Read_pixel_from_brush         (word x,word y);
 
46
 
 
47
void Ellipse_compute_limites(short horizontal_radius,short vertical_radius);
 
48
// Calcule les valeurs suivantes en fonction des deux param�tres:
 
49
//
 
50
// Ellipse_vertical_radius_squared
 
51
// Ellipse_horizontal_radius_squared
 
52
// Ellipse_Limit_High
 
53
// Ellipse_Limit_Low
 
54
 
 
55
 
 
56
byte Pixel_in_ellipse(void);
 
57
//   Indique si le pixel se trouvant � Ellipse_cursor_X pixels
 
58
// (Ellipse_cursor_X>0 = � droite, Ellipse_cursor_X<0 = � gauche) et �
 
59
// Ellipse_cursor_Y pixels (Ellipse_cursor_Y>0 = en bas,
 
60
// Ellipse_cursor_Y<0 = en haut) du centre se trouve dans l'ellipse en
 
61
// cours.
 
62
 
 
63
byte Pixel_in_circle(void);
 
64
//   Indique si le pixel se trouvant � Circle_cursor_X pixels
 
65
// (Circle_cursor_X>0 = � droite, Circle_cursor_X<0 = � gauche) et �
 
66
// Circle_cursor_Y pixels (Circle_cursor_Y>0 = en bas,
 
67
// Circle_cursor_Y<0 = en haut) du centre se trouve dans le cercle en
 
68
// cours.
 
69
 
 
70
// Gestion du chrono dans les fileselects
 
71
void Init_chrono(dword delay);
 
72
void Check_timer(void);
 
73
 
 
74
void Replace_a_color(byte old_color, byte New_color);
 
75
void Replace_colors_within_limits(byte * replace_table);
 
76
 
 
77
byte Effect_interpolated_colorize  (word x,word y,byte color);
 
78
byte Effect_additive_colorize    (word x,word y,byte color);
 
79
byte Effect_substractive_colorize(word x,word y,byte color);
 
80
byte Effect_sieve(word x,word y);
 
81
 
 
82
///
 
83
/// Inverts a pixel buffer, according to a horizontal axis.
 
84
/// @param src    Pointer to the pixel buffer to process.
 
85
/// @param width  Width of the buffer.
 
86
/// @param height Height of the buffer.
 
87
void Flip_Y_lowlevel(byte *src, short width, short height);
 
88
 
 
89
///
 
90
/// Inverts a pixel buffer, according to a vertical axis.
 
91
/// @param src    Pointer to the pixel buffer to process.
 
92
/// @param width  Width of the buffer.
 
93
/// @param height Height of the buffer.
 
94
void Flip_X_lowlevel(byte *src, short width, short height);
 
95
///
 
96
/// Rotate a pixel buffer by 90 degrees, clockwise.
 
97
/// @param source Source pixel buffer.
 
98
/// @param dest Destination pixel buffer.
 
99
/// @param width Width of the original buffer (height of the destination one).
 
100
/// @param height Height of the original buffer (width of the destination one).
 
101
void Rotate_90_deg_lowlevel(byte * source, byte * dest, short width, short height);
 
102
///
 
103
/// Rotate a pixel buffer by 90 degrees, counter-clockwise.
 
104
/// @param source Source pixel buffer.
 
105
/// @param dest Destination pixel buffer.
 
106
/// @param width Width of the original buffer (height of the destination one).
 
107
/// @param height Height of the original buffer (width of the destination one).
 
108
void Rotate_270_deg_lowlevel(byte * source, byte * dest, short width, short height);
 
109
///
 
110
/// Rotate a pixel buffer by 180 degrees.
 
111
/// @param src The pixel buffer (source and destination).
 
112
/// @param width Width of the buffer.
 
113
/// @param height Height of the buffer.
 
114
void Rotate_180_deg_lowlevel(byte *src, short width, short height);
 
115
 
 
116
///
 
117
/// Copies an image to another, rescaling it and optionally flipping it.
 
118
/// @param src_buffer Original image (address of first byte)
 
119
/// @param src_width  Original image's width in pixels
 
120
/// @param src_height Original image's height in pixels
 
121
/// @param dst_buffer Destination image (address of first byte)
 
122
/// @param dst_width  Destination image's width in pixels
 
123
/// @param dst_height Destination image's height in pixels
 
124
/// @param x_flipped  Boolean, true to flip the image horizontally
 
125
/// @param y_flipped  Boolean, true to flip the image vertically
 
126
void Rescale(byte *src_buffer, short src_width, short src_height, byte *dst_buffer, short dst_width, short dst_height, short x_flipped, short y_flipped);
 
127
 
 
128
void Zoom_a_line(byte * original_line,byte * zoomed_line,word factor,word width);
 
129
void Copy_part_of_image_to_another(byte * source,word source_x,word source_y,word width,word height,word source_width,byte * dest,word dest_x,word dest_y,word destination_width);
 
130
 
 
131
// -- Gestion du chrono --
 
132
byte Timer_state; // State du chrono: 0=Attente d'un X�me de seconde
 
133
                  //                 1=Il faut afficher la preview
 
134
                  //                 2=Plus de chrono � gerer pour l'instant
 
135
dword Timer_delay;     // Nombre de 18.2�me de secondes demand�s
 
136
dword Timer_start;       // Heure de d�part du chrono
 
137
byte New_preview_is_needed; // Bool�en "Il faut relancer le chrono de preview"
 
138
 
 
139
 
 
140
unsigned long Memory_free(void);
 
141
 
 
142
void  Num2str(dword number,char * str,byte nb_char);
 
143
 
 
144
short Round(float value);
 
145
short Round_div_max(short numerator,short divisor);
 
146
 
 
147
int Min(int a,int b);
 
148
int Max(int a,int b);
 
149
 
 
150
char* Mode_label(int mode);
 
151
int Convert_videomode_arg(const char *argument);