put common fields for Main and Spare page in a T_Document structure
This commit is contained in:
parent
e9b4392691
commit
8ae651c75f
150
src/brush.c
150
src/brush.c
@ -120,7 +120,7 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
if (Mouse_K) // pas de curseur si on est en preview et
|
if (Mouse_K) // pas de curseur si on est en preview et
|
||||||
return; // en train de cliquer
|
return; // en train de cliquer
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main_current_layer < 4)
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main.current_layer < 4)
|
||||||
{
|
{
|
||||||
goto single_pixel;
|
goto single_pixel;
|
||||||
}
|
}
|
||||||
@ -154,8 +154,8 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
start_y_counter=start_y-(y-Brush_offset_Y);
|
start_y_counter=start_y-(y-Brush_offset_Y);
|
||||||
if (Paintbrush_shape==PAINTBRUSH_SHAPE_COLOR_BRUSH)
|
if (Paintbrush_shape==PAINTBRUSH_SHAPE_COLOR_BRUSH)
|
||||||
Display_brush_color(
|
Display_brush_color(
|
||||||
start_x-Main_offset_X,
|
start_x-Main.offset_X,
|
||||||
start_y-Main_offset_Y,
|
start_y-Main.offset_Y,
|
||||||
start_x_counter,
|
start_x_counter,
|
||||||
start_y_counter,
|
start_y_counter,
|
||||||
width,
|
width,
|
||||||
@ -163,8 +163,8 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
Back_color,
|
Back_color,
|
||||||
Brush_width);
|
Brush_width);
|
||||||
else // mono preview
|
else // mono preview
|
||||||
Display_brush_mono(start_x-Main_offset_X,
|
Display_brush_mono(start_x-Main.offset_X,
|
||||||
start_y-Main_offset_Y,
|
start_y-Main.offset_Y,
|
||||||
start_x_counter,
|
start_x_counter,
|
||||||
start_y_counter,
|
start_y_counter,
|
||||||
width,
|
width,
|
||||||
@ -175,7 +175,7 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
|
|
||||||
Update_part_of_screen(x-Brush_offset_X,y-Brush_offset_Y,Brush_width,Brush_height);
|
Update_part_of_screen(x-Brush_offset_X,y-Brush_offset_Y,Brush_width,Brush_height);
|
||||||
|
|
||||||
if (Main_magnifier_mode != 0)
|
if (Main.magnifier_mode != 0)
|
||||||
{
|
{
|
||||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||||
start_x_counter=start_x-(x-Brush_offset_X);
|
start_x_counter=start_x-(x-Brush_offset_X);
|
||||||
@ -183,19 +183,19 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
// Corrections dues au Zoom:
|
// Corrections dues au Zoom:
|
||||||
start_x=(start_x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
start_x=(start_x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
start_y=(start_y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
start_y=(start_y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
height=start_y+(height*Main_magnifier_factor);
|
height=start_y+(height*Main.magnifier_factor);
|
||||||
if (height>Menu_Y)
|
if (height>Menu_Y)
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
if (Paintbrush_shape==PAINTBRUSH_SHAPE_COLOR_BRUSH)
|
if (Paintbrush_shape==PAINTBRUSH_SHAPE_COLOR_BRUSH)
|
||||||
Display_brush_color_zoom(Main_X_zoom+start_x,start_y,
|
Display_brush_color_zoom(Main.X_zoom+start_x,start_y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,Back_color,
|
width,height,Back_color,
|
||||||
Brush_width,
|
Brush_width,
|
||||||
Horizontal_line_buffer);
|
Horizontal_line_buffer);
|
||||||
else // mono preview
|
else // mono preview
|
||||||
Display_brush_mono_zoom(Main_X_zoom+start_x,start_y,
|
Display_brush_mono_zoom(Main.X_zoom+start_x,start_y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,
|
width,height,
|
||||||
Back_color,Fore_color,
|
Back_color,Fore_color,
|
||||||
@ -218,14 +218,14 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
Brush=Paintbrush_sprite;
|
Brush=Paintbrush_sprite;
|
||||||
|
|
||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
Display_brush_mono(start_x-Main_offset_X,
|
Display_brush_mono(start_x-Main.offset_X,
|
||||||
start_y-Main_offset_Y,
|
start_y-Main.offset_Y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,
|
width,height,
|
||||||
0,Fore_color,
|
0,Fore_color,
|
||||||
MAX_PAINTBRUSH_SIZE);
|
MAX_PAINTBRUSH_SIZE);
|
||||||
|
|
||||||
if (Main_magnifier_mode != 0)
|
if (Main.magnifier_mode != 0)
|
||||||
{
|
{
|
||||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||||
start_x_counter=start_x-(x-Paintbrush_offset_X);
|
start_x_counter=start_x-(x-Paintbrush_offset_X);
|
||||||
@ -234,13 +234,13 @@ void Display_paintbrush(short x,short y,byte color)
|
|||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
// Corrections dues au Zoom:
|
// Corrections dues au Zoom:
|
||||||
start_x=(start_x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
start_x=(start_x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
start_y=(start_y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
start_y=(start_y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
height=start_y+(height*Main_magnifier_factor);
|
height=start_y+(height*Main.magnifier_factor);
|
||||||
if (height>Menu_Y)
|
if (height>Menu_Y)
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
|
|
||||||
Display_brush_mono_zoom(Main_X_zoom+start_x,start_y,
|
Display_brush_mono_zoom(Main.X_zoom+start_x,start_y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,
|
width,height,
|
||||||
0,Fore_color,
|
0,Fore_color,
|
||||||
@ -284,10 +284,10 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
int position;
|
int position;
|
||||||
byte old_color;
|
byte old_color;
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main_current_layer < 4)
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main.current_layer < 4)
|
||||||
{
|
{
|
||||||
// Flood-fill the enclosing area
|
// Flood-fill the enclosing area
|
||||||
if (x<Main_image_width && y<Main_image_height && x>= 0 && y >= 0
|
if (x<Main.image_width && y<Main.image_height && x>= 0 && y >= 0
|
||||||
&& (color=Effect_function(x,y,color)) != (old_color=Read_pixel_from_current_layer(x,y))
|
&& (color=Effect_function(x,y,color)) != (old_color=Read_pixel_from_current_layer(x,y))
|
||||||
&& (!((Stencil_mode) && (Stencil[old_color])))
|
&& (!((Stencil_mode) && (Stencil[old_color])))
|
||||||
&& (!((Mask_mode) && (Mask_table[Read_pixel_from_spare_screen(x,y)])))
|
&& (!((Mask_mode) && (Mask_table[Read_pixel_from_spare_screen(x,y)])))
|
||||||
@ -297,22 +297,22 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
short xx,yy;
|
short xx,yy;
|
||||||
|
|
||||||
// determine area
|
// determine area
|
||||||
switch(Main_current_layer)
|
switch(Main.current_layer)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
// Full layer
|
// Full layer
|
||||||
min_x=0;
|
min_x=0;
|
||||||
min_y=0;
|
min_y=0;
|
||||||
width=Main_image_width;
|
width=Main.image_width;
|
||||||
height=Main_image_height;
|
height=Main.image_height;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
// Line
|
// Line
|
||||||
min_x=0;
|
min_x=0;
|
||||||
min_y=y;
|
min_y=y;
|
||||||
width=Main_image_width;
|
width=Main.image_width;
|
||||||
height=1;
|
height=1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -332,12 +332,12 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
}
|
}
|
||||||
// Clip the bottom edge.
|
// Clip the bottom edge.
|
||||||
// (Necessary if image height is not a multiple)
|
// (Necessary if image height is not a multiple)
|
||||||
if (min_y+height>=Main_image_height)
|
if (min_y+height>=Main.image_height)
|
||||||
height=Main_image_height-min_y;
|
height=Main.image_height-min_y;
|
||||||
// Clip the right edge.
|
// Clip the right edge.
|
||||||
// (Necessary if image width is not a multiple)
|
// (Necessary if image width is not a multiple)
|
||||||
if (min_x+width>=Main_image_width)
|
if (min_x+width>=Main.image_width)
|
||||||
width=Main_image_width-min_x;
|
width=Main.image_width-min_x;
|
||||||
|
|
||||||
for (yy=min_y; yy<min_y+height; yy++)
|
for (yy=min_y; yy<min_y+height; yy++)
|
||||||
for (xx=min_x; xx<min_x+width; xx++)
|
for (xx=min_x; xx<min_x+width; xx++)
|
||||||
@ -349,13 +349,13 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
Compute_clipped_dimensions(&min_x,&min_y,&width,&height);
|
Compute_clipped_dimensions(&min_x,&min_y,&width,&height);
|
||||||
|
|
||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
Clear_brush(min_x-Main_offset_X,
|
Clear_brush(min_x-Main.offset_X,
|
||||||
min_y-Main_offset_Y,
|
min_y-Main.offset_Y,
|
||||||
0,0,
|
0,0,
|
||||||
width,height,0,
|
width,height,0,
|
||||||
Main_image_width);
|
Main.image_width);
|
||||||
|
|
||||||
if (Main_magnifier_mode != 0)
|
if (Main.magnifier_mode != 0)
|
||||||
{
|
{
|
||||||
Compute_clipped_dimensions_zoom(&min_x,&min_y,&width,&height);
|
Compute_clipped_dimensions_zoom(&min_x,&min_y,&width,&height);
|
||||||
xx=min_x;
|
xx=min_x;
|
||||||
@ -364,16 +364,16 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
// Corrections dues au Zoom:
|
// Corrections dues au Zoom:
|
||||||
min_x=(min_x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
min_x=(min_x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
min_y=(min_y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
min_y=(min_y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
height=min_y+(height*Main_magnifier_factor);
|
height=min_y+(height*Main.magnifier_factor);
|
||||||
if (height>Menu_Y)
|
if (height>Menu_Y)
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
|
|
||||||
Clear_brush_scaled(Main_X_zoom+min_x,min_y,
|
Clear_brush_scaled(Main.X_zoom+min_x,min_y,
|
||||||
xx,yy,
|
xx,yy,
|
||||||
width,height,0,
|
width,height,0,
|
||||||
Main_image_width,
|
Main.image_width,
|
||||||
Horizontal_line_buffer);
|
Horizontal_line_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
{
|
{
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Main_screen, start_x, start_y, width, height,
|
Main_screen, start_x, start_y, width, height,
|
||||||
Main_image_width, Smear_brush,
|
Main.image_width, Smear_brush,
|
||||||
start_x_counter, start_y_counter,
|
start_x_counter, start_y_counter,
|
||||||
Smear_brush_width
|
Smear_brush_width
|
||||||
);
|
);
|
||||||
@ -487,7 +487,7 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
Copy_part_of_image_to_another(Main_screen,
|
Copy_part_of_image_to_another(Main_screen,
|
||||||
start_x,start_y,
|
start_x,start_y,
|
||||||
width,height,
|
width,height,
|
||||||
Main_image_width,
|
Main.image_width,
|
||||||
Smear_brush,
|
Smear_brush,
|
||||||
start_x_counter,
|
start_x_counter,
|
||||||
start_y_counter,
|
start_y_counter,
|
||||||
@ -549,7 +549,7 @@ void Draw_paintbrush(short x,short y,byte color)
|
|||||||
Copy_part_of_image_to_another(Main_screen,
|
Copy_part_of_image_to_another(Main_screen,
|
||||||
start_x,start_y,
|
start_x,start_y,
|
||||||
width,height,
|
width,height,
|
||||||
Main_image_width,
|
Main.image_width,
|
||||||
Smear_brush,
|
Smear_brush,
|
||||||
start_x_counter,
|
start_x_counter,
|
||||||
start_y_counter,
|
start_y_counter,
|
||||||
@ -731,13 +731,13 @@ void Hide_paintbrush(short x,short y)
|
|||||||
start_y_counter=start_y-(y-Brush_offset_Y);
|
start_y_counter=start_y-(y-Brush_offset_Y);
|
||||||
|
|
||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
Clear_brush(start_x-Main_offset_X,
|
Clear_brush(start_x-Main.offset_X,
|
||||||
start_y-Main_offset_Y,
|
start_y-Main.offset_Y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,Back_color,
|
width,height,Back_color,
|
||||||
Main_image_width);
|
Main.image_width);
|
||||||
|
|
||||||
if (Main_magnifier_mode != 0)
|
if (Main.magnifier_mode != 0)
|
||||||
{
|
{
|
||||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||||
start_x_counter=start_x;
|
start_x_counter=start_x;
|
||||||
@ -746,16 +746,16 @@ void Hide_paintbrush(short x,short y)
|
|||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
// Corrections dues au Zoom:
|
// Corrections dues au Zoom:
|
||||||
start_x=(start_x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
start_x=(start_x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
start_y=(start_y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
start_y=(start_y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
height=start_y+(height*Main_magnifier_factor);
|
height=start_y+(height*Main.magnifier_factor);
|
||||||
if (height>Menu_Y)
|
if (height>Menu_Y)
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
|
|
||||||
Clear_brush_scaled(Main_X_zoom+start_x,start_y,
|
Clear_brush_scaled(Main.X_zoom+start_x,start_y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,Back_color,
|
width,height,Back_color,
|
||||||
Main_image_width,
|
Main.image_width,
|
||||||
Horizontal_line_buffer);
|
Horizontal_line_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -774,14 +774,14 @@ void Hide_paintbrush(short x,short y)
|
|||||||
|
|
||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
Clear_brush(start_x-Main_offset_X,
|
Clear_brush(start_x-Main.offset_X,
|
||||||
start_y-Main_offset_Y,
|
start_y-Main.offset_Y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,0,
|
width,height,0,
|
||||||
Main_image_width);
|
Main.image_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Main_magnifier_mode != 0)
|
if (Main.magnifier_mode != 0)
|
||||||
{
|
{
|
||||||
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
Compute_clipped_dimensions_zoom(&start_x,&start_y,&width,&height);
|
||||||
start_x_counter=start_x;
|
start_x_counter=start_x;
|
||||||
@ -790,16 +790,16 @@ void Hide_paintbrush(short x,short y)
|
|||||||
if ( (width>0) && (height>0) )
|
if ( (width>0) && (height>0) )
|
||||||
{
|
{
|
||||||
// Corrections dues au Zoom:
|
// Corrections dues au Zoom:
|
||||||
start_x=(start_x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
start_x=(start_x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
start_y=(start_y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
start_y=(start_y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
height=start_y+(height*Main_magnifier_factor);
|
height=start_y+(height*Main.magnifier_factor);
|
||||||
if (height>Menu_Y)
|
if (height>Menu_Y)
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
|
|
||||||
Clear_brush_scaled(Main_X_zoom+start_x,start_y,
|
Clear_brush_scaled(Main.X_zoom+start_x,start_y,
|
||||||
start_x_counter,start_y_counter,
|
start_x_counter,start_y_counter,
|
||||||
width,height,0,
|
width,height,0,
|
||||||
Main_image_width,
|
Main.image_width,
|
||||||
Horizontal_line_buffer);
|
Horizontal_line_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -837,7 +837,7 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
|
|||||||
// On ne capture la nouvelle brosse que si elle est au moins partiellement
|
// On ne capture la nouvelle brosse que si elle est au moins partiellement
|
||||||
// dans l'image:
|
// dans l'image:
|
||||||
|
|
||||||
if ((start_x<Main_image_width) && (start_y<Main_image_height))
|
if ((start_x<Main.image_width) && (start_y<Main.image_height))
|
||||||
{
|
{
|
||||||
// On met les décalages du tiling à 0 pour eviter toute incohérence.
|
// On met les décalages du tiling à 0 pour eviter toute incohérence.
|
||||||
// Si par hasard on voulait les mettre à
|
// Si par hasard on voulait les mettre à
|
||||||
@ -850,20 +850,20 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
|
|||||||
new_brush_width=(end_x-start_x)+1;
|
new_brush_width=(end_x-start_x)+1;
|
||||||
new_brush_height=(end_y-start_y)+1;
|
new_brush_height=(end_y-start_y)+1;
|
||||||
|
|
||||||
if (start_x+new_brush_width>Main_image_width)
|
if (start_x+new_brush_width>Main.image_width)
|
||||||
new_brush_width=Main_image_width-start_x;
|
new_brush_width=Main.image_width-start_x;
|
||||||
if (start_y+new_brush_height>Main_image_height)
|
if (start_y+new_brush_height>Main.image_height)
|
||||||
new_brush_height=Main_image_height-start_y;
|
new_brush_height=Main.image_height-start_y;
|
||||||
|
|
||||||
if (Realloc_brush(new_brush_width, new_brush_height, NULL, NULL))
|
if (Realloc_brush(new_brush_width, new_brush_height, NULL, NULL))
|
||||||
return; // Unable to allocate the new brush, keep the old one.
|
return; // Unable to allocate the new brush, keep the old one.
|
||||||
|
|
||||||
Copy_image_to_brush(start_x,start_y,Brush_width,Brush_height,Main_image_width);
|
Copy_image_to_brush(start_x,start_y,Brush_width,Brush_height,Main.image_width);
|
||||||
|
|
||||||
// On regarde s'il faut effacer quelque chose:
|
// On regarde s'il faut effacer quelque chose:
|
||||||
if (clear)
|
if (clear)
|
||||||
{
|
{
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
{
|
{
|
||||||
for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++)
|
for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++)
|
||||||
for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++)
|
for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++)
|
||||||
@ -882,7 +882,7 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Grab palette
|
// Grab palette
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
// Remap (no change)
|
// Remap (no change)
|
||||||
Remap_brush();
|
Remap_brush();
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ void Remap_brush(void)
|
|||||||
b=Brush_original_palette[color].B;
|
b=Brush_original_palette[color].B;
|
||||||
|
|
||||||
// When remapping to same palette, ensure we keep same color index
|
// When remapping to same palette, ensure we keep same color index
|
||||||
if (r==Main_palette[color].R && g==Main_palette[color].G && b==Main_palette[color].B)
|
if (r==Main.palette[color].R && g==Main.palette[color].G && b==Main.palette[color].B)
|
||||||
Brush_colormap[color]=color;
|
Brush_colormap[color]=color;
|
||||||
else
|
else
|
||||||
// Usual method: closest by r g b
|
// Usual method: closest by r g b
|
||||||
@ -1059,7 +1059,7 @@ void Outline_brush(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Adopt the current palette.
|
// Adopt the current palette.
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Brush_original_pixels, Brush, (long)Brush_width*Brush_height);
|
memcpy(Brush_original_pixels, Brush, (long)Brush_width*Brush_height);
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
Brush_colormap[i]=i;
|
Brush_colormap[i]=i;
|
||||||
@ -1167,7 +1167,7 @@ void Nibble_brush(void)
|
|||||||
|
|
||||||
free(old_brush);
|
free(old_brush);
|
||||||
// Adopt the current palette.
|
// Adopt the current palette.
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Brush_original_pixels, Brush, (long)Brush_width*Brush_height);
|
memcpy(Brush_original_pixels, Brush, (long)Brush_width*Brush_height);
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
Brush_colormap[i]=i;
|
Brush_colormap[i]=i;
|
||||||
@ -1222,7 +1222,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
|||||||
// On ne capture la nouvelle brosse que si elle est au moins partiellement
|
// On ne capture la nouvelle brosse que si elle est au moins partiellement
|
||||||
// dans l'image:
|
// dans l'image:
|
||||||
|
|
||||||
if ((start_x<Main_image_width) && (start_y<Main_image_height))
|
if ((start_x<Main.image_width) && (start_y<Main.image_height))
|
||||||
{
|
{
|
||||||
// On met les décalages du tiling à 0 pour eviter toute incohérence.
|
// On met les décalages du tiling à 0 pour eviter toute incohérence.
|
||||||
// Si par hasard on voulait les mettre à
|
// Si par hasard on voulait les mettre à
|
||||||
@ -1270,7 +1270,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
|||||||
// On regarde s'il faut effacer quelque chose:
|
// On regarde s'il faut effacer quelque chose:
|
||||||
if (clear)
|
if (clear)
|
||||||
{
|
{
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
{
|
{
|
||||||
Tilemap_draw(x_pos,y_pos,Back_color);
|
Tilemap_draw(x_pos,y_pos,Back_color);
|
||||||
}
|
}
|
||||||
@ -1284,7 +1284,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
|
|||||||
Update_part_of_screen(start_x,start_y,end_x-start_x+1,end_y-start_y+1);
|
Update_part_of_screen(start_x,start_y,end_x-start_x+1,end_y-start_y+1);
|
||||||
|
|
||||||
// Grab palette
|
// Grab palette
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
// Init colormap
|
// Init colormap
|
||||||
for (temp=0; temp<256; temp++)
|
for (temp=0; temp<256; temp++)
|
||||||
Brush_colormap[temp]=temp;
|
Brush_colormap[temp]=temp;
|
||||||
@ -2134,9 +2134,9 @@ void Brush_set_palette(T_Palette *palette)
|
|||||||
memcpy(Brush_original_palette,palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette,palette,sizeof(T_Palette));
|
||||||
for (i=0;i<256;i++)
|
for (i=0;i<256;i++)
|
||||||
{
|
{
|
||||||
if (Brush_original_palette[i].R!=Main_palette[i].R
|
if (Brush_original_palette[i].R!=Main.palette[i].R
|
||||||
|| Brush_original_palette[i].G!=Main_palette[i].G
|
|| Brush_original_palette[i].G!=Main.palette[i].G
|
||||||
|| Brush_original_palette[i].B!=Main_palette[i].B)
|
|| Brush_original_palette[i].B!=Main.palette[i].B)
|
||||||
{
|
{
|
||||||
need_remap=1;
|
need_remap=1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,21 +85,21 @@ void Magnifier_12_0(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// On passe en mode loupe
|
// On passe en mode loupe
|
||||||
Main_magnifier_mode=1;
|
Main.magnifier_mode=1;
|
||||||
|
|
||||||
// La fonction d'affichage dans la partie image est désormais un affichage
|
// La fonction d'affichage dans la partie image est désormais un affichage
|
||||||
// spécial loupe.
|
// spécial loupe.
|
||||||
Pixel_preview=Pixel_preview_magnifier;
|
Pixel_preview=Pixel_preview_magnifier;
|
||||||
|
|
||||||
// On calcule l'origine de la loupe
|
// On calcule l'origine de la loupe
|
||||||
Main_magnifier_offset_X=Mouse_X-(Main_magnifier_width>>1);
|
Main.magnifier_offset_X=Mouse_X-(Main.magnifier_width>>1);
|
||||||
Main_magnifier_offset_Y=Mouse_Y-(Main_magnifier_height>>1);
|
Main.magnifier_offset_Y=Mouse_Y-(Main.magnifier_height>>1);
|
||||||
|
|
||||||
// Calcul des coordonnées absolues de ce coin DANS L'IMAGE
|
// Calcul des coordonnées absolues de ce coin DANS L'IMAGE
|
||||||
Main_magnifier_offset_X+=Main_offset_X;
|
Main.magnifier_offset_X+=Main.offset_X;
|
||||||
Main_magnifier_offset_Y+=Main_offset_Y;
|
Main.magnifier_offset_Y+=Main.offset_Y;
|
||||||
|
|
||||||
Clip_magnifier_offsets(&Main_magnifier_offset_X, &Main_magnifier_offset_Y);
|
Clip_magnifier_offsets(&Main.magnifier_offset_X, &Main.magnifier_offset_Y);
|
||||||
|
|
||||||
// On calcule les bornes visibles dans l'écran
|
// On calcule les bornes visibles dans l'écran
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
@ -154,8 +154,8 @@ void Colorpicker_1_1(void)
|
|||||||
char str[4];
|
char str[4];
|
||||||
|
|
||||||
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
||||||
&& (Paintbrush_X<Main_image_width)
|
&& (Paintbrush_X<Main.image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height) )
|
&& (Paintbrush_Y<Main.image_height) )
|
||||||
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
||||||
else
|
else
|
||||||
Colorpicker_color=0;
|
Colorpicker_color=0;
|
||||||
@ -196,8 +196,8 @@ void Colorpicker_2_1(void)
|
|||||||
char str[4];
|
char str[4];
|
||||||
|
|
||||||
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
||||||
&& (Paintbrush_X<Main_image_width)
|
&& (Paintbrush_X<Main.image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height) )
|
&& (Paintbrush_Y<Main.image_height) )
|
||||||
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
||||||
else
|
else
|
||||||
Colorpicker_color=0;
|
Colorpicker_color=0;
|
||||||
@ -300,8 +300,8 @@ void Rightclick_colorpick_2_1(void)
|
|||||||
|| (Colorpicker_Y!=Paintbrush_Y) )
|
|| (Colorpicker_Y!=Paintbrush_Y) )
|
||||||
{
|
{
|
||||||
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
||||||
&& (Paintbrush_X<Main_image_width)
|
&& (Paintbrush_X<Main.image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height) )
|
&& (Paintbrush_Y<Main.image_height) )
|
||||||
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
||||||
else
|
else
|
||||||
Colorpicker_color=0;
|
Colorpicker_color=0;
|
||||||
@ -343,7 +343,7 @@ void Rightclick_colorpick_0_1(void)
|
|||||||
// Erase the color block which shows the picked color
|
// Erase the color block which shows the picked color
|
||||||
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ",0);
|
Print_in_menu("X: Y: ",0);
|
||||||
|
|
||||||
Print_coordinates();
|
Print_coordinates();
|
||||||
@ -1156,7 +1156,7 @@ void Draw_stretch_spot(short x_pos, short y_pos)
|
|||||||
if (y>=Limit_top && y<=Limit_visible_bottom)
|
if (y>=Limit_top && y<=Limit_visible_bottom)
|
||||||
for (x=x_pos-1;x<x_pos+1;x++)
|
for (x=x_pos-1;x<x_pos+1;x++)
|
||||||
if (x>=Limit_left && x<=Limit_visible_right)
|
if (x>=Limit_left && x<=Limit_visible_right)
|
||||||
Pixel_preview(x,y,xor_lut[Read_pixel(x-Main_offset_X,y-Main_offset_Y)]);
|
Pixel_preview(x,y,xor_lut[Read_pixel(x-Main.offset_X,y-Main.offset_Y)]);
|
||||||
Update_part_of_screen(x_pos-1, y_pos-1, 2, 2);
|
Update_part_of_screen(x_pos-1, y_pos-1, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
323
src/buttons.c
323
src/buttons.c
@ -204,7 +204,7 @@ void Button_Message_initial(void)
|
|||||||
}
|
}
|
||||||
// Modify the mode for the spare too
|
// Modify the mode for the spare too
|
||||||
Spare_backups->Pages->Image_mode = Main_backups->Pages->Image_mode;
|
Spare_backups->Pages->Image_mode = Main_backups->Pages->Image_mode;
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
}
|
}
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -238,13 +238,13 @@ void Button_Undo(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Undo();
|
Undo();
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Unselect_button(BUTTON_UNDO);
|
Unselect_button(BUTTON_UNDO);
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
Display_menu();
|
Display_menu();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
@ -253,13 +253,13 @@ void Button_Redo(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Redo();
|
Redo();
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Unselect_button(BUTTON_UNDO);
|
Unselect_button(BUTTON_UNDO);
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
Display_menu();
|
Display_menu();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
@ -430,31 +430,31 @@ void Button_Hide_menu(void)
|
|||||||
Menu_is_visible=0;
|
Menu_is_visible=0;
|
||||||
Menu_Y=Screen_height;
|
Menu_Y=Screen_height;
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
// On repositionne le décalage de l'image pour qu'il n'y ait pas d'in-
|
// On repositionne le décalage de l'image pour qu'il n'y ait pas d'in-
|
||||||
// -cohérences lorsqu'on sortira du mode Loupe.
|
// -cohérences lorsqu'on sortira du mode Loupe.
|
||||||
if (Main_offset_Y+Screen_height>Main_image_height)
|
if (Main.offset_Y+Screen_height>Main.image_height)
|
||||||
{
|
{
|
||||||
if (Screen_height>Main_image_height)
|
if (Screen_height>Main.image_height)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
else
|
else
|
||||||
Main_offset_Y=Main_image_height-Screen_height;
|
Main.offset_Y=Main.image_height-Screen_height;
|
||||||
}
|
}
|
||||||
// On fait pareil pour le brouillon
|
// On fait pareil pour le brouillon
|
||||||
if (Spare_offset_Y+Screen_height>Spare_image_height)
|
if (Spare.offset_Y+Screen_height>Spare.image_height)
|
||||||
{
|
{
|
||||||
if (Screen_height>Spare_image_height)
|
if (Screen_height>Spare.image_height)
|
||||||
Spare_offset_Y=0;
|
Spare.offset_Y=0;
|
||||||
else
|
else
|
||||||
Spare_offset_Y=Spare_image_height-Screen_height;
|
Spare.offset_Y=Spare.image_height-Screen_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
@ -470,12 +470,12 @@ void Button_Hide_menu(void)
|
|||||||
Menu_Y -= Menu_bars[current_menu].Height * Menu_factor_Y;
|
Menu_Y -= Menu_bars[current_menu].Height * Menu_factor_Y;
|
||||||
|
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
Display_menu();
|
Display_menu();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
Unselect_button(BUTTON_HIDE);
|
Unselect_button(BUTTON_HIDE);
|
||||||
@ -603,7 +603,7 @@ byte Button_Quit_local_function(void)
|
|||||||
static char filename[MAX_PATH_CHARACTERS];
|
static char filename[MAX_PATH_CHARACTERS];
|
||||||
byte old_cursor_shape;
|
byte old_cursor_shape;
|
||||||
|
|
||||||
if (!Main_image_is_modified)
|
if (!Main.image_is_modified)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
// On commence par afficher la fenêtre de QUIT
|
// On commence par afficher la fenêtre de QUIT
|
||||||
@ -671,7 +671,7 @@ void Button_Quit(void)
|
|||||||
|
|
||||||
if (Button_Quit_local_function())
|
if (Button_Quit_local_function())
|
||||||
{
|
{
|
||||||
if (Spare_image_is_modified)
|
if (Spare.image_is_modified)
|
||||||
{
|
{
|
||||||
Button_Page(); // On passe sur le brouillon
|
Button_Page(); // On passe sur le brouillon
|
||||||
// Si l'utilisateur présente les derniers symptomes de l'abandon
|
// Si l'utilisateur présente les derniers symptomes de l'abandon
|
||||||
@ -1168,10 +1168,10 @@ void Button_Settings(void)
|
|||||||
{
|
{
|
||||||
// Reset fileselector offsets
|
// Reset fileselector offsets
|
||||||
// since different files are shown now
|
// since different files are shown now
|
||||||
Main_selector.Position=0;
|
Main.selector.Position=0;
|
||||||
Main_selector.Offset=0;
|
Main.selector.Offset=0;
|
||||||
Spare_selector.Position=0;
|
Spare.selector.Position=0;
|
||||||
Spare_selector.Offset=0;
|
Spare.selector.Offset=0;
|
||||||
Brush_selector.Position=0;
|
Brush_selector.Position=0;
|
||||||
Brush_selector.Offset=0;
|
Brush_selector.Offset=0;
|
||||||
}
|
}
|
||||||
@ -1184,7 +1184,7 @@ void Button_Settings(void)
|
|||||||
Config=selected_config;
|
Config=selected_config;
|
||||||
|
|
||||||
if (config_is_reloaded)
|
if (config_is_reloaded)
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
Close_window();
|
Close_window();
|
||||||
Unselect_button(BUTTON_SETTINGS);
|
Unselect_button(BUTTON_SETTINGS);
|
||||||
@ -1514,12 +1514,12 @@ void Button_Skins(void)
|
|||||||
|
|
||||||
// Now find the best colors for the new skin in the current palette
|
// Now find the best colors for the new skin in the current palette
|
||||||
// and remap the skin
|
// and remap the skin
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't want to keep the skin's palette, as this would corrupt the current picture's one.
|
// We don't want to keep the skin's palette, as this would corrupt the current picture's one.
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
|
|
||||||
Close_window();
|
Close_window();
|
||||||
Unselect_button(BUTTON_SETTINGS);
|
Unselect_button(BUTTON_SETTINGS);
|
||||||
@ -1534,7 +1534,7 @@ void Button_Skins(void)
|
|||||||
switch(button)
|
switch(button)
|
||||||
{
|
{
|
||||||
case BUTTON_MAGNIFIER:
|
case BUTTON_MAGNIFIER:
|
||||||
state|=Main_magnifier_mode;
|
state|=Main.magnifier_mode;
|
||||||
break;
|
break;
|
||||||
case BUTTON_EFFECTS:
|
case BUTTON_EFFECTS:
|
||||||
state|=Any_effect_active();
|
state|=Any_effect_active();
|
||||||
@ -1564,74 +1564,75 @@ void Button_Page(void)
|
|||||||
Swap_tilemap();
|
Swap_tilemap();
|
||||||
|
|
||||||
// On fait le reste du travail "à la main":
|
// On fait le reste du travail "à la main":
|
||||||
SWAP_PBYTES(Main_visible_image.Image,Spare_visible_image.Image)
|
// TODO
|
||||||
SWAP_WORDS (Main_visible_image.Width,Spare_visible_image.Width)
|
SWAP_PBYTES(Main_visible_image.Image,Spare_visible_image.Image)// !
|
||||||
SWAP_WORDS (Main_visible_image.Height,Spare_visible_image.Height)
|
SWAP_WORDS (Main_visible_image.Width,Spare_visible_image.Width)// !
|
||||||
SWAP_SHORTS(Main_offset_X,Spare_offset_X)
|
SWAP_WORDS (Main_visible_image.Height,Spare_visible_image.Height)// !
|
||||||
SWAP_SHORTS(Main_offset_Y,Spare_offset_Y)
|
SWAP_SHORTS(Main.offset_X,Spare.offset_X)
|
||||||
SWAP_SHORTS(Main_separator_position,Spare_separator_position)
|
SWAP_SHORTS(Main.offset_Y,Spare.offset_Y)
|
||||||
SWAP_SHORTS(Main_X_zoom,Spare_X_zoom)
|
SWAP_SHORTS(Main.separator_position,Spare.separator_position)
|
||||||
SWAP_FLOATS(Main_separator_proportion,Spare_separator_proportion)
|
SWAP_SHORTS(Main.X_zoom,Spare.X_zoom)
|
||||||
SWAP_BYTES (Main_magnifier_mode,Spare_magnifier_mode)
|
SWAP_FLOATS(Main.separator_proportion,Spare.separator_proportion)
|
||||||
|
SWAP_BYTES (Main.magnifier_mode,Spare.magnifier_mode)
|
||||||
|
|
||||||
Pixel_preview=(Main_magnifier_mode)?Pixel_preview_magnifier:Pixel_preview_normal;
|
Pixel_preview=(Main.magnifier_mode)?Pixel_preview_magnifier:Pixel_preview_normal;
|
||||||
|
|
||||||
SWAP_WORDS (Main_magnifier_factor,Spare_magnifier_factor)
|
SWAP_WORDS (Main.magnifier_factor,Spare.magnifier_factor)
|
||||||
SWAP_WORDS (Main_magnifier_height,Spare_magnifier_height)
|
SWAP_WORDS (Main.magnifier_height,Spare.magnifier_height)
|
||||||
SWAP_WORDS (Main_magnifier_width,Spare_magnifier_width)
|
SWAP_WORDS (Main.magnifier_width,Spare.magnifier_width)
|
||||||
SWAP_SHORTS(Main_magnifier_offset_X,Spare_magnifier_offset_X)
|
SWAP_SHORTS(Main.magnifier_offset_X,Spare.magnifier_offset_X)
|
||||||
SWAP_SHORTS(Main_magnifier_offset_Y,Spare_magnifier_offset_Y)
|
SWAP_SHORTS(Main.magnifier_offset_Y,Spare.magnifier_offset_Y)
|
||||||
// Swap du booléen "Image modifiée"
|
// Swap du booléen "Image modifiée"
|
||||||
SWAP_BYTES (Main_image_is_modified,Spare_image_is_modified)
|
SWAP_BYTES (Main.image_is_modified,Spare.image_is_modified)
|
||||||
|
|
||||||
// Swap fileselector data
|
// Swap fileselector data
|
||||||
SWAP_BYTES (Main_selector.Format_filter,Spare_selector.Format_filter)
|
SWAP_BYTES (Main.selector.Format_filter,Spare.selector.Format_filter)
|
||||||
SWAP_WORDS (Main_selector.Position,Spare_selector.Position)
|
SWAP_WORDS (Main.selector.Position,Spare.selector.Position)
|
||||||
SWAP_WORDS (Main_selector.Offset,Spare_selector.Offset)
|
SWAP_WORDS (Main.selector.Offset,Spare.selector.Offset)
|
||||||
strcpy(Temp_buffer ,Spare_selector.Directory);
|
strcpy(Temp_buffer ,Spare.selector.Directory);
|
||||||
strcpy(Spare_selector.Directory,Main_selector.Directory);
|
strcpy(Spare.selector.Directory,Main.selector.Directory);
|
||||||
strcpy(Main_selector.Directory,Temp_buffer );
|
strcpy(Main.selector.Directory,Temp_buffer );
|
||||||
|
|
||||||
|
|
||||||
SWAP_BYTES (Main_current_layer,Spare_current_layer)
|
SWAP_BYTES (Main.current_layer,Spare.current_layer)
|
||||||
SWAP_DWORDS(Main_layers_visible,Spare_layers_visible)
|
SWAP_DWORDS(Main.layers_visible,Spare.layers_visible)
|
||||||
SWAP_DWORDS(Main_layers_visible_backup,Spare_layers_visible_backup)
|
SWAP_DWORDS(Main.layers_visible_backup,Spare.layers_visible_backup)
|
||||||
|
|
||||||
SWAP_DWORDS(Main_safety_number,Spare_safety_number)
|
SWAP_DWORDS(Main.safety_number,Spare.safety_number)
|
||||||
SWAP_DWORDS(Main_edits_since_safety_backup,Spare_edits_since_safety_backup)
|
SWAP_DWORDS(Main.edits_since_safety_backup,Spare.edits_since_safety_backup)
|
||||||
SWAP_BYTES(Main_safety_backup_prefix,Spare_safety_backup_prefix)
|
SWAP_BYTES(Main.safety_backup_prefix,Spare.safety_backup_prefix)
|
||||||
{
|
{
|
||||||
Uint32 a;
|
Uint32 a;
|
||||||
a=Main_time_of_safety_backup;
|
a=Main.time_of_safety_backup;
|
||||||
Main_time_of_safety_backup=Spare_time_of_safety_backup;
|
Main.time_of_safety_backup=Spare.time_of_safety_backup;
|
||||||
Spare_time_of_safety_backup=a;
|
Spare.time_of_safety_backup=a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Redraw_layered_image();
|
//Redraw_layered_image();
|
||||||
// replaced by
|
// replaced by
|
||||||
Update_buffers(Main_image_width, Main_image_height);
|
Update_buffers(Main.image_width, Main.image_height);
|
||||||
Update_depth_buffer();
|
Update_depth_buffer();
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
// --
|
// --
|
||||||
|
|
||||||
// A la fin, on affiche l'écran
|
// A la fin, on affiche l'écran
|
||||||
for (factor_index=0; ZOOM_FACTOR[factor_index]!=Main_magnifier_factor; factor_index++);
|
for (factor_index=0; ZOOM_FACTOR[factor_index]!=Main.magnifier_factor; factor_index++);
|
||||||
//Change_magnifier_factor(factor_index,0);
|
//Change.magnifier_factor(factor_index,0);
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Pixel_preview=Pixel_preview_magnifier;
|
Pixel_preview=Pixel_preview_magnifier;
|
||||||
else
|
else
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Unselect_button(BUTTON_PAGE);
|
Unselect_button(BUTTON_PAGE);
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
// Tilemap mode might be different
|
// Tilemap mode might be different
|
||||||
Draw_menu_button(BUTTON_EFFECTS,Any_effect_active());
|
Draw_menu_button(BUTTON_EFFECTS,Any_effect_active());
|
||||||
Display_menu();
|
Display_menu();
|
||||||
@ -1644,27 +1645,27 @@ void Button_Page(void)
|
|||||||
|
|
||||||
void Copy_image_only(void)
|
void Copy_image_only(void)
|
||||||
{
|
{
|
||||||
word old_width=Spare_image_width;
|
word old_width=Spare.image_width;
|
||||||
word old_height=Spare_image_height;
|
word old_height=Spare.image_height;
|
||||||
|
|
||||||
if (Backup_and_resize_the_spare(Main_image_width,Main_image_height))
|
if (Backup_and_resize_the_spare(Main.image_width,Main.image_height))
|
||||||
{
|
{
|
||||||
byte i;
|
byte i;
|
||||||
|
|
||||||
for (i=0; i<Spare_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Spare_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
if (i == Spare_current_layer)
|
if (i == Spare.current_layer)
|
||||||
{
|
{
|
||||||
// Copy the current layer
|
// Copy the current layer
|
||||||
memcpy(Spare_backups->Pages->Image[i].Pixels,Main_backups->Pages->Image[Main_current_layer].Pixels,Main_image_width*Main_image_height);
|
memcpy(Spare_backups->Pages->Image[i].Pixels,Main_backups->Pages->Image[Main.current_layer].Pixels,Main.image_width*Main.image_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Resize the original layer
|
// Resize the original layer
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Spare_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Spare_image_width),
|
Spare_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Spare.image_width),
|
||||||
Min(old_height,Spare_image_height),old_width,
|
Min(old_height,Spare.image_height),old_width,
|
||||||
Spare_backups->Pages->Image[i].Pixels,0,0,Spare_image_width);
|
Spare_backups->Pages->Image[i].Pixels,0,0,Spare.image_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1674,8 +1675,8 @@ void Copy_image_only(void)
|
|||||||
ces valeurs pour qu'elles soient correctes.
|
ces valeurs pour qu'elles soient correctes.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Spare_image_width=Main_image_width;
|
Spare.image_width=Main.image_width;
|
||||||
Spare_image_height=Main_image_height;
|
Spare.image_height=Main.image_height;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Copy_view_to_spare();
|
Copy_view_to_spare();
|
||||||
@ -1687,7 +1688,7 @@ void Copy_image_only(void)
|
|||||||
// (It's the same reason that the "Page" function gets complex,
|
// (It's the same reason that the "Page" function gets complex,
|
||||||
// it needs to rebuild a depth buffer only, trusting the
|
// it needs to rebuild a depth buffer only, trusting the
|
||||||
// depth buffer that was already available in Spare_.)
|
// depth buffer that was already available in Spare_.)
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1712,7 +1713,7 @@ void Copy_some_colors(void)
|
|||||||
for (index=0; index<256; index++)
|
for (index=0; index<256; index++)
|
||||||
{
|
{
|
||||||
if (mask_color_to_copy[index])
|
if (mask_color_to_copy[index])
|
||||||
memcpy(Spare_palette+index,Main_palette+index,
|
memcpy(Spare.palette+index,Main.palette+index,
|
||||||
sizeof(T_Components));
|
sizeof(T_Components));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1755,12 +1756,12 @@ void Button_Copy_page(void)
|
|||||||
// backup is done by the following function
|
// backup is done by the following function
|
||||||
Copy_image_only();
|
Copy_image_only();
|
||||||
// copie de la palette
|
// copie de la palette
|
||||||
memcpy(Spare_palette,Main_palette,sizeof(T_Palette));
|
memcpy(Spare.palette,Main.palette,sizeof(T_Palette));
|
||||||
// Equivalent of 'end_of_modifications' for spare.
|
// Equivalent of 'end_of_modifications' for spare.
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
if (Spare_tilemap_mode)
|
if (Spare.tilemap_mode)
|
||||||
Disable_spare_tilemap();
|
Disable_spare_tilemap();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1768,21 +1769,21 @@ void Button_Copy_page(void)
|
|||||||
// backup is done by the following function
|
// backup is done by the following function
|
||||||
Copy_image_only();
|
Copy_image_only();
|
||||||
// Equivalent of 'end_of_modifications' for spare.
|
// Equivalent of 'end_of_modifications' for spare.
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
if (Spare_tilemap_mode)
|
if (Spare.tilemap_mode)
|
||||||
Disable_spare_tilemap();
|
Disable_spare_tilemap();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Palette only
|
case 3: // Palette only
|
||||||
Backup_the_spare(LAYER_NONE);
|
Backup_the_spare(LAYER_NONE);
|
||||||
// Copy palette
|
// Copy palette
|
||||||
memcpy(Spare_palette,Main_palette,sizeof(T_Palette));
|
memcpy(Spare.palette,Main.palette,sizeof(T_Palette));
|
||||||
// Equivalent of 'end_of_modifications' for spare.
|
// Equivalent of 'end_of_modifications' for spare.
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Some colors
|
case 4: // Some colors
|
||||||
@ -1794,11 +1795,11 @@ void Button_Copy_page(void)
|
|||||||
Backup_the_spare(LAYER_ALL);
|
Backup_the_spare(LAYER_ALL);
|
||||||
Remap_spare();
|
Remap_spare();
|
||||||
// Copy palette
|
// Copy palette
|
||||||
memcpy(Spare_palette,Main_palette,sizeof(T_Palette));
|
memcpy(Spare.palette,Main.palette,sizeof(T_Palette));
|
||||||
// Equivalent of 'end_of_modifications' for spare.
|
// Equivalent of 'end_of_modifications' for spare.
|
||||||
Update_spare_buffers(Spare_image_width,Spare_image_height);
|
Update_spare_buffers(Spare.image_width,Spare.image_height);
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1825,12 +1826,12 @@ void Button_Kill(void)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Free_current_page();
|
Free_current_page();
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Unselect_button(BUTTON_KILL);
|
Unselect_button(BUTTON_KILL);
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
Display_menu();
|
Display_menu();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
@ -2029,11 +2030,11 @@ void Button_Resolution(void)
|
|||||||
Check_mode_button(184,172,3);
|
Check_mode_button(184,172,3);
|
||||||
|
|
||||||
|
|
||||||
chosen_width=Main_image_width;
|
chosen_width=Main.image_width;
|
||||||
Num2str(chosen_width,str,4);
|
Num2str(chosen_width,str,4);
|
||||||
Window_input_content(input_width_button,str);
|
Window_input_content(input_width_button,str);
|
||||||
|
|
||||||
chosen_height=Main_image_height;
|
chosen_height=Main.image_height;
|
||||||
Num2str(chosen_height,str,4);
|
Num2str(chosen_height,str,4);
|
||||||
Window_input_content(input_button_height,str);
|
Window_input_content(input_button_height,str);
|
||||||
|
|
||||||
@ -2216,11 +2217,11 @@ void Button_Resolution(void)
|
|||||||
|
|
||||||
if (clicked_button==1) // OK
|
if (clicked_button==1) // OK
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Unselect_button(BUTTON_MAGNIFIER);
|
Unselect_button(BUTTON_MAGNIFIER);
|
||||||
|
|
||||||
if ( (chosen_width!=Main_image_width)
|
if ( (chosen_width!=Main.image_width)
|
||||||
|| (chosen_height!=Main_image_height) )
|
|| (chosen_height!=Main.image_height) )
|
||||||
{
|
{
|
||||||
Resize_image(chosen_width,chosen_height);
|
Resize_image(chosen_width,chosen_height);
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
@ -2636,7 +2637,7 @@ void Button_Gradients(void)
|
|||||||
{
|
{
|
||||||
Allow_colorcycling=0;
|
Allow_colorcycling=0;
|
||||||
// Restore palette
|
// Restore palette
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(clicked_button)
|
switch(clicked_button)
|
||||||
@ -2849,7 +2850,7 @@ void Button_Fill(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ",0);
|
Print_in_menu("X: Y: ",0);
|
||||||
Start_operation_stack(OPERATION_FILL);
|
Start_operation_stack(OPERATION_FILL);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -2868,7 +2869,7 @@ void Button_Replace(void)
|
|||||||
Paintbrush_shape=PAINTBRUSH_SHAPE_POINT;
|
Paintbrush_shape=PAINTBRUSH_SHAPE_POINT;
|
||||||
}
|
}
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ( )",0);
|
Print_in_menu("X: Y: ( )",0);
|
||||||
Start_operation_stack(OPERATION_REPLACE);
|
Start_operation_stack(OPERATION_REPLACE);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -2882,7 +2883,7 @@ void Button_Unselect_fill(void)
|
|||||||
|
|
||||||
if (Current_operation==OPERATION_REPLACE)
|
if (Current_operation==OPERATION_REPLACE)
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ",0);
|
Print_in_menu("X: Y: ",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3093,13 +3094,13 @@ int Best_video_mode(void)
|
|||||||
|
|
||||||
// On commence par borner les dimensions, ou du moins les rendre cohérentes
|
// On commence par borner les dimensions, ou du moins les rendre cohérentes
|
||||||
if ((Original_screen_X<=0) || (Config.Set_resolution_according_to==2))
|
if ((Original_screen_X<=0) || (Config.Set_resolution_according_to==2))
|
||||||
Original_screen_X=Main_image_width;
|
Original_screen_X=Main.image_width;
|
||||||
else
|
else
|
||||||
if (Original_screen_X<320)
|
if (Original_screen_X<320)
|
||||||
Original_screen_X=320;
|
Original_screen_X=320;
|
||||||
|
|
||||||
if ((Original_screen_Y<=0) || (Config.Set_resolution_according_to==2))
|
if ((Original_screen_Y<=0) || (Config.Set_resolution_according_to==2))
|
||||||
Original_screen_Y=Main_image_height;
|
Original_screen_Y=Main.image_height;
|
||||||
else
|
else
|
||||||
if (Original_screen_Y<200)
|
if (Original_screen_Y<200)
|
||||||
Original_screen_Y=200;
|
Original_screen_Y=200;
|
||||||
@ -3167,13 +3168,13 @@ void Load_picture(byte image)
|
|||||||
strcpy(directory, Brush_file_directory);
|
strcpy(directory, Brush_file_directory);
|
||||||
Init_context_brush(&context, filename, directory);
|
Init_context_brush(&context, filename, directory);
|
||||||
}
|
}
|
||||||
confirm=Button_Load_or_Save(image?&Main_selector:&Brush_selector, 1, &context);
|
confirm=Button_Load_or_Save(image?&Main.selector:&Brush_selector, 1, &context);
|
||||||
|
|
||||||
if (confirm)
|
if (confirm)
|
||||||
{
|
{
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
if (Main_image_is_modified)
|
if (Main.image_is_modified)
|
||||||
confirm=Confirmation_box("Discard unsaved changes?");
|
confirm=Confirmation_box("Discard unsaved changes?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3225,20 +3226,20 @@ void Load_picture(byte image)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( (File_error==1) || (Get_fileformat(Main_fileformat)->Palette_only) )
|
if ( (File_error==1) || (Get_fileformat(Main.fileformat)->Palette_only) )
|
||||||
{
|
{
|
||||||
if (File_error!=1)
|
if (File_error!=1)
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_mode=Best_video_mode();
|
new_mode=Best_video_mode();
|
||||||
@ -3268,18 +3269,18 @@ void Load_picture(byte image)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
}
|
}
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3292,7 +3293,7 @@ void Load_picture(byte image)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Print_filename();
|
Print_filename();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3316,7 +3317,7 @@ void Button_Reload(void)
|
|||||||
// restituer en cas d'erreur n'affectant pas l'image
|
// restituer en cas d'erreur n'affectant pas l'image
|
||||||
Upload_infos_page_main(Main_backups->Pages);
|
Upload_infos_page_main(Main_backups->Pages);
|
||||||
|
|
||||||
if ( (!Main_image_is_modified) || Confirmation_box("Discard unsaved changes ?") )
|
if ( (!Main.image_is_modified) || Confirmation_box("Discard unsaved changes ?") )
|
||||||
{
|
{
|
||||||
T_IO_Context context;
|
T_IO_Context context;
|
||||||
|
|
||||||
@ -3336,11 +3337,11 @@ void Button_Reload(void)
|
|||||||
|
|
||||||
if (File_error!=1)
|
if (File_error!=1)
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Draw_menu_button(BUTTON_MAGNIFIER,Main_magnifier_mode);
|
Draw_menu_button(BUTTON_MAGNIFIER,Main.magnifier_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_mode=Best_video_mode();
|
new_mode=Best_video_mode();
|
||||||
@ -3371,8 +3372,8 @@ void Button_Reload(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
}
|
}
|
||||||
@ -3382,14 +3383,14 @@ void Button_Reload(void)
|
|||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
|
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
}
|
}
|
||||||
Destroy_context(&context);
|
Destroy_context(&context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Display_menu();
|
Display_menu();
|
||||||
if (Config.Display_image_limits)
|
if (Config.Display_image_limits)
|
||||||
Display_image_limits();
|
Display_image_limits();
|
||||||
@ -3451,7 +3452,7 @@ void Save_picture(enum CONTEXT_TYPE type)
|
|||||||
strcpy(filename, Main_backups->Pages->Filename);
|
strcpy(filename, Main_backups->Pages->Filename);
|
||||||
strcpy(directory, Main_backups->Pages->File_directory);
|
strcpy(directory, Main_backups->Pages->File_directory);
|
||||||
Init_context_layered_image(&save_context, filename, directory);
|
Init_context_layered_image(&save_context, filename, directory);
|
||||||
save_context.Format = Main_fileformat;
|
save_context.Format = Main.fileformat;
|
||||||
}
|
}
|
||||||
else if (type == CONTEXT_BRUSH)
|
else if (type == CONTEXT_BRUSH)
|
||||||
{
|
{
|
||||||
@ -3481,7 +3482,7 @@ void Save_picture(enum CONTEXT_TYPE type)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
confirm=Button_Load_or_Save((type==CONTEXT_MAIN_IMAGE)?&Main_selector:&Brush_selector,0, &save_context);
|
confirm=Button_Load_or_Save((type==CONTEXT_MAIN_IMAGE)?&Main.selector:&Brush_selector,0, &save_context);
|
||||||
|
|
||||||
if (confirm && File_exists(save_context.File_name))
|
if (confirm && File_exists(save_context.File_name))
|
||||||
{
|
{
|
||||||
@ -3511,8 +3512,8 @@ void Save_picture(enum CONTEXT_TYPE type)
|
|||||||
format=Get_fileformat(save_context.Format);
|
format=Get_fileformat(save_context.Format);
|
||||||
if (!File_error && type == CONTEXT_MAIN_IMAGE && !format->Palette_only && (Main_backups->Pages->Nb_layers==1 || format->Supports_layers))
|
if (!File_error && type == CONTEXT_MAIN_IMAGE && !format->Palette_only && (Main_backups->Pages->Nb_layers==1 || format->Supports_layers))
|
||||||
{
|
{
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
Main_fileformat=save_context.Format;
|
Main.fileformat=save_context.Format;
|
||||||
strcpy(Main_backups->Pages->Filename, save_context.File_name);
|
strcpy(Main_backups->Pages->Filename, save_context.File_name);
|
||||||
strcpy(Main_backups->Pages->File_directory, save_context.File_directory);
|
strcpy(Main_backups->Pages->File_directory, save_context.File_directory);
|
||||||
}
|
}
|
||||||
@ -3529,7 +3530,7 @@ void Save_picture(enum CONTEXT_TYPE type)
|
|||||||
Destroy_context(&save_context);
|
Destroy_context(&save_context);
|
||||||
|
|
||||||
Print_filename();
|
Print_filename();
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3570,7 +3571,7 @@ void Button_Autosave(void)
|
|||||||
Save_image(&save_context);
|
Save_image(&save_context);
|
||||||
if (!File_error)
|
if (!File_error)
|
||||||
{
|
{
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
}
|
}
|
||||||
Destroy_context(&save_context);
|
Destroy_context(&save_context);
|
||||||
|
|
||||||
@ -3710,7 +3711,7 @@ void Button_Colorpicker(void)
|
|||||||
Paintbrush_shape=PAINTBRUSH_SHAPE_NONE;
|
Paintbrush_shape=PAINTBRUSH_SHAPE_NONE;
|
||||||
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ( )",0);
|
Print_in_menu("X: Y: ( )",0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3725,7 +3726,7 @@ void Button_Unselect_colorpicker(void)
|
|||||||
// Erase the color block which shows the picked color
|
// Erase the color block which shows the picked color
|
||||||
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
if (Operation_before_interrupt!=OPERATION_REPLACE)
|
||||||
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
Print_in_menu("X: Y: ",0);
|
Print_in_menu("X: Y: ",0);
|
||||||
|
|
||||||
// On fait de notre mieux pour restaurer l'ancienne opération:
|
// On fait de notre mieux pour restaurer l'ancienne opération:
|
||||||
@ -3763,7 +3764,7 @@ byte Coming_from_zoom_factor_menu=0;
|
|||||||
void Button_Magnify(void)
|
void Button_Magnify(void)
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
if ( (Current_operation==OPERATION_MAGNIFY) || (Main_magnifier_mode) )
|
if ( (Current_operation==OPERATION_MAGNIFY) || (Main.magnifier_mode) )
|
||||||
{
|
{
|
||||||
Unselect_button(BUTTON_MAGNIFIER);
|
Unselect_button(BUTTON_MAGNIFIER);
|
||||||
}
|
}
|
||||||
@ -3780,21 +3781,21 @@ void Button_Magnify(void)
|
|||||||
/* la loupe... Il serait peut-être plus propre de faire une procédure */
|
/* la loupe... Il serait peut-être plus propre de faire une procédure */
|
||||||
/* qui s'en charge... */
|
/* qui s'en charge... */
|
||||||
// On passe en mode loupe
|
// On passe en mode loupe
|
||||||
Main_magnifier_mode=1;
|
Main.magnifier_mode=1;
|
||||||
|
|
||||||
// La fonction d'affichage dans la partie image est désormais un affichage
|
// La fonction d'affichage dans la partie image est désormais un affichage
|
||||||
// spécial loupe.
|
// spécial loupe.
|
||||||
Pixel_preview=Pixel_preview_magnifier;
|
Pixel_preview=Pixel_preview_magnifier;
|
||||||
|
|
||||||
// On calcule l'origine de la loupe
|
// On calcule l'origine de la loupe
|
||||||
Main_magnifier_offset_X=Mouse_X-(Main_magnifier_width>>1);
|
Main.magnifier_offset_X=Mouse_X-(Main.magnifier_width>>1);
|
||||||
Main_magnifier_offset_Y=Mouse_Y-(Main_magnifier_height>>1);
|
Main.magnifier_offset_Y=Mouse_Y-(Main.magnifier_height>>1);
|
||||||
|
|
||||||
// Calcul des coordonnées absolues de ce coin DANS L'IMAGE
|
// Calcul des coordonnées absolues de ce coin DANS L'IMAGE
|
||||||
Main_magnifier_offset_X+=Main_offset_X;
|
Main.magnifier_offset_X+=Main.offset_X;
|
||||||
Main_magnifier_offset_Y+=Main_offset_Y;
|
Main.magnifier_offset_Y+=Main.offset_Y;
|
||||||
|
|
||||||
Clip_magnifier_offsets(&Main_magnifier_offset_X, &Main_magnifier_offset_Y);
|
Clip_magnifier_offsets(&Main.magnifier_offset_X, &Main.magnifier_offset_Y);
|
||||||
|
|
||||||
// On calcule les bornes visibles dans l'écran
|
// On calcule les bornes visibles dans l'écran
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
@ -3838,14 +3839,14 @@ void Button_Magnify_menu(void)
|
|||||||
Change_magnifier_factor(item->Number,0);
|
Change_magnifier_factor(item->Number,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (!item) && (!Main_magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Cancel
|
if ( (!item) && (!Main.magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Cancel
|
||||||
Unselect_button(BUTTON_MAGNIFIER);
|
Unselect_button(BUTTON_MAGNIFIER);
|
||||||
|
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Update_rect(Main_separator_position,0,Screen_width-Main_separator_position,Menu_Y);
|
Update_rect(Main.separator_position,0,Screen_width-Main.separator_position,Menu_Y);
|
||||||
|
|
||||||
if ( (item) && (!Main_magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Passage en mode zoom
|
if ( (item) && (!Main.magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Passage en mode zoom
|
||||||
{
|
{
|
||||||
Coming_from_zoom_factor_menu=1;
|
Coming_from_zoom_factor_menu=1;
|
||||||
Select_button(BUTTON_MAGNIFIER,LEFT_SIDE);
|
Select_button(BUTTON_MAGNIFIER,LEFT_SIDE);
|
||||||
@ -3856,27 +3857,27 @@ void Button_Magnify_menu(void)
|
|||||||
|
|
||||||
void Button_Unselect_magnifier(void)
|
void Button_Unselect_magnifier(void)
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// On sort du mode loupe
|
// On sort du mode loupe
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
|
|
||||||
|
|
||||||
// --> Recalculer le décalage de l'écran lorsqu'on sort de la loupe <--
|
// --> Recalculer le décalage de l'écran lorsqu'on sort de la loupe <--
|
||||||
// Centrage "brut" de lécran par rapport à la loupe
|
// Centrage "brut" de lécran par rapport à la loupe
|
||||||
Main_offset_X=Main_magnifier_offset_X-((Screen_width-Main_magnifier_width)>>1);
|
Main.offset_X=Main.magnifier_offset_X-((Screen_width-Main.magnifier_width)>>1);
|
||||||
Main_offset_Y=Main_magnifier_offset_Y-((Menu_Y-Main_magnifier_height)>>1);
|
Main.offset_Y=Main.magnifier_offset_Y-((Menu_Y-Main.magnifier_height)>>1);
|
||||||
|
|
||||||
// Correction en cas de débordement de l'image
|
// Correction en cas de débordement de l'image
|
||||||
if (Main_offset_X+Screen_width>Main_image_width)
|
if (Main.offset_X+Screen_width>Main.image_width)
|
||||||
Main_offset_X=Main_image_width-Screen_width;
|
Main.offset_X=Main.image_width-Screen_width;
|
||||||
if (Main_offset_X<0)
|
if (Main.offset_X<0)
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
|
|
||||||
if (Main_offset_Y+Menu_Y>Main_image_height)
|
if (Main.offset_Y+Menu_Y>Main.image_height)
|
||||||
Main_offset_Y=Main_image_height-Menu_Y;
|
Main.offset_Y=Main.image_height-Menu_Y;
|
||||||
if (Main_offset_Y<0)
|
if (Main.offset_Y<0)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
|
|
||||||
// La fonction d'affichage dans l'image est désormais un affichage normal.
|
// La fonction d'affichage dans l'image est désormais un affichage normal.
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
@ -4557,7 +4558,7 @@ void Display_effect_states(void)
|
|||||||
Display_effect_state(C3, L4, "Tiling" ,Tiling_mode);
|
Display_effect_state(C3, L4, "Tiling" ,Tiling_mode);
|
||||||
|
|
||||||
Display_effect_state(C2,L4, "8 bit" ,Main_backups->Pages->Image_mode > IMAGE_MODE_ANIMATION);
|
Display_effect_state(C2,L4, "8 bit" ,Main_backups->Pages->Image_mode > IMAGE_MODE_ANIMATION);
|
||||||
Display_effect_state(C3,L3, "Tilemap",Main_tilemap_mode);
|
Display_effect_state(C3,L3, "Tilemap",Main.tilemap_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4871,7 +4872,7 @@ void Button_Effects(void)
|
|||||||
{
|
{
|
||||||
Button_Tilemap_mode();
|
Button_Tilemap_mode();
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Display_effect_state(C3,L3, "Tilemap" ,Main_tilemap_mode);
|
Display_effect_state(C3,L3, "Tilemap" ,Main.tilemap_mode);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5056,7 +5057,7 @@ void Button_Text(void)
|
|||||||
g=text_palette[color].G;
|
g=text_palette[color].G;
|
||||||
b=text_palette[color].B;
|
b=text_palette[color].B;
|
||||||
|
|
||||||
//if (r==Main_palette[color].R && g==Main_palette[color].G && b==Main_palette[color].B)
|
//if (r==Main.palette[color].R && g==Main.palette[color].G && b==Main.palette[color].B)
|
||||||
// colmap[color]=color;
|
// colmap[color]=color;
|
||||||
//else
|
//else
|
||||||
colmap[color]=Best_color_perceptual_except(r,g,b,Back_color);
|
colmap[color]=Best_color_perceptual_except(r,g,b,Back_color);
|
||||||
@ -5330,7 +5331,7 @@ void Store_brush(int index)
|
|||||||
Brush_container[index].Paintbrush_shape=Paintbrush_shape;
|
Brush_container[index].Paintbrush_shape=Paintbrush_shape;
|
||||||
Brush_container[index].Width=Paintbrush_width;
|
Brush_container[index].Width=Paintbrush_width;
|
||||||
Brush_container[index].Height=Paintbrush_height;
|
Brush_container[index].Height=Paintbrush_height;
|
||||||
//memcpy(Brush_container[index].Palette,Main_palette,sizeof(T_Palette));
|
//memcpy(Brush_container[index].Palette,Main.palette,sizeof(T_Palette));
|
||||||
// Preview: pick center for big mono brush
|
// Preview: pick center for big mono brush
|
||||||
if (Paintbrush_width>BRUSH_CONTAINER_PREVIEW_WIDTH)
|
if (Paintbrush_width>BRUSH_CONTAINER_PREVIEW_WIDTH)
|
||||||
brush_offset_x = (Paintbrush_width-BRUSH_CONTAINER_PREVIEW_WIDTH)/2;
|
brush_offset_x = (Paintbrush_width-BRUSH_CONTAINER_PREVIEW_WIDTH)/2;
|
||||||
@ -5612,5 +5613,5 @@ void Button_Brush_container(void)
|
|||||||
byte Any_effect_active(void)
|
byte Any_effect_active(void)
|
||||||
{
|
{
|
||||||
return Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode
|
return Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode
|
||||||
||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode||Main_tilemap_mode || (Main_backups->Pages->Image_mode > IMAGE_MODE_ANIMATION);
|
||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode||Main.tilemap_mode || (Main_backups->Pages->Image_mode > IMAGE_MODE_ANIMATION);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,12 +183,12 @@ void Button_Constraint_mode()
|
|||||||
if (Selected_Constraint_Mode == IMAGE_MODE_MODE5)
|
if (Selected_Constraint_Mode == IMAGE_MODE_MODE5)
|
||||||
{
|
{
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_LAYERED ||
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_LAYERED ||
|
||||||
Main_backups->Pages->Nb_layers!=5 || (Main_image_width%48))
|
Main_backups->Pages->Nb_layers!=5 || (Main.image_width%48))
|
||||||
{
|
{
|
||||||
Verbose_message("Error!", "This emulation of Amstrad CPC's Mode5 can only be used on a 5-layer image whose width is a multiple of 48.");
|
Verbose_message("Error!", "This emulation of Amstrad CPC's Mode5 can only be used on a 5-layer image whose width is a multiple of 48.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (pixel=0; pixel < Main_image_width*Main_image_height; pixel++)
|
for (pixel=0; pixel < Main.image_width*Main.image_height; pixel++)
|
||||||
{
|
{
|
||||||
if (Main_backups->Pages->Image[4].Pixels[pixel]>3)
|
if (Main_backups->Pages->Image[4].Pixels[pixel]>3)
|
||||||
{
|
{
|
||||||
@ -249,7 +249,7 @@ void Button_Constraint_menu(void)
|
|||||||
// Tilemap mode
|
// Tilemap mode
|
||||||
void Button_Tilemap_mode(void)
|
void Button_Tilemap_mode(void)
|
||||||
{
|
{
|
||||||
Main_tilemap_mode=!Main_tilemap_mode;
|
Main.tilemap_mode=!Main.tilemap_mode;
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ void Button_Tilemap_menu(void)
|
|||||||
byte changed =
|
byte changed =
|
||||||
Config.Tilemap_allow_flipped_x!=flip_x ||
|
Config.Tilemap_allow_flipped_x!=flip_x ||
|
||||||
Config.Tilemap_allow_flipped_y!=flip_y ||
|
Config.Tilemap_allow_flipped_y!=flip_y ||
|
||||||
!Main_tilemap_mode;
|
!Main.tilemap_mode;
|
||||||
|
|
||||||
Config.Tilemap_allow_flipped_x=flip_x;
|
Config.Tilemap_allow_flipped_x=flip_x;
|
||||||
Config.Tilemap_allow_flipped_y=flip_y;
|
Config.Tilemap_allow_flipped_y=flip_y;
|
||||||
@ -325,7 +325,7 @@ void Button_Tilemap_menu(void)
|
|||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
Main_tilemap_mode=1;
|
Main.tilemap_mode=1;
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -959,7 +959,7 @@ void Effects_off(void)
|
|||||||
Mask_mode=0;
|
Mask_mode=0;
|
||||||
Sieve_mode=0;
|
Sieve_mode=0;
|
||||||
Snap_mode=0;
|
Snap_mode=0;
|
||||||
Main_tilemap_mode=0;
|
Main.tilemap_mode=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ void Button_Sieve_menu(void)
|
|||||||
*(Brush_original_pixels + y_pos * Brush_width + x_pos) = (Sieve[x_pos][y_pos])?Fore_color:Back_color;
|
*(Brush_original_pixels + y_pos * Brush_width + x_pos) = (Sieve[x_pos][y_pos])?Fore_color:Back_color;
|
||||||
|
|
||||||
// Grab palette
|
// Grab palette
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
// Remap (no change)
|
// Remap (no change)
|
||||||
Remap_brush();
|
Remap_brush();
|
||||||
|
|
||||||
|
|||||||
150
src/engine.c
150
src/engine.c
@ -434,7 +434,7 @@ void Select_button(int btn_number,byte click)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FAMILY_INTERRUPTION: // Petit cas spécial dans la famille "Interruption":
|
case FAMILY_INTERRUPTION: // Petit cas spécial dans la famille "Interruption":
|
||||||
if ((btn_number!=BUTTON_MAGNIFIER) || (!Main_magnifier_mode))
|
if ((btn_number!=BUTTON_MAGNIFIER) || (!Main.magnifier_mode))
|
||||||
// Pour chaque bouton:
|
// Pour chaque bouton:
|
||||||
for (b=0; b<NB_BUTTONS; b++)
|
for (b=0; b<NB_BUTTONS; b++)
|
||||||
// S'il est de la même famille
|
// S'il est de la même famille
|
||||||
@ -442,7 +442,7 @@ void Select_button(int btn_number,byte click)
|
|||||||
(b!=btn_number) &&
|
(b!=btn_number) &&
|
||||||
(Buttons_Pool[b].Family==FAMILY_INTERRUPTION) &&
|
(Buttons_Pool[b].Family==FAMILY_INTERRUPTION) &&
|
||||||
( (b!=BUTTON_MAGNIFIER) ||
|
( (b!=BUTTON_MAGNIFIER) ||
|
||||||
((b==BUTTON_MAGNIFIER) && (!Main_magnifier_mode)) )
|
((b==BUTTON_MAGNIFIER) && (!Main.magnifier_mode)) )
|
||||||
)
|
)
|
||||||
// Alors on désenclenche le bouton
|
// Alors on désenclenche le bouton
|
||||||
Unselect_button(b);
|
Unselect_button(b);
|
||||||
@ -456,7 +456,7 @@ void Select_button(int btn_number,byte click)
|
|||||||
if ( (b!=btn_number)
|
if ( (b!=btn_number)
|
||||||
&& (Buttons_Pool[b].Family==FAMILY_INTERRUPTION)
|
&& (Buttons_Pool[b].Family==FAMILY_INTERRUPTION)
|
||||||
// Et que ce n'est pas la loupe, ou alors qu'on n'est pas en mode loupe
|
// Et que ce n'est pas la loupe, ou alors qu'on n'est pas en mode loupe
|
||||||
&& (!(Main_magnifier_mode && (b==BUTTON_MAGNIFIER))) )
|
&& (!(Main.magnifier_mode && (b==BUTTON_MAGNIFIER))) )
|
||||||
// Alors on désenclenche le bouton
|
// Alors on désenclenche le bouton
|
||||||
Unselect_button(b);
|
Unselect_button(b);
|
||||||
// Right-clicking on Adjust opens a menu, so in this case we skip
|
// Right-clicking on Adjust opens a menu, so in this case we skip
|
||||||
@ -501,9 +501,9 @@ void Select_button(int btn_number,byte click)
|
|||||||
///Moves the splitbar between zoom and standard views
|
///Moves the splitbar between zoom and standard views
|
||||||
void Move_separator(void)
|
void Move_separator(void)
|
||||||
{
|
{
|
||||||
short old_main_separator_position=Main_separator_position;
|
short old_main_separator_position=Main.separator_position;
|
||||||
short old_x_zoom=Main_X_zoom;
|
short old_x_zoom=Main.X_zoom;
|
||||||
short offset=Main_X_zoom-Mouse_X;
|
short offset=Main.X_zoom-Mouse_X;
|
||||||
byte old_cursor_shape=Cursor_shape;
|
byte old_cursor_shape=Cursor_shape;
|
||||||
short old_mouse_x=-1;
|
short old_mouse_x=-1;
|
||||||
|
|
||||||
@ -511,20 +511,20 @@ void Move_separator(void)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Windows_open=1;
|
Windows_open=1;
|
||||||
Cursor_shape=CURSOR_SHAPE_HORIZONTAL;
|
Cursor_shape=CURSOR_SHAPE_HORIZONTAL;
|
||||||
Vertical_XOR_line(Main_separator_position,0,Menu_Y);
|
Vertical_XOR_line(Main.separator_position,0,Menu_Y);
|
||||||
Vertical_XOR_line(Main_X_zoom-1,0,Menu_Y);
|
Vertical_XOR_line(Main.X_zoom-1,0,Menu_Y);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Update_rect(Main_separator_position,0,abs(Main_separator_position-Main_X_zoom)+1,Menu_Y);
|
Update_rect(Main.separator_position,0,abs(Main.separator_position-Main.X_zoom)+1,Menu_Y);
|
||||||
|
|
||||||
while (Mouse_K)
|
while (Mouse_K)
|
||||||
{
|
{
|
||||||
if (Mouse_X!=old_mouse_x)
|
if (Mouse_X!=old_mouse_x)
|
||||||
{
|
{
|
||||||
old_mouse_x=Mouse_X;
|
old_mouse_x=Mouse_X;
|
||||||
Main_separator_proportion=(float)(Mouse_X+offset)/Screen_width;
|
Main.separator_proportion=(float)(Mouse_X+offset)/Screen_width;
|
||||||
Compute_separator_data();
|
Compute_separator_data();
|
||||||
|
|
||||||
if (Main_X_zoom!=old_x_zoom)
|
if (Main.X_zoom!=old_x_zoom)
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
@ -534,14 +534,14 @@ void Move_separator(void)
|
|||||||
|
|
||||||
Update_rect(old_main_separator_position,0,abs(old_main_separator_position-old_x_zoom)+1,Menu_Y);
|
Update_rect(old_main_separator_position,0,abs(old_main_separator_position-old_x_zoom)+1,Menu_Y);
|
||||||
|
|
||||||
old_main_separator_position=Main_separator_position;
|
old_main_separator_position=Main.separator_position;
|
||||||
old_x_zoom=Main_X_zoom;
|
old_x_zoom=Main.X_zoom;
|
||||||
|
|
||||||
// Rafficher la barre en XOR
|
// Rafficher la barre en XOR
|
||||||
Vertical_XOR_line(Main_separator_position,0,Menu_Y);
|
Vertical_XOR_line(Main.separator_position,0,Menu_Y);
|
||||||
Vertical_XOR_line(Main_X_zoom-1,0,Menu_Y);
|
Vertical_XOR_line(Main.X_zoom-1,0,Menu_Y);
|
||||||
|
|
||||||
Update_rect(Main_separator_position,0,abs(Main_separator_position-Main_X_zoom)+1,Menu_Y);
|
Update_rect(Main.separator_position,0,abs(Main.separator_position-Main.X_zoom)+1,Menu_Y);
|
||||||
|
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
@ -551,8 +551,8 @@ void Move_separator(void)
|
|||||||
|
|
||||||
// Effacer la barre en XOR
|
// Effacer la barre en XOR
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Vertical_XOR_line(Main_separator_position,0,Menu_Y);
|
Vertical_XOR_line(Main.separator_position,0,Menu_Y);
|
||||||
Vertical_XOR_line(Main_X_zoom-1,0,Menu_Y);
|
Vertical_XOR_line(Main.X_zoom-1,0,Menu_Y);
|
||||||
Windows_open=0;
|
Windows_open=0;
|
||||||
Cursor_shape=old_cursor_shape;
|
Cursor_shape=old_cursor_shape;
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
@ -571,7 +571,7 @@ void Status_print_palette_color(byte color)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
strcpy(str,Buttons_Pool[BUTTON_CHOOSE_COL].Tooltip);
|
strcpy(str,Buttons_Pool[BUTTON_CHOOSE_COL].Tooltip);
|
||||||
sprintf(str+strlen(str),"%d (%d,%d,%d)",color,Main_palette[color].R,Main_palette[color].G,Main_palette[color].B);
|
sprintf(str+strlen(str),"%d (%d,%d,%d)",color,Main.palette[color].R,Main.palette[color].G,Main.palette[color].B);
|
||||||
// Pad spaces
|
// Pad spaces
|
||||||
for (i=strlen(str); i<24; i++)
|
for (i=strlen(str); i<24; i++)
|
||||||
str[i]=' ';
|
str[i]=' ';
|
||||||
@ -589,12 +589,12 @@ void Layer_preview_on(int * preview_is_visible)
|
|||||||
|
|
||||||
if (! *preview_is_visible && layercount>1)
|
if (! *preview_is_visible && layercount>1)
|
||||||
{
|
{
|
||||||
previewW = Min(Main_image_width/Menu_factor_X,Layer_button_width);
|
previewW = Min(Main.image_width/Menu_factor_X,Layer_button_width);
|
||||||
previewH = previewW * Main_image_height / Main_image_width * Menu_factor_X / Menu_factor_Y;
|
previewH = previewW * Main.image_height / Main.image_width * Menu_factor_X / Menu_factor_Y;
|
||||||
if (previewH > Screen_height/4)
|
if (previewH > Screen_height/4)
|
||||||
{
|
{
|
||||||
previewH = Screen_height/4;
|
previewH = Screen_height/4;
|
||||||
previewW = Main_image_width*previewH/Main_image_height*Menu_factor_Y/Menu_factor_X;
|
previewW = Main.image_width*previewH/Main.image_height*Menu_factor_Y/Menu_factor_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
Open_popup((Buttons_Pool[BUTTON_LAYER_SELECT].X_offset + 2)*Menu_factor_X,
|
Open_popup((Buttons_Pool[BUTTON_LAYER_SELECT].X_offset + 2)*Menu_factor_X,
|
||||||
@ -620,11 +620,11 @@ void Layer_preview_on(int * preview_is_visible)
|
|||||||
for (y = 0; y < previewH*Pixel_height*Menu_factor_Y-1; y++)
|
for (y = 0; y < previewH*Pixel_height*Menu_factor_Y-1; y++)
|
||||||
for (x = 0; x < previewW*Pixel_width*Menu_factor_X-1; x++)
|
for (x = 0; x < previewW*Pixel_width*Menu_factor_X-1; x++)
|
||||||
{
|
{
|
||||||
int imgx = x * Main_image_width / (previewW*Pixel_width*Menu_factor_X-1);
|
int imgx = x * Main.image_width / (previewW*Pixel_width*Menu_factor_X-1);
|
||||||
int imgy = y * Main_image_height / (previewH*Pixel_height*Menu_factor_Y-1);
|
int imgy = y * Main.image_height / (previewH*Pixel_height*Menu_factor_Y-1);
|
||||||
// Use Pixel_simple() in order to get highest resolution
|
// Use Pixel_simple() in order to get highest resolution
|
||||||
Pixel_simple(x+((layer*Layer_button_width+offset)*Menu_factor_X+Window_pos_X)*Pixel_width, y+Window_pos_Y*Pixel_height+1, *(Main_backups->Pages->Image[layer].Pixels
|
Pixel_simple(x+((layer*Layer_button_width+offset)*Menu_factor_X+Window_pos_X)*Pixel_width, y+Window_pos_Y*Pixel_height+1, *(Main_backups->Pages->Image[layer].Pixels
|
||||||
+ imgx + imgy * Main_image_width));
|
+ imgx + imgy * Main.image_width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update_window_area(0,0,Window_width, Window_height);
|
Update_window_area(0,0,Window_width, Window_height);
|
||||||
@ -675,7 +675,7 @@ void Main_handler(void)
|
|||||||
else if (Drop_file_name)
|
else if (Drop_file_name)
|
||||||
{
|
{
|
||||||
// A file was dragged into Grafx2's window
|
// A file was dragged into Grafx2's window
|
||||||
if (Main_image_is_modified && !Confirmation_box("Discard unsaved changes ?"))
|
if (Main.image_is_modified && !Confirmation_box("Discard unsaved changes ?"))
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
@ -703,11 +703,11 @@ void Main_handler(void)
|
|||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
}
|
}
|
||||||
Destroy_context(&context);
|
Destroy_context(&context);
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_menu();
|
Display_menu();
|
||||||
if (Config.Display_image_limits)
|
if (Config.Display_image_limits)
|
||||||
@ -808,84 +808,84 @@ void Main_handler(void)
|
|||||||
switch (key_index)
|
switch (key_index)
|
||||||
{
|
{
|
||||||
case SPECIAL_SCROLL_UP : // Scroll up
|
case SPECIAL_SCROLL_UP : // Scroll up
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,-(Main_magnifier_height>>2));
|
Scroll_magnifier(0,-(Main.magnifier_height>>2));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-(Screen_height>>3));
|
Scroll_screen(0,-(Screen_height>>3));
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN : // Scroll down
|
case SPECIAL_SCROLL_DOWN : // Scroll down
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,(Main_magnifier_height>>2));
|
Scroll_magnifier(0,(Main.magnifier_height>>2));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,(Screen_height>>3));
|
Scroll_screen(0,(Screen_height>>3));
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT : // Scroll left
|
case SPECIAL_SCROLL_LEFT : // Scroll left
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(-(Main_magnifier_width>>2),0);
|
Scroll_magnifier(-(Main.magnifier_width>>2),0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-(Screen_width>>3),0);
|
Scroll_screen(-(Screen_width>>3),0);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT : // Scroll right
|
case SPECIAL_SCROLL_RIGHT : // Scroll right
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier((Main_magnifier_width>>2),0);
|
Scroll_magnifier((Main.magnifier_width>>2),0);
|
||||||
else
|
else
|
||||||
Scroll_screen((Screen_width>>3),0);
|
Scroll_screen((Screen_width>>3),0);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_UP_FAST : // Scroll up faster
|
case SPECIAL_SCROLL_UP_FAST : // Scroll up faster
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,-(Main_magnifier_height>>1));
|
Scroll_magnifier(0,-(Main.magnifier_height>>1));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-(Screen_height>>2));
|
Scroll_screen(0,-(Screen_height>>2));
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster
|
case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,(Main_magnifier_height>>1));
|
Scroll_magnifier(0,(Main.magnifier_height>>1));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,(Screen_height>>2));
|
Scroll_screen(0,(Screen_height>>2));
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster
|
case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(-(Main_magnifier_width>>1),0);
|
Scroll_magnifier(-(Main.magnifier_width>>1),0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-(Screen_width>>2),0);
|
Scroll_screen(-(Screen_width>>2),0);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster
|
case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier((Main_magnifier_width>>1),0);
|
Scroll_magnifier((Main.magnifier_width>>1),0);
|
||||||
else
|
else
|
||||||
Scroll_screen((Screen_width>>2),0);
|
Scroll_screen((Screen_width>>2),0);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower
|
case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,-1);
|
Scroll_magnifier(0,-1);
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-1);
|
Scroll_screen(0,-1);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower
|
case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(0,1);
|
Scroll_magnifier(0,1);
|
||||||
else
|
else
|
||||||
Scroll_screen(0,1);
|
Scroll_screen(0,1);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower
|
case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(-1,0);
|
Scroll_magnifier(-1,0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-1,0);
|
Scroll_screen(-1,0);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower
|
case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(1,0);
|
Scroll_magnifier(1,0);
|
||||||
else
|
else
|
||||||
Scroll_screen(1,0);
|
Scroll_screen(1,0);
|
||||||
@ -1361,7 +1361,7 @@ void Main_handler(void)
|
|||||||
Cycling_mode= !Cycling_mode;
|
Cycling_mode= !Cycling_mode;
|
||||||
// Restore palette
|
// Restore palette
|
||||||
if (!Cycling_mode)
|
if (!Cycling_mode)
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_HOLD_PAN:
|
case SPECIAL_HOLD_PAN:
|
||||||
@ -1419,8 +1419,8 @@ void Main_handler(void)
|
|||||||
// Gestion de la souris
|
// Gestion de la souris
|
||||||
|
|
||||||
Cursor_in_menu=(Mouse_Y>=Menu_Y) ||
|
Cursor_in_menu=(Mouse_Y>=Menu_Y) ||
|
||||||
( (Main_magnifier_mode) && (Mouse_X>=Main_separator_position) &&
|
( (Main.magnifier_mode) && (Mouse_X>=Main.separator_position) &&
|
||||||
(Mouse_X<Main_X_zoom) );
|
(Mouse_X<Main.X_zoom) );
|
||||||
|
|
||||||
if (Cursor_in_menu)
|
if (Cursor_in_menu)
|
||||||
{
|
{
|
||||||
@ -1512,7 +1512,7 @@ void Main_handler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Main_magnifier_mode) Move_separator();
|
if (Main.magnifier_mode) Move_separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button_index == BUTTON_LAYER_SELECT)
|
if (button_index == BUTTON_LAYER_SELECT)
|
||||||
@ -1529,8 +1529,8 @@ void Main_handler(void)
|
|||||||
|
|
||||||
// we need to refresh that one as we may come from a sub window
|
// we need to refresh that one as we may come from a sub window
|
||||||
Cursor_in_menu=(Mouse_Y>=Menu_Y) ||
|
Cursor_in_menu=(Mouse_Y>=Menu_Y) ||
|
||||||
( (Main_magnifier_mode) && (Mouse_X>=Main_separator_position) &&
|
( (Main.magnifier_mode) && (Mouse_X>=Main.separator_position) &&
|
||||||
(Mouse_X<Main_X_zoom) );
|
(Mouse_X<Main.X_zoom) );
|
||||||
|
|
||||||
|
|
||||||
// Le curseur se trouve dans l'image
|
// Le curseur se trouve dans l'image
|
||||||
@ -1653,7 +1653,7 @@ void Open_window(word width,word height, const char * title)
|
|||||||
{
|
{
|
||||||
Allow_colorcycling=0;
|
Allow_colorcycling=0;
|
||||||
// Restore palette
|
// Restore palette
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
}
|
}
|
||||||
Allow_drag_and_drop(0);
|
Allow_drag_and_drop(0);
|
||||||
}
|
}
|
||||||
@ -2462,8 +2462,8 @@ short Wait_click_in_palette(T_Palette_button * button)
|
|||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
old_hide_cursor=Cursor_hidden;
|
old_hide_cursor=Cursor_hidden;
|
||||||
old_main_magnifier_mode=Main_magnifier_mode;
|
old_main_magnifier_mode=Main.magnifier_mode;
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Cursor_hidden=0;
|
Cursor_hidden=0;
|
||||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -2482,7 +2482,7 @@ short Wait_click_in_palette(T_Palette_button * button)
|
|||||||
(((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-(button->Pos_Y+3)) / 5;
|
(((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-(button->Pos_Y+3)) / 5;
|
||||||
Cursor_shape=CURSOR_SHAPE_ARROW;
|
Cursor_shape=CURSOR_SHAPE_ARROW;
|
||||||
Cursor_hidden=old_hide_cursor;
|
Cursor_hidden=old_hide_cursor;
|
||||||
Main_magnifier_mode=old_main_magnifier_mode;
|
Main.magnifier_mode=old_main_magnifier_mode;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
return selected_color;
|
return selected_color;
|
||||||
}
|
}
|
||||||
@ -2494,7 +2494,7 @@ short Wait_click_in_palette(T_Palette_button * button)
|
|||||||
selected_color=Read_pixel(Mouse_X,Mouse_Y);
|
selected_color=Read_pixel(Mouse_X,Mouse_Y);
|
||||||
Cursor_shape=CURSOR_SHAPE_ARROW;
|
Cursor_shape=CURSOR_SHAPE_ARROW;
|
||||||
Cursor_hidden=old_hide_cursor;
|
Cursor_hidden=old_hide_cursor;
|
||||||
Main_magnifier_mode=old_main_magnifier_mode;
|
Main.magnifier_mode=old_main_magnifier_mode;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
return selected_color;
|
return selected_color;
|
||||||
}
|
}
|
||||||
@ -2505,7 +2505,7 @@ short Wait_click_in_palette(T_Palette_button * button)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Cursor_shape=CURSOR_SHAPE_ARROW;
|
Cursor_shape=CURSOR_SHAPE_ARROW;
|
||||||
Cursor_hidden=old_hide_cursor;
|
Cursor_hidden=old_hide_cursor;
|
||||||
Main_magnifier_mode=old_main_magnifier_mode;
|
Main.magnifier_mode=old_main_magnifier_mode;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2566,11 +2566,11 @@ void Get_color_behind_window(byte * color, byte * click)
|
|||||||
sprintf(str,"%d",a);
|
sprintf(str,"%d",a);
|
||||||
d=strlen(str);
|
d=strlen(str);
|
||||||
strcat(str," (");
|
strcat(str," (");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].R);
|
sprintf(str+strlen(str),"%d",Main.palette[a].R);
|
||||||
strcat(str,",");
|
strcat(str,",");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].G);
|
sprintf(str+strlen(str),"%d",Main.palette[a].G);
|
||||||
strcat(str,",");
|
strcat(str,",");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].B);
|
sprintf(str+strlen(str),"%d",Main.palette[a].B);
|
||||||
strcat(str,")");
|
strcat(str,")");
|
||||||
a=24-d;
|
a=24-d;
|
||||||
for (index=strlen(str); index<a; index++)
|
for (index=strlen(str); index<a; index++)
|
||||||
@ -3585,31 +3585,31 @@ void Set_bar_visibility(word bar, int visible, int with_redraw)
|
|||||||
|
|
||||||
Compute_menu_offsets();
|
Compute_menu_offsets();
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
// On repositionne le décalage de l'image pour qu'il n'y ait pas d'in-
|
// On repositionne le décalage de l'image pour qu'il n'y ait pas d'in-
|
||||||
// -cohérences lorsqu'on sortira du mode Loupe.
|
// -cohérences lorsqu'on sortira du mode Loupe.
|
||||||
if (Main_offset_Y+Screen_height>Main_image_height)
|
if (Main.offset_Y+Screen_height>Main.image_height)
|
||||||
{
|
{
|
||||||
if (Screen_height>Main_image_height)
|
if (Screen_height>Main.image_height)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
else
|
else
|
||||||
Main_offset_Y=Main_image_height-Screen_height;
|
Main.offset_Y=Main.image_height-Screen_height;
|
||||||
}
|
}
|
||||||
// On fait pareil pour le brouillon
|
// On fait pareil pour le brouillon
|
||||||
if (Spare_offset_Y+Screen_height>Spare_image_height)
|
if (Spare.offset_Y+Screen_height>Spare.image_height)
|
||||||
{
|
{
|
||||||
if (Screen_height>Spare_image_height)
|
if (Screen_height>Spare.image_height)
|
||||||
Spare_offset_Y=0;
|
Spare.offset_Y=0;
|
||||||
else
|
else
|
||||||
Spare_offset_Y=Spare_image_height-Screen_height;
|
Spare.offset_Y=Spare.image_height-Screen_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
@ -3626,14 +3626,14 @@ void Set_bar_visibility(word bar, int visible, int with_redraw)
|
|||||||
|
|
||||||
Compute_menu_offsets();
|
Compute_menu_offsets();
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
if (with_redraw)
|
if (with_redraw)
|
||||||
{
|
{
|
||||||
Display_menu();
|
Display_menu();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
114
src/factory.c
114
src/factory.c
@ -165,7 +165,7 @@ do { \
|
|||||||
#define DECLARE_UNSAVED(BIND) \
|
#define DECLARE_UNSAVED(BIND) \
|
||||||
int BIND ## _unsaved(lua_State* L) \
|
int BIND ## _unsaved(lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
Backup_if_necessary(L, Main_current_layer); \
|
Backup_if_necessary(L, Main.current_layer); \
|
||||||
Register_main_writable(L); \
|
Register_main_writable(L); \
|
||||||
return BIND(L); \
|
return BIND(L); \
|
||||||
}
|
}
|
||||||
@ -196,8 +196,8 @@ void Update_colors_during_script(void)
|
|||||||
{
|
{
|
||||||
if (Palette_has_changed)
|
if (Palette_has_changed)
|
||||||
{
|
{
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Display_menu();
|
Display_menu();
|
||||||
Palette_has_changed=0;
|
Palette_has_changed=0;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ void Update_colors_during_script(void)
|
|||||||
/// Paint a pixel in image without updating the screen
|
/// Paint a pixel in image without updating the screen
|
||||||
void Pixel_figure_no_screen(short x_pos,short y_pos,byte color)
|
void Pixel_figure_no_screen(short x_pos,short y_pos,byte color)
|
||||||
{
|
{
|
||||||
if (x_pos>0 && y_pos >0 && x_pos<Main_image_width && y_pos<Main_image_height)
|
if (x_pos>0 && y_pos >0 && x_pos<Main.image_width && y_pos<Main.image_height)
|
||||||
Pixel_in_current_screen(x_pos,y_pos,color);
|
Pixel_in_current_screen(x_pos,y_pos,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ void Backup_if_necessary(lua_State* L, int layer)
|
|||||||
{
|
{
|
||||||
Backup_layers(layer);
|
Backup_layers(layer);
|
||||||
Is_backed_up = 1;
|
Is_backed_up = 1;
|
||||||
if (layer == Main_current_layer)
|
if (layer == Main.current_layer)
|
||||||
{
|
{
|
||||||
Main_backup_page = Main_backups->Pages->Next;
|
Main_backup_page = Main_backups->Pages->Next;
|
||||||
Main_backup_screen = Screen_backup;
|
Main_backup_screen = Screen_backup;
|
||||||
@ -261,7 +261,7 @@ int L_SetBrushSize(lua_State* L)
|
|||||||
memset(Brush_original_pixels,Back_color,(long)Brush_width*Brush_height);
|
memset(Brush_original_pixels,Back_color,(long)Brush_width*Brush_height);
|
||||||
memset(Brush,Back_color,(long)Brush_width*Brush_height);
|
memset(Brush,Back_color,(long)Brush_width*Brush_height);
|
||||||
// Adopt the current palette.
|
// Adopt the current palette.
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
Brush_colormap[i]=i;
|
Brush_colormap[i]=i;
|
||||||
//--
|
//--
|
||||||
@ -297,7 +297,7 @@ int L_PutBrushPixel(lua_State* L)
|
|||||||
|
|
||||||
// First time writing in brush:
|
// First time writing in brush:
|
||||||
// Adopt the current palette.
|
// Adopt the current palette.
|
||||||
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
|
memcpy(Brush_original_palette, Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Brush_original_pixels, Brush, Brush_width*Brush_height);
|
memcpy(Brush_original_pixels, Brush, Brush_width*Brush_height);
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
Brush_colormap[i]=i;
|
Brush_colormap[i]=i;
|
||||||
@ -372,7 +372,7 @@ int L_SetPictureSize(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(1, "setpicturesize", w, 1, 9999);
|
LUA_ARG_NUMBER(1, "setpicturesize", w, 1, 9999);
|
||||||
LUA_ARG_NUMBER(2, "setpicturesize", h, 1, 9999);
|
LUA_ARG_NUMBER(2, "setpicturesize", h, 1, 9999);
|
||||||
|
|
||||||
if (w == Main_image_width && h == Main_image_height)
|
if (w == Main.image_width && h == Main.image_height)
|
||||||
{
|
{
|
||||||
// nothing to do at all
|
// nothing to do at all
|
||||||
return 0;
|
return 0;
|
||||||
@ -394,9 +394,9 @@ int L_SetPictureSize(lua_State* L)
|
|||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(Main_backups->Pages->Next->Width,Main_image_width),
|
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(Main_backups->Pages->Next->Width,Main.image_width),
|
||||||
Min(Main_backups->Pages->Next->Height,Main_image_height),Main_backups->Pages->Next->Width,
|
Min(Main_backups->Pages->Next->Height,Main.image_height),Main_backups->Pages->Next->Width,
|
||||||
Main_backups->Pages->Image[i].Pixels,0,0,Main_image_width);
|
Main_backups->Pages->Image[i].Pixels,0,0,Main.image_width);
|
||||||
}
|
}
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
|
|
||||||
@ -427,9 +427,9 @@ int L_SetSparePictureSize(lua_State* L)
|
|||||||
for (i=0; i<Spare_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Spare_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Spare_backups->Pages->Next->Image[i].Pixels,0,0,Min(Spare_backups->Pages->Next->Width,Spare_image_width),
|
Spare_backups->Pages->Next->Image[i].Pixels,0,0,Min(Spare_backups->Pages->Next->Width,Spare.image_width),
|
||||||
Min(Spare_backups->Pages->Next->Height,Spare_image_height),Spare_backups->Pages->Next->Width,
|
Min(Spare_backups->Pages->Next->Height,Spare.image_height),Spare_backups->Pages->Next->Width,
|
||||||
Spare_backups->Pages->Image[i].Pixels,0,0,Spare_image_width);
|
Spare_backups->Pages->Image[i].Pixels,0,0,Spare.image_width);
|
||||||
}
|
}
|
||||||
Redraw_spare_image();
|
Redraw_spare_image();
|
||||||
|
|
||||||
@ -438,8 +438,8 @@ int L_SetSparePictureSize(lua_State* L)
|
|||||||
|
|
||||||
int L_GetPictureSize(lua_State* L)
|
int L_GetPictureSize(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Main_image_width);
|
lua_pushinteger(L, Main.image_width);
|
||||||
lua_pushinteger(L, Main_image_height);
|
lua_pushinteger(L, Main.image_height);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ int L_PutPicturePixel(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(3, "putpicturepixel", c, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(3, "putpicturepixel", c, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
// Bound check
|
// Bound check
|
||||||
if (x<0 || y<0 || x>=Main_image_width || y>=Main_image_height)
|
if (x<0 || y<0 || x>=Main.image_width || y>=Main.image_height)
|
||||||
{
|
{
|
||||||
// Silently ignored
|
// Silently ignored
|
||||||
return 0;
|
return 0;
|
||||||
@ -496,7 +496,7 @@ int L_PutSparePicturePixel(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(3, "putsparepicturepixel", c, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(3, "putsparepicturepixel", c, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
// Bound check
|
// Bound check
|
||||||
if (x<0 || y<0 || x>=Spare_image_width || y>=Spare_image_height)
|
if (x<0 || y<0 || x>=Spare.image_width || y>=Spare.image_height)
|
||||||
{
|
{
|
||||||
// Silently ignored
|
// Silently ignored
|
||||||
return 0;
|
return 0;
|
||||||
@ -563,10 +563,10 @@ int L_DrawFilledRect(lua_State* L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clipping limits
|
// Clipping limits
|
||||||
if (max_x>Main_image_width)
|
if (max_x>Main.image_width)
|
||||||
max_x=Main_image_width-1;
|
max_x=Main.image_width-1;
|
||||||
if (max_y>Main_image_height)
|
if (max_y>Main.image_height)
|
||||||
max_y=Main_image_height-1;
|
max_y=Main.image_height-1;
|
||||||
if (min_x<0)
|
if (min_x<0)
|
||||||
min_x=0;
|
min_x=0;
|
||||||
if (min_y<0)
|
if (min_y<0)
|
||||||
@ -627,9 +627,9 @@ int L_DrawDisk(lua_State* L)
|
|||||||
|
|
||||||
// Compute clipping limits
|
// Compute clipping limits
|
||||||
min_x=center_x-r+even<0 ? 0 : center_x-r+even;
|
min_x=center_x-r+even<0 ? 0 : center_x-r+even;
|
||||||
max_x=center_x+r>=Main_image_width? Main_image_width-1 : center_x+r;
|
max_x=center_x+r>=Main.image_width? Main.image_width-1 : center_x+r;
|
||||||
min_y=center_y-r+even<0 ? 0 : center_y-r+even;
|
min_y=center_y-r+even<0 ? 0 : center_y-r+even;
|
||||||
max_y=center_y+r>=Main_image_height? Main_image_height-1 : center_y+r;
|
max_y=center_y+r>=Main.image_height? Main.image_height-1 : center_y+r;
|
||||||
|
|
||||||
for (y_pos=min_y;y_pos<=max_y;y_pos++)
|
for (y_pos=min_y;y_pos<=max_y;y_pos++)
|
||||||
{
|
{
|
||||||
@ -657,7 +657,7 @@ int L_GetPicturePixel(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(2, "getpicturepixel", y, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(2, "getpicturepixel", y, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
// Bound check
|
// Bound check
|
||||||
if (x<0 || y<0 || x>=Main_image_width || y>=Main_image_height)
|
if (x<0 || y<0 || x>=Main.image_width || y>=Main.image_height)
|
||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
@ -702,7 +702,7 @@ int L_GetLayerPixel(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(2, "getlayerpixel", y, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(2, "getlayerpixel", y, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
// Bound check
|
// Bound check
|
||||||
if (x<0 || y<0 || x>=Main_image_width || y>=Main_image_height)
|
if (x<0 || y<0 || x>=Main.image_width || y>=Main.image_height)
|
||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
@ -716,8 +716,8 @@ int L_GetLayerPixel(lua_State* L)
|
|||||||
|
|
||||||
int L_GetSparePictureSize(lua_State* L)
|
int L_GetSparePictureSize(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Spare_image_width);
|
lua_pushinteger(L, Spare.image_width);
|
||||||
lua_pushinteger(L, Spare_image_height);
|
lua_pushinteger(L, Spare.image_height);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,13 +732,13 @@ int L_GetSpareLayerPixel(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(2, "getsparelayerpixel", y, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(2, "getsparelayerpixel", y, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
// Bound check
|
// Bound check
|
||||||
if (x<0 || y<0 || x>=Spare_image_width || y>=Spare_image_height)
|
if (x<0 || y<0 || x>=Spare.image_width || y>=Spare.image_height)
|
||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, *(Spare_backups->Pages->Image[Spare_current_layer].Pixels + y*Spare_image_width + x));
|
lua_pushinteger(L, *(Spare_backups->Pages->Image[Spare.current_layer].Pixels + y*Spare.image_width + x));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,9 +771,9 @@ int L_GetSpareColor(lua_State* L)
|
|||||||
LUA_ARG_LIMIT (1, "getsparecolor");
|
LUA_ARG_LIMIT (1, "getsparecolor");
|
||||||
LUA_ARG_NUMBER(1, "getsparecolor", c, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(1, "getsparecolor", c, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
lua_pushinteger(L, Spare_palette[c].R);
|
lua_pushinteger(L, Spare.palette[c].R);
|
||||||
lua_pushinteger(L, Spare_palette[c].G);
|
lua_pushinteger(L, Spare.palette[c].G);
|
||||||
lua_pushinteger(L, Spare_palette[c].B);
|
lua_pushinteger(L, Spare.palette[c].B);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,9 +797,9 @@ int L_SetColor(lua_State* L)
|
|||||||
LUA_ARG_NUMBER(4, "setcolor", b, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(4, "setcolor", b, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
|
|
||||||
Main_palette[c].R=Round_palette_component(clamp_byte(r));
|
Main.palette[c].R=Round_palette_component(clamp_byte(r));
|
||||||
Main_palette[c].G=Round_palette_component(clamp_byte(g));
|
Main.palette[c].G=Round_palette_component(clamp_byte(g));
|
||||||
Main_palette[c].B=Round_palette_component(clamp_byte(b));
|
Main.palette[c].B=Round_palette_component(clamp_byte(b));
|
||||||
// Set_color(c, r, g, b); Not needed. Update screen when script is finished
|
// Set_color(c, r, g, b); Not needed. Update screen when script is finished
|
||||||
Palette_has_changed=1;
|
Palette_has_changed=1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -821,9 +821,9 @@ int L_GetColor(lua_State* L)
|
|||||||
LUA_ARG_LIMIT (1, "getcolor");
|
LUA_ARG_LIMIT (1, "getcolor");
|
||||||
LUA_ARG_NUMBER(1, "getcolor", c, INT_MIN, INT_MAX);
|
LUA_ARG_NUMBER(1, "getcolor", c, INT_MIN, INT_MAX);
|
||||||
|
|
||||||
lua_pushinteger(L, Main_palette[c].R);
|
lua_pushinteger(L, Main.palette[c].R);
|
||||||
lua_pushinteger(L, Main_palette[c].G);
|
lua_pushinteger(L, Main.palette[c].G);
|
||||||
lua_pushinteger(L, Main_palette[c].B);
|
lua_pushinteger(L, Main.palette[c].B);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,12 +906,12 @@ int L_MatchColor2(lua_State* L)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
diff_c = sqrt(
|
diff_c = sqrt(
|
||||||
(0.26*(Main_palette[col].R-r))*
|
(0.26*(Main.palette[col].R-r))*
|
||||||
(0.26*(Main_palette[col].R-r))+
|
(0.26*(Main.palette[col].R-r))+
|
||||||
(0.55*(Main_palette[col].G-g))*
|
(0.55*(Main.palette[col].G-g))*
|
||||||
(0.55*(Main_palette[col].G-g))+
|
(0.55*(Main.palette[col].G-g))+
|
||||||
(0.19*(Main_palette[col].B-b))*
|
(0.19*(Main.palette[col].B-b))*
|
||||||
(0.19*(Main_palette[col].B-b)));
|
(0.19*(Main.palette[col].B-b)));
|
||||||
// Exact match
|
// Exact match
|
||||||
if (diff_c<1.0)
|
if (diff_c<1.0)
|
||||||
{
|
{
|
||||||
@ -919,7 +919,7 @@ int L_MatchColor2(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bri = sqrt(0.26*0.26*(Main_palette[col].R*Main_palette[col].R) + 0.55*0.55*(Main_palette[col].G*Main_palette[col].G) + 0.19*0.19*(Main_palette[col].B*Main_palette[col].B));
|
bri = sqrt(0.26*0.26*(Main.palette[col].R*Main.palette[col].R) + 0.55*0.55*(Main.palette[col].G*Main.palette[col].G) + 0.19*0.19*(Main.palette[col].B*Main.palette[col].B));
|
||||||
diff_b = fabs(target_bri-bri);
|
diff_b = fabs(target_bri-bri);
|
||||||
|
|
||||||
diff=l_weight*(diff_b-diff_c)+diff_c;
|
diff=l_weight*(diff_b-diff_c)+diff_c;
|
||||||
@ -1914,13 +1914,13 @@ int L_SelectSpareLayer(lua_State* L)
|
|||||||
int nb_args=lua_gettop(L);
|
int nb_args=lua_gettop(L);
|
||||||
|
|
||||||
LUA_ARG_LIMIT (1, "selectsparelayer");
|
LUA_ARG_LIMIT (1, "selectsparelayer");
|
||||||
LUA_ARG_NUMBER(1, "selectsparelayer", Spare_current_layer, 0, Spare_backups->Pages->Nb_layers - 1);
|
LUA_ARG_NUMBER(1, "selectsparelayer", Spare.current_layer, 0, Spare_backups->Pages->Nb_layers - 1);
|
||||||
|
|
||||||
if (Spare_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Spare_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
if (! ((1 << Spare_current_layer) & Spare_layers_visible))
|
if (! ((1 << Spare.current_layer) & Spare.layers_visible))
|
||||||
{
|
{
|
||||||
Spare_layers_visible |= (1 << Spare_current_layer);
|
Spare.layers_visible |= (1 << Spare.current_layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1932,15 +1932,15 @@ int L_SelectLayer(lua_State* L)
|
|||||||
int nb_args=lua_gettop(L);
|
int nb_args=lua_gettop(L);
|
||||||
|
|
||||||
LUA_ARG_LIMIT (1, "selectlayer");
|
LUA_ARG_LIMIT (1, "selectlayer");
|
||||||
LUA_ARG_NUMBER(1, "selectlayer", Main_current_layer, 0, Main_backups->Pages->Nb_layers - 1);
|
LUA_ARG_NUMBER(1, "selectlayer", Main.current_layer, 0, Main_backups->Pages->Nb_layers - 1);
|
||||||
|
|
||||||
Backup_if_necessary(L, Main_current_layer);
|
Backup_if_necessary(L, Main.current_layer);
|
||||||
//
|
//
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
if (! ((1 << Main_current_layer) & Main_layers_visible))
|
if (! ((1 << Main.current_layer) & Main.layers_visible))
|
||||||
{
|
{
|
||||||
Main_layers_visible |= (1 << Main_current_layer);
|
Main.layers_visible |= (1 << Main.current_layer);
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2302,8 +2302,8 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
|
|||||||
const char* message;
|
const char* message;
|
||||||
byte old_cursor_shape=Cursor_shape;
|
byte old_cursor_shape=Cursor_shape;
|
||||||
char buf[MAX_PATH_CHARACTERS];
|
char buf[MAX_PATH_CHARACTERS];
|
||||||
int original_image_width=Main_image_width;
|
int original_image_width=Main.image_width;
|
||||||
int original_image_height=Main_image_height;
|
int original_image_height=Main.image_height;
|
||||||
|
|
||||||
// Some scripts are slow
|
// Some scripts are slow
|
||||||
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
||||||
@ -2499,8 +2499,8 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
|
|||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
|
|
||||||
// Update tilemap if image size has changed
|
// Update tilemap if image size has changed
|
||||||
if (original_image_width!=Main_image_width
|
if (original_image_width!=Main.image_width
|
||||||
|| original_image_height!=Main_image_height)
|
|| original_image_height!=Main.image_height)
|
||||||
{
|
{
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2760,8 +2760,8 @@ void Load_GIF(T_IO_Context * context)
|
|||||||
{
|
{
|
||||||
// Copy the content of previous layer.
|
// Copy the content of previous layer.
|
||||||
memcpy(
|
memcpy(
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
Main_backups->Pages->Image[Main_current_layer-1].Pixels,
|
Main_backups->Pages->Image[Main.current_layer-1].Pixels,
|
||||||
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2820,7 +2820,7 @@ void Load_GIF(T_IO_Context * context)
|
|||||||
int y;
|
int y;
|
||||||
for (y=0; y<previous_height; y++)
|
for (y=0; y<previous_height; y++)
|
||||||
memset(
|
memset(
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels
|
Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ (previous_pos_y+y)* Main_backups->Pages->Width+previous_pos_x,
|
+ (previous_pos_y+y)* Main_backups->Pages->Width+previous_pos_x,
|
||||||
is_transparent ? context->Transparent_color : LSDB.Backcol,
|
is_transparent ? context->Transparent_color : LSDB.Backcol,
|
||||||
previous_width);
|
previous_width);
|
||||||
|
|||||||
@ -2199,10 +2199,10 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
|
|||||||
|
|
||||||
// On restaure les données de l'image qui ont certainement été modifiées
|
// On restaure les données de l'image qui ont certainement été modifiées
|
||||||
// par la preview.
|
// par la preview.
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Back_color=initial_back_color;
|
Back_color=initial_back_color;
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
temp=(Window_pos_Y+(Window_height*Menu_factor_Y)<Menu_Y_before_window);
|
temp=(Window_pos_Y+(Window_height*Menu_factor_Y)<Menu_Y_before_window);
|
||||||
|
|
||||||
Close_window();
|
Close_window();
|
||||||
|
|||||||
15
src/global.h
15
src/global.h
@ -287,8 +287,11 @@ GFX2_GLOBAL int Pixel_height;
|
|||||||
|
|
||||||
// -- Current image data
|
// -- Current image data
|
||||||
|
|
||||||
|
GFX2_GLOBAL T_Document Main;
|
||||||
|
|
||||||
/// Pointer to the pixel data of the main image
|
/// Pointer to the pixel data of the main image
|
||||||
GFX2_GLOBAL byte * Main_screen;
|
GFX2_GLOBAL byte * Main_screen;
|
||||||
|
#if 0
|
||||||
/// Palette of the main image
|
/// Palette of the main image
|
||||||
GFX2_GLOBAL T_Palette Main_palette;
|
GFX2_GLOBAL T_Palette Main_palette;
|
||||||
/// Boolean, means the image has been modified since last save.
|
/// Boolean, means the image has been modified since last save.
|
||||||
@ -337,11 +340,14 @@ GFX2_GLOBAL long Main_edits_since_safety_backup;
|
|||||||
GFX2_GLOBAL Uint32 Main_time_of_safety_backup;
|
GFX2_GLOBAL Uint32 Main_time_of_safety_backup;
|
||||||
/// Letter prefix for the filenames of safety backups. a or b
|
/// Letter prefix for the filenames of safety backups. a or b
|
||||||
GFX2_GLOBAL byte Main_safety_backup_prefix;
|
GFX2_GLOBAL byte Main_safety_backup_prefix;
|
||||||
|
#endif
|
||||||
/// Lookup table for XOR effects, pointing each color to the most different one
|
/// Lookup table for XOR effects, pointing each color to the most different one
|
||||||
GFX2_GLOBAL byte xor_lut[256];
|
GFX2_GLOBAL byte xor_lut[256];
|
||||||
|
|
||||||
// -- Spare page data
|
// -- Spare page data
|
||||||
|
|
||||||
|
GFX2_GLOBAL T_Document Spare;
|
||||||
|
#if 0
|
||||||
/// Palette of the spare page
|
/// Palette of the spare page
|
||||||
GFX2_GLOBAL T_Palette Spare_palette;
|
GFX2_GLOBAL T_Palette Spare_palette;
|
||||||
/// Boolean, means the spare page has been modified since last save.
|
/// Boolean, means the spare page has been modified since last save.
|
||||||
@ -394,15 +400,16 @@ GFX2_GLOBAL long Spare_edits_since_safety_backup;
|
|||||||
GFX2_GLOBAL Uint32 Spare_time_of_safety_backup;
|
GFX2_GLOBAL Uint32 Spare_time_of_safety_backup;
|
||||||
/// Letter prefix for the filenames of safety backups. a or b
|
/// Letter prefix for the filenames of safety backups. a or b
|
||||||
GFX2_GLOBAL byte Spare_safety_backup_prefix;
|
GFX2_GLOBAL byte Spare_safety_backup_prefix;
|
||||||
|
#endif
|
||||||
|
|
||||||
// -- Image backups
|
// -- Image backups
|
||||||
|
|
||||||
/// Backup of the current screen, used during drawing when FX feedback is OFF.
|
/// Backup of the current screen, used during drawing when FX feedback is OFF.
|
||||||
GFX2_GLOBAL byte * Screen_backup;
|
GFX2_GLOBAL byte * Screen_backup;
|
||||||
/// List of backup pages for the main image.
|
/// List of backup pages for the main image.
|
||||||
GFX2_GLOBAL T_List_of_pages * Main_backups;
|
GFX2_GLOBAL T_List_of_pages * Main_backups;//TODO
|
||||||
/// List of backup pages for the spare page.
|
/// List of backup pages for the spare page.
|
||||||
GFX2_GLOBAL T_List_of_pages * Spare_backups;
|
GFX2_GLOBAL T_List_of_pages * Spare_backups;//TODO
|
||||||
|
|
||||||
|
|
||||||
// -- Brush data
|
// -- Brush data
|
||||||
@ -655,10 +662,10 @@ GFX2_GLOBAL byte Mask_table[256];
|
|||||||
// -- Tilemap mode
|
// -- Tilemap mode
|
||||||
|
|
||||||
/// Tilemap mode for main page
|
/// Tilemap mode for main page
|
||||||
GFX2_GLOBAL byte Main_tilemap_mode;
|
//GFX2_GLOBAL byte Main_tilemap_mode;
|
||||||
|
|
||||||
/// Tilemap mode for spare page
|
/// Tilemap mode for spare page
|
||||||
GFX2_GLOBAL byte Spare_tilemap_mode;
|
//GFX2_GLOBAL byte Spare_tilemap_mode;
|
||||||
|
|
||||||
// -- Magnifier data
|
// -- Magnifier data
|
||||||
|
|
||||||
|
|||||||
356
src/graph.c
356
src/graph.c
@ -92,7 +92,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
height = ((height - 1) | 0x7) + 1;
|
height = ((height - 1) | 0x7) + 1;
|
||||||
|
|
||||||
// Update "normal" view
|
// Update "normal" view
|
||||||
diff = x-Main_offset_X;
|
diff = x-Main.offset_X;
|
||||||
if (diff<0)
|
if (diff<0)
|
||||||
{
|
{
|
||||||
effective_w = width + diff;
|
effective_w = width + diff;
|
||||||
@ -103,7 +103,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
effective_w = width;
|
effective_w = width;
|
||||||
effective_X = diff;
|
effective_X = diff;
|
||||||
}
|
}
|
||||||
diff = y-Main_offset_Y;
|
diff = y-Main.offset_Y;
|
||||||
if (diff<0)
|
if (diff<0)
|
||||||
{
|
{
|
||||||
effective_h = height + diff;
|
effective_h = height + diff;
|
||||||
@ -119,8 +119,8 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
// exceptions:
|
// exceptions:
|
||||||
// - Brush preview requests updates outside the visible screen,
|
// - Brush preview requests updates outside the visible screen,
|
||||||
// - ZX/Thomson constraints can lead to pixel changes outside the visible area.
|
// - ZX/Thomson constraints can lead to pixel changes outside the visible area.
|
||||||
if(Main_magnifier_mode && effective_X + effective_w > Main_separator_position)
|
if(Main.magnifier_mode && effective_X + effective_w > Main.separator_position)
|
||||||
effective_w = Main_separator_position - effective_X;
|
effective_w = Main.separator_position - effective_X;
|
||||||
else if(effective_X + effective_w > Screen_width)
|
else if(effective_X + effective_w > Screen_width)
|
||||||
effective_w = Screen_width - effective_X;
|
effective_w = Screen_width - effective_X;
|
||||||
|
|
||||||
@ -138,13 +138,13 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
Update_rect(effective_X,effective_Y,effective_w,effective_h);
|
Update_rect(effective_X,effective_Y,effective_w,effective_h);
|
||||||
|
|
||||||
// Now update the "zoomed" part of the display
|
// Now update the "zoomed" part of the display
|
||||||
if(Main_magnifier_mode)
|
if(Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// Convert picture to zoomed-screen coordinates
|
// Convert picture to zoomed-screen coordinates
|
||||||
effective_X = (x-Main_magnifier_offset_X)*Main_magnifier_factor;
|
effective_X = (x-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
effective_Y = (y-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
effective_Y = (y-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
effective_w = width * Main_magnifier_factor;
|
effective_w = width * Main.magnifier_factor;
|
||||||
effective_h = height * Main_magnifier_factor;
|
effective_h = height * Main.magnifier_factor;
|
||||||
|
|
||||||
// Apply horizontal clipping
|
// Apply horizontal clipping
|
||||||
if (effective_X < 0)
|
if (effective_X < 0)
|
||||||
@ -153,11 +153,11 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
if (effective_w<0)
|
if (effective_w<0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
effective_X = Main_separator_position + SEPARATOR_WIDTH*Menu_factor_X;
|
effective_X = Main.separator_position + SEPARATOR_WIDTH*Menu_factor_X;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
effective_X += Main_separator_position + SEPARATOR_WIDTH*Menu_factor_X;
|
effective_X += Main.separator_position + SEPARATOR_WIDTH*Menu_factor_X;
|
||||||
diff = effective_X+effective_w-Min(Screen_width, Main_X_zoom+(Main_image_width-Main_magnifier_offset_X)*Main_magnifier_factor);
|
diff = effective_X+effective_w-Min(Screen_width, Main.X_zoom+(Main.image_width-Main.magnifier_offset_X)*Main.magnifier_factor);
|
||||||
if (diff>0)
|
if (diff>0)
|
||||||
{
|
{
|
||||||
effective_w -=diff;
|
effective_w -=diff;
|
||||||
@ -174,7 +174,7 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
return;
|
return;
|
||||||
effective_Y = 0;
|
effective_Y = 0;
|
||||||
}
|
}
|
||||||
diff = effective_Y+effective_h-Min(Menu_Y, (Main_image_height-Main_magnifier_offset_Y)*Main_magnifier_factor);
|
diff = effective_Y+effective_h-Min(Menu_Y, (Main.image_height-Main.magnifier_offset_Y)*Main.magnifier_factor);
|
||||||
if (diff>0)
|
if (diff>0)
|
||||||
{
|
{
|
||||||
effective_h -=diff;
|
effective_h -=diff;
|
||||||
@ -196,17 +196,17 @@ void Update_part_of_screen(short x, short y, short width, short height)
|
|||||||
// In this case, the whole magnified area requires a refreshed grid.
|
// In this case, the whole magnified area requires a refreshed grid.
|
||||||
// This could be optimized further, but at the moment this seemed
|
// This could be optimized further, but at the moment this seemed
|
||||||
// fast enough.
|
// fast enough.
|
||||||
if (Show_grid && Main_tilemap_mode && (
|
if (Show_grid && Main.tilemap_mode && (
|
||||||
x/Snap_width <(x+width )/Snap_width ||
|
x/Snap_width <(x+width )/Snap_width ||
|
||||||
y/Snap_height<(y+height)/Snap_height))
|
y/Snap_height<(y+height)/Snap_height))
|
||||||
{
|
{
|
||||||
short w,h;
|
short w,h;
|
||||||
|
|
||||||
w=Min(Screen_width-Main_X_zoom, (Main_image_width-Main_magnifier_offset_X)*Main_magnifier_factor);
|
w=Min(Screen_width-Main.X_zoom, (Main.image_width-Main.magnifier_offset_X)*Main.magnifier_factor);
|
||||||
h=Min(Menu_Y, (Main_image_height-Main_magnifier_offset_Y)*Main_magnifier_factor);
|
h=Min(Menu_Y, (Main.image_height-Main.magnifier_offset_Y)*Main.magnifier_factor);
|
||||||
|
|
||||||
Redraw_grid(Main_X_zoom,0,w,h);
|
Redraw_grid(Main.X_zoom,0,w,h);
|
||||||
Update_rect(Main_X_zoom,0,w,h);
|
Update_rect(Main.X_zoom,0,w,h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -447,9 +447,9 @@ try_again:
|
|||||||
|
|
||||||
free(Horizontal_line_buffer);
|
free(Horizontal_line_buffer);
|
||||||
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
|
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
|
||||||
((Screen_width>Main_image_width)?Screen_width:Main_image_width));
|
((Screen_width>Main.image_width)?Screen_width:Main.image_width));
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
|
|
||||||
Current_resolution=0;
|
Current_resolution=0;
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
@ -483,11 +483,11 @@ try_again:
|
|||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
Set_mouse_position();
|
Set_mouse_position();
|
||||||
|
|
||||||
Spare_offset_X=0; // | Il faut penser à éviter les incohérences
|
Spare.offset_X=0; // | Il faut penser à éviter les incohérences
|
||||||
Spare_offset_Y=0; // |- de décalage du brouillon par rapport à
|
Spare.offset_Y=0; // |- de décalage du brouillon par rapport à
|
||||||
Spare_magnifier_mode=0; // | la résolution.
|
Spare.magnifier_mode=0; // | la résolution.
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Pixel_preview=Pixel_preview_magnifier;
|
Pixel_preview=Pixel_preview_magnifier;
|
||||||
}
|
}
|
||||||
@ -495,18 +495,18 @@ try_again:
|
|||||||
{
|
{
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
// Recaler la vue (meme clipping que dans Scroll_screen())
|
// Recaler la vue (meme clipping que dans Scroll_screen())
|
||||||
if (Main_offset_X+Screen_width>Main_image_width)
|
if (Main.offset_X+Screen_width>Main.image_width)
|
||||||
Main_offset_X=Main_image_width-Screen_width;
|
Main.offset_X=Main.image_width-Screen_width;
|
||||||
if (Main_offset_X<0)
|
if (Main.offset_X<0)
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
if (Main_offset_Y+Menu_Y>Main_image_height)
|
if (Main.offset_Y+Menu_Y>Main.image_height)
|
||||||
Main_offset_Y=Main_image_height-Menu_Y;
|
Main.offset_Y=Main.image_height-Menu_Y;
|
||||||
if (Main_offset_Y<0)
|
if (Main.offset_Y<0)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
@ -522,8 +522,8 @@ try_again:
|
|||||||
|
|
||||||
void Resize_image(word chosen_width,word chosen_height)
|
void Resize_image(word chosen_width,word chosen_height)
|
||||||
{
|
{
|
||||||
word old_width=Main_image_width;
|
word old_width=Main.image_width;
|
||||||
word old_height=Main_image_height;
|
word old_height=Main.image_height;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// +-+-+
|
// +-+-+
|
||||||
@ -536,17 +536,17 @@ void Resize_image(word chosen_width,word chosen_height)
|
|||||||
if (Backup_with_new_dimensions(chosen_width,chosen_height))
|
if (Backup_with_new_dimensions(chosen_width,chosen_height))
|
||||||
{
|
{
|
||||||
// La nouvelle page a pu être allouée, elle est pour l'instant pleine de
|
// La nouvelle page a pu être allouée, elle est pour l'instant pleine de
|
||||||
// 0s. Elle fait Main_image_width de large.
|
// 0s. Elle fait Main.image_width de large.
|
||||||
|
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
|
|
||||||
// On copie donc maintenant la partie C dans la nouvelle image.
|
// On copie donc maintenant la partie C dans la nouvelle image.
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Main_image_width),
|
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Main.image_width),
|
||||||
Min(old_height,Main_image_height),old_width,
|
Min(old_height,Main.image_height),old_width,
|
||||||
Main_backups->Pages->Image[i].Pixels,0,0,Main_image_width);
|
Main_backups->Pages->Image[i].Pixels,0,0,Main.image_width);
|
||||||
}
|
}
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
}
|
}
|
||||||
@ -575,9 +575,9 @@ void Remap_spare(void)
|
|||||||
|
|
||||||
// On calcule la table d'utilisation des couleurs
|
// On calcule la table d'utilisation des couleurs
|
||||||
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
||||||
for (y_pos=0;y_pos<Spare_image_height;y_pos++)
|
for (y_pos=0;y_pos<Spare.image_height;y_pos++)
|
||||||
for (x_pos=0;x_pos<Spare_image_width;x_pos++)
|
for (x_pos=0;x_pos<Spare.image_width;x_pos++)
|
||||||
used[*(Spare_backups->Pages->Image[layer].Pixels+(y_pos*Spare_image_width+x_pos))]=1;
|
used[*(Spare_backups->Pages->Image[layer].Pixels+(y_pos*Spare.image_width+x_pos))]=1;
|
||||||
|
|
||||||
// On va maintenant se servir de la table "used" comme table de
|
// On va maintenant se servir de la table "used" comme table de
|
||||||
// conversion: pour chaque indice, la table donne une couleur de
|
// conversion: pour chaque indice, la table donne une couleur de
|
||||||
@ -588,13 +588,13 @@ void Remap_spare(void)
|
|||||||
// ne seront pas utilisées par Remap_general_lowlevel.
|
// ne seront pas utilisées par Remap_general_lowlevel.
|
||||||
for (color=0;color<=255;color++)
|
for (color=0;color<=255;color++)
|
||||||
if (used[color])
|
if (used[color])
|
||||||
used[color]=Best_color_perceptual(Spare_palette[color].R,Spare_palette[color].G,Spare_palette[color].B);
|
used[color]=Best_color_perceptual(Spare.palette[color].R,Spare.palette[color].G,Spare.palette[color].B);
|
||||||
|
|
||||||
// Maintenant qu'on a une super table de conversion qui n'a que le nom
|
// Maintenant qu'on a une super table de conversion qui n'a que le nom
|
||||||
// qui craint un peu, on peut faire l'échange dans la brosse de toutes les
|
// qui craint un peu, on peut faire l'échange dans la brosse de toutes les
|
||||||
// teintes.
|
// teintes.
|
||||||
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
||||||
Remap_general_lowlevel(used,Spare_backups->Pages->Image[layer].Pixels,Spare_backups->Pages->Image[layer].Pixels,Spare_image_width,Spare_image_height,Spare_image_width);
|
Remap_general_lowlevel(used,Spare_backups->Pages->Image[layer].Pixels,Spare_backups->Pages->Image[layer].Pixels,Spare.image_width,Spare.image_height,Spare.image_width);
|
||||||
|
|
||||||
// Change transparent color index
|
// Change transparent color index
|
||||||
Spare_backups->Pages->Transparent_color=used[Spare_backups->Pages->Transparent_color];
|
Spare_backups->Pages->Transparent_color=used[Spare_backups->Pages->Transparent_color];
|
||||||
@ -637,9 +637,9 @@ void Get_colors_from_brush(void)
|
|||||||
// Try locate it in current palette
|
// Try locate it in current palette
|
||||||
for (image_color=0; image_color<256; image_color++)
|
for (image_color=0; image_color<256; image_color++)
|
||||||
{
|
{
|
||||||
if (Brush_original_palette[color].R==Main_palette[image_color].R
|
if (Brush_original_palette[color].R==Main.palette[image_color].R
|
||||||
&& Brush_original_palette[color].G==Main_palette[image_color].G
|
&& Brush_original_palette[color].G==Main.palette[image_color].G
|
||||||
&& Brush_original_palette[color].B==Main_palette[image_color].B)
|
&& Brush_original_palette[color].B==Main.palette[image_color].B)
|
||||||
{
|
{
|
||||||
// Color already in main palette:
|
// Color already in main palette:
|
||||||
|
|
||||||
@ -668,9 +668,9 @@ void Get_colors_from_brush(void)
|
|||||||
if (!usage[image_color])
|
if (!usage[image_color])
|
||||||
{
|
{
|
||||||
// Copy from color to image_color
|
// Copy from color to image_color
|
||||||
Main_palette[image_color].R=Brush_original_palette[color].R;
|
Main.palette[image_color].R=Brush_original_palette[color].R;
|
||||||
Main_palette[image_color].G=Brush_original_palette[color].G;
|
Main.palette[image_color].G=Brush_original_palette[color].G;
|
||||||
Main_palette[image_color].B=Brush_original_palette[color].B;
|
Main.palette[image_color].B=Brush_original_palette[color].B;
|
||||||
|
|
||||||
image_color++;
|
image_color++;
|
||||||
break;
|
break;
|
||||||
@ -680,15 +680,15 @@ void Get_colors_from_brush(void)
|
|||||||
}
|
}
|
||||||
Remap_brush();
|
Remap_brush();
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_menu();
|
Display_menu();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
|
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
|
|
||||||
byte Read_pixel_from_backup_layer(word x,word y)
|
byte Read_pixel_from_backup_layer(word x,word y)
|
||||||
{
|
{
|
||||||
return *((y)*Main_image_width+(x)+Main_backups->Pages->Next->Image[Main_current_layer].Pixels);
|
return *((y)*Main.image_width+(x)+Main_backups->Pages->Next->Image[Main.current_layer].Pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fill_general(byte fill_color)
|
void Fill_general(byte fill_color)
|
||||||
@ -920,15 +920,15 @@ void Fill_general(byte fill_color)
|
|||||||
(Paintbrush_Y<=Limit_bottom) )
|
(Paintbrush_Y<=Limit_bottom) )
|
||||||
{
|
{
|
||||||
// If tilemap mode is ON, ignore action if it's outside grid limits
|
// If tilemap mode is ON, ignore action if it's outside grid limits
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
{
|
{
|
||||||
if (Paintbrush_X<Snap_offset_X)
|
if (Paintbrush_X<Snap_offset_X)
|
||||||
return;
|
return;
|
||||||
if (Paintbrush_X >= (Main_image_width-Snap_offset_X)/Snap_width*Snap_width+Snap_offset_X)
|
if (Paintbrush_X >= (Main.image_width-Snap_offset_X)/Snap_width*Snap_width+Snap_offset_X)
|
||||||
return;
|
return;
|
||||||
if (Paintbrush_Y<Snap_offset_Y)
|
if (Paintbrush_Y<Snap_offset_Y)
|
||||||
return;
|
return;
|
||||||
if (Paintbrush_Y >= (Main_image_height-Snap_offset_Y)/Snap_height*Snap_height+Snap_offset_Y)
|
if (Paintbrush_Y >= (Main.image_height-Snap_offset_Y)/Snap_height*Snap_height+Snap_offset_Y)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,7 +948,7 @@ void Fill_general(byte fill_color)
|
|||||||
Update_FX_feedback(0);
|
Update_FX_feedback(0);
|
||||||
|
|
||||||
// If tilemap mode is ON, adapt limits to current tile only
|
// If tilemap mode is ON, adapt limits to current tile only
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
{
|
{
|
||||||
Limit_right = Min(Limit_right, (Paintbrush_X-Snap_offset_X)/Snap_width*Snap_width+Snap_width-1+Snap_offset_X);
|
Limit_right = Min(Limit_right, (Paintbrush_X-Snap_offset_X)/Snap_width*Snap_width+Snap_width-1+Snap_offset_X);
|
||||||
Limit_left = Max(Limit_left, (Paintbrush_X-Snap_offset_X)/Snap_width*Snap_width+Snap_offset_X);
|
Limit_left = Max(Limit_left, (Paintbrush_X-Snap_offset_X)/Snap_width*Snap_width+Snap_offset_X);
|
||||||
@ -973,35 +973,35 @@ void Fill_general(byte fill_color)
|
|||||||
// Il va maintenant falloir qu'on "turn" ce gros caca "into" un truc qui
|
// Il va maintenant falloir qu'on "turn" ce gros caca "into" un truc qui
|
||||||
// ressemble un peu plus à ce à quoi l'utilisateur peut s'attendre.
|
// ressemble un peu plus à ce à quoi l'utilisateur peut s'attendre.
|
||||||
if (top_reached>Limit_top)
|
if (top_reached>Limit_top)
|
||||||
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer].Pixels, // source
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main.current_layer].Pixels, // source
|
||||||
Limit_left,Limit_top, // Pos X et Y dans source
|
Limit_left,Limit_top, // Pos X et Y dans source
|
||||||
(Limit_right-Limit_left)+1, // width copie
|
(Limit_right-Limit_left)+1, // width copie
|
||||||
top_reached-Limit_top,// height copie
|
top_reached-Limit_top,// height copie
|
||||||
Main_image_width, // width de la source
|
Main.image_width, // width de la source
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels, // Destination
|
Main_backups->Pages->Image[Main.current_layer].Pixels, // Destination
|
||||||
Limit_left,Limit_top, // Pos X et Y destination
|
Limit_left,Limit_top, // Pos X et Y destination
|
||||||
Main_image_width); // width destination
|
Main.image_width); // width destination
|
||||||
if (bottom_reached<Limit_bottom)
|
if (bottom_reached<Limit_bottom)
|
||||||
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer].Pixels,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main.current_layer].Pixels,
|
||||||
Limit_left,bottom_reached+1,
|
Limit_left,bottom_reached+1,
|
||||||
(Limit_right-Limit_left)+1,
|
(Limit_right-Limit_left)+1,
|
||||||
Limit_bottom-bottom_reached,
|
Limit_bottom-bottom_reached,
|
||||||
Main_image_width,Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main.image_width,Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
Limit_left,bottom_reached+1,Main_image_width);
|
Limit_left,bottom_reached+1,Main.image_width);
|
||||||
if (left_reached>Limit_left)
|
if (left_reached>Limit_left)
|
||||||
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer].Pixels,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main.current_layer].Pixels,
|
||||||
Limit_left,top_reached,
|
Limit_left,top_reached,
|
||||||
left_reached-Limit_left,
|
left_reached-Limit_left,
|
||||||
(bottom_reached-top_reached)+1,
|
(bottom_reached-top_reached)+1,
|
||||||
Main_image_width,Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main.image_width,Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
Limit_left,top_reached,Main_image_width);
|
Limit_left,top_reached,Main.image_width);
|
||||||
if (right_reached<Limit_right)
|
if (right_reached<Limit_right)
|
||||||
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer].Pixels,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main.current_layer].Pixels,
|
||||||
right_reached+1,top_reached,
|
right_reached+1,top_reached,
|
||||||
Limit_right-right_reached,
|
Limit_right-right_reached,
|
||||||
(bottom_reached-top_reached)+1,
|
(bottom_reached-top_reached)+1,
|
||||||
Main_image_width,Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main.image_width,Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
right_reached+1,top_reached,Main_image_width);
|
right_reached+1,top_reached,Main.image_width);
|
||||||
|
|
||||||
// Restore image limits : this is needed by the tilemap effect,
|
// Restore image limits : this is needed by the tilemap effect,
|
||||||
// otherwise it will not display other modified tiles.
|
// otherwise it will not display other modified tiles.
|
||||||
@ -1035,14 +1035,14 @@ void Fill_general(byte fill_color)
|
|||||||
// puisque les seuls points qui ont changé dans l'image ont été raffichés
|
// puisque les seuls points qui ont changé dans l'image ont été raffichés
|
||||||
// par l'utilisation de "Display_pixel()", et que les autres... eh bein
|
// par l'utilisation de "Display_pixel()", et que les autres... eh bein
|
||||||
// on n'y a jamais touché à l'écran les autres: ils sont donc corrects.
|
// on n'y a jamais touché à l'écran les autres: ils sont donc corrects.
|
||||||
if(Main_magnifier_mode)
|
if(Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
short w,h;
|
short w,h;
|
||||||
|
|
||||||
w=Min(Screen_width-Main_X_zoom, (Main_image_width-Main_magnifier_offset_X)*Main_magnifier_factor);
|
w=Min(Screen_width-Main.X_zoom, (Main.image_width-Main.magnifier_offset_X)*Main.magnifier_factor);
|
||||||
h=Min(Menu_Y, (Main_image_height-Main_magnifier_offset_Y)*Main_magnifier_factor);
|
h=Min(Menu_Y, (Main.image_height-Main.magnifier_offset_Y)*Main.magnifier_factor);
|
||||||
|
|
||||||
Redraw_grid(Main_X_zoom,0,w,h);
|
Redraw_grid(Main.X_zoom,0,w,h);
|
||||||
}
|
}
|
||||||
|
|
||||||
Update_rect(0,0,0,0);
|
Update_rect(0,0,0,0);
|
||||||
@ -1124,8 +1124,8 @@ void Fill_general(byte fill_color)
|
|||||||
(x_pos<=Limit_right) &&
|
(x_pos<=Limit_right) &&
|
||||||
(y_pos>=Limit_top) &&
|
(y_pos>=Limit_top) &&
|
||||||
(y_pos<=Limit_bottom) )
|
(y_pos<=Limit_bottom) )
|
||||||
Pixel_preview(x_pos,y_pos,xor_lut[Read_pixel(x_pos-Main_offset_X,
|
Pixel_preview(x_pos,y_pos,xor_lut[Read_pixel(x_pos-Main.offset_X,
|
||||||
y_pos-Main_offset_Y)]);
|
y_pos-Main.offset_Y)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage d'un point pour une preview en xor additif
|
// Affichage d'un point pour une preview en xor additif
|
||||||
@ -1138,7 +1138,7 @@ void Fill_general(byte fill_color)
|
|||||||
(x_pos<=Limit_right) &&
|
(x_pos<=Limit_right) &&
|
||||||
(y_pos>=Limit_top) &&
|
(y_pos>=Limit_top) &&
|
||||||
(y_pos<=Limit_bottom) )
|
(y_pos<=Limit_bottom) )
|
||||||
Pixel_preview(x_pos,y_pos,xor_lut[Main_screen[x_pos+y_pos*Main_image_width]]);
|
Pixel_preview(x_pos,y_pos,xor_lut[Main_screen[x_pos+y_pos*Main.image_width]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2562,7 +2562,7 @@ void Polyfill_general(int vertices, short * points, int color)
|
|||||||
initial_edge = NULL;
|
initial_edge = NULL;
|
||||||
|
|
||||||
// On ne connait pas simplement les xmin et xmax ici, mais de toutes façon ce n'est pas utilisé en preview
|
// On ne connait pas simplement les xmin et xmax ici, mais de toutes façon ce n'est pas utilisé en preview
|
||||||
Update_part_of_screen(0,top,Main_image_width,bottom-top+1);
|
Update_part_of_screen(0,top,Main.image_width,bottom-top+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2606,8 +2606,8 @@ void Replace(byte new_color)
|
|||||||
{
|
{
|
||||||
byte old_color;
|
byte old_color;
|
||||||
|
|
||||||
if ((Paintbrush_X<Main_image_width)
|
if ((Paintbrush_X<Main.image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height))
|
&& (Paintbrush_Y<Main.image_height))
|
||||||
{
|
{
|
||||||
old_color=Read_pixel_from_current_layer(Paintbrush_X,Paintbrush_Y);
|
old_color=Read_pixel_from_current_layer(Paintbrush_X,Paintbrush_Y);
|
||||||
if ( (old_color!=new_color)
|
if ( (old_color!=new_color)
|
||||||
@ -2617,8 +2617,8 @@ void Replace(byte new_color)
|
|||||||
word y;
|
word y;
|
||||||
|
|
||||||
// Update all pixels
|
// Update all pixels
|
||||||
for (y=0; y<Main_image_height; y++)
|
for (y=0; y<Main.image_height; y++)
|
||||||
for (x=0; x<Main_image_width; x++)
|
for (x=0; x<Main.image_width; x++)
|
||||||
if (Read_pixel_from_current_layer(x,y) == old_color)
|
if (Read_pixel_from_current_layer(x,y) == old_color)
|
||||||
Pixel_in_current_screen(x,y,new_color);
|
Pixel_in_current_screen(x,y,new_color);
|
||||||
}
|
}
|
||||||
@ -2712,7 +2712,7 @@ void Display_pixel(word x,word y,byte color)
|
|||||||
&& (!((Mask_mode) && (Mask_table[Read_pixel_from_spare_screen(x,y)]))) )
|
&& (!((Mask_mode) && (Mask_table[Read_pixel_from_spare_screen(x,y)]))) )
|
||||||
{
|
{
|
||||||
color=Effect_function(x,y,color);
|
color=Effect_function(x,y,color);
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
{
|
{
|
||||||
Tilemap_draw(x,y, color);
|
Tilemap_draw(x,y, color);
|
||||||
}
|
}
|
||||||
@ -2808,40 +2808,40 @@ byte Effect_smooth(word x,word y,byte color)
|
|||||||
int r,g,b;
|
int r,g,b;
|
||||||
byte c;
|
byte c;
|
||||||
int weight,total_weight;
|
int weight,total_weight;
|
||||||
byte x2=((x+1)<Main_image_width);
|
byte x2=((x+1)<Main.image_width);
|
||||||
byte y2=((y+1)<Main_image_height);
|
byte y2=((y+1)<Main.image_height);
|
||||||
(void)color; // unused
|
(void)color; // unused
|
||||||
|
|
||||||
// On commence par le pixel central
|
// On commence par le pixel central
|
||||||
c=Read_pixel_from_feedback_screen(x,y);
|
c=Read_pixel_from_feedback_screen(x,y);
|
||||||
total_weight=Smooth_matrix[1][1];
|
total_weight=Smooth_matrix[1][1];
|
||||||
r=total_weight*Main_palette[c].R;
|
r=total_weight*Main.palette[c].R;
|
||||||
g=total_weight*Main_palette[c].G;
|
g=total_weight*Main.palette[c].G;
|
||||||
b=total_weight*Main_palette[c].B;
|
b=total_weight*Main.palette[c].B;
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x-1,y);
|
c=Read_pixel_from_feedback_screen(x-1,y);
|
||||||
total_weight+=(weight=Smooth_matrix[0][1]);
|
total_weight+=(weight=Smooth_matrix[0][1]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
|
|
||||||
if (y)
|
if (y)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x-1,y-1);
|
c=Read_pixel_from_feedback_screen(x-1,y-1);
|
||||||
total_weight+=(weight=Smooth_matrix[0][0]);
|
total_weight+=(weight=Smooth_matrix[0][0]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
|
|
||||||
if (y2)
|
if (y2)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x-1,y+1);
|
c=Read_pixel_from_feedback_screen(x-1,y+1);
|
||||||
total_weight+=(weight=Smooth_matrix[0][2]);
|
total_weight+=(weight=Smooth_matrix[0][2]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2850,25 +2850,25 @@ byte Effect_smooth(word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x+1,y);
|
c=Read_pixel_from_feedback_screen(x+1,y);
|
||||||
total_weight+=(weight=Smooth_matrix[2][1]);
|
total_weight+=(weight=Smooth_matrix[2][1]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
|
|
||||||
if (y)
|
if (y)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x+1,y-1);
|
c=Read_pixel_from_feedback_screen(x+1,y-1);
|
||||||
total_weight+=(weight=Smooth_matrix[2][0]);
|
total_weight+=(weight=Smooth_matrix[2][0]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
|
|
||||||
if (y2)
|
if (y2)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x+1,y+1);
|
c=Read_pixel_from_feedback_screen(x+1,y+1);
|
||||||
total_weight+=(weight=Smooth_matrix[2][2]);
|
total_weight+=(weight=Smooth_matrix[2][2]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2877,18 +2877,18 @@ byte Effect_smooth(word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x,y-1);
|
c=Read_pixel_from_feedback_screen(x,y-1);
|
||||||
total_weight+=(weight=Smooth_matrix[1][0]);
|
total_weight+=(weight=Smooth_matrix[1][0]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y2)
|
if (y2)
|
||||||
{
|
{
|
||||||
c=Read_pixel_from_feedback_screen(x,y+1);
|
c=Read_pixel_from_feedback_screen(x,y+1);
|
||||||
total_weight+=(weight=Smooth_matrix[1][2]);
|
total_weight+=(weight=Smooth_matrix[1][2]);
|
||||||
r+=weight*Main_palette[c].R;
|
r+=weight*Main.palette[c].R;
|
||||||
g+=weight*Main_palette[c].G;
|
g+=weight*Main.palette[c].G;
|
||||||
b+=weight*Main_palette[c].B;
|
b+=weight*Main.palette[c].B;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (total_weight)? // On regarde s'il faut éviter le 0/0.
|
return (total_weight)? // On regarde s'il faut éviter le 0/0.
|
||||||
@ -2903,7 +2903,7 @@ byte Effect_layer_copy(word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
if (color<Main_backups->Pages->Nb_layers)
|
if (color<Main_backups->Pages->Nb_layers)
|
||||||
{
|
{
|
||||||
return *((y)*Main_image_width+(x)+Main_backups->Pages->Image[color].Pixels);
|
return *((y)*Main.image_width+(x)+Main_backups->Pages->Image[color].Pixels);
|
||||||
}
|
}
|
||||||
return Read_pixel_from_feedback_screen(x,y);
|
return Read_pixel_from_feedback_screen(x,y);
|
||||||
}
|
}
|
||||||
@ -2931,18 +2931,18 @@ void Redraw_grid(short x, short y, unsigned short w, unsigned short h)
|
|||||||
if (!Show_grid)
|
if (!Show_grid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
row=y+((Snap_height*1000-(y-0)/Main_magnifier_factor-Main_magnifier_offset_Y+Snap_offset_Y-1)%Snap_height)*Main_magnifier_factor+Main_magnifier_factor-1;
|
row=y+((Snap_height*1000-(y-0)/Main.magnifier_factor-Main.magnifier_offset_Y+Snap_offset_Y-1)%Snap_height)*Main.magnifier_factor+Main.magnifier_factor-1;
|
||||||
while (row < y+h)
|
while (row < y+h)
|
||||||
{
|
{
|
||||||
Horizontal_grid_line(x, row, w);
|
Horizontal_grid_line(x, row, w);
|
||||||
row+= Snap_height*Main_magnifier_factor;
|
row+= Snap_height*Main.magnifier_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
col=x+((Snap_width*1000-(x-Main_X_zoom)/Main_magnifier_factor-Main_magnifier_offset_X+Snap_offset_X-1)%Snap_width)*Main_magnifier_factor+Main_magnifier_factor-1;
|
col=x+((Snap_width*1000-(x-Main.X_zoom)/Main.magnifier_factor-Main.magnifier_offset_X+Snap_offset_X-1)%Snap_width)*Main.magnifier_factor+Main.magnifier_factor-1;
|
||||||
while (col < x+w)
|
while (col < x+w)
|
||||||
{
|
{
|
||||||
Vertical_grid_line(col, y, h);
|
Vertical_grid_line(col, y, h);
|
||||||
col+= Snap_width*Main_magnifier_factor;
|
col+= Snap_width*Main.magnifier_factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2954,61 +2954,61 @@ byte Read_pixel_from_current_screen (word x,word y)
|
|||||||
|
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
return *((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer].Pixels);
|
return *((y)*Main.image_width+(x)+Main_backups->Pages->Image[Main.current_layer].Pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5)
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5)
|
||||||
if (Main_current_layer==4)
|
if (Main.current_layer==4)
|
||||||
return *(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width);
|
return *(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
color = *(Main_screen+y*Main_image_width+x);
|
color = *(Main_screen+y*Main.image_width+x);
|
||||||
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
||||||
return color;
|
return color;
|
||||||
|
|
||||||
depth = *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width);
|
depth = *(Main_visible_image_depth_buffer.Image+x+y*Main.image_width);
|
||||||
return *(Main_backups->Pages->Image[depth].Pixels + x+y*Main_image_width);
|
return *(Main_backups->Pages->Image[depth].Pixels + x+y*Main.image_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint a a single pixel in image only : as-is.
|
/// Paint a a single pixel in image only : as-is.
|
||||||
void Pixel_in_screen_direct(word x,word y,byte color)
|
void Pixel_in_screen_direct(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer].Pixels)=color;
|
*((y)*Main.image_width+(x)+Main_backups->Pages->Image[Main.current_layer].Pixels)=color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint a a single pixel in image and on screen: as-is.
|
/// Paint a a single pixel in image and on screen: as-is.
|
||||||
void Pixel_in_screen_direct_with_preview(word x,word y,byte color)
|
void Pixel_in_screen_direct_with_preview(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer].Pixels)=color;
|
*((y)*Main.image_width+(x)+Main_backups->Pages->Image[Main.current_layer].Pixels)=color;
|
||||||
Pixel_preview(x,y,color);
|
Pixel_preview(x,y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint a a single pixel in image only : using layered display.
|
/// Paint a a single pixel in image only : using layered display.
|
||||||
void Pixel_in_screen_layered(word x,word y,byte color)
|
void Pixel_in_screen_layered(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
byte depth = *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width);
|
byte depth = *(Main_visible_image_depth_buffer.Image+x+y*Main.image_width);
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
if ( depth <= Main_current_layer)
|
if ( depth <= Main.current_layer)
|
||||||
{
|
{
|
||||||
if (color == Main_backups->Pages->Transparent_color) // transparent color
|
if (color == Main_backups->Pages->Transparent_color) // transparent color
|
||||||
// fetch pixel color from the topmost visible layer
|
// fetch pixel color from the topmost visible layer
|
||||||
color=*(Main_backups->Pages->Image[depth].Pixels + x+y*Main_image_width);
|
color=*(Main_backups->Pages->Image[depth].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint a a single pixel in image and on screen : using layered display.
|
/// Paint a a single pixel in image and on screen : using layered display.
|
||||||
void Pixel_in_screen_layered_with_preview(word x,word y,byte color)
|
void Pixel_in_screen_layered_with_preview(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
byte depth = *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width);
|
byte depth = *(Main_visible_image_depth_buffer.Image+x+y*Main.image_width);
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
if ( depth <= Main_current_layer)
|
if ( depth <= Main.current_layer)
|
||||||
{
|
{
|
||||||
if (color == Main_backups->Pages->Transparent_color) // transparent color
|
if (color == Main_backups->Pages->Transparent_color) // transparent color
|
||||||
// fetch pixel color from the topmost visible layer
|
// fetch pixel color from the topmost visible layer
|
||||||
color=*(Main_backups->Pages->Image[depth].Pixels + x+y*Main_image_width);
|
color=*(Main_backups->Pages->Image[depth].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
|
|
||||||
Pixel_preview(x,y,color);
|
Pixel_preview(x,y,color);
|
||||||
}
|
}
|
||||||
@ -3059,14 +3059,14 @@ void Pixel_in_screen_thomson(word x,word y,byte color)
|
|||||||
uint8_t c1, c2;
|
uint8_t c1, c2;
|
||||||
|
|
||||||
// The color we are going to replace
|
// The color we are going to replace
|
||||||
c1 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width);
|
c1 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
if (c1 == color)
|
if (c1 == color)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + (x2+start)+y*Main_image_width);
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + (x2+start)+y*Main.image_width);
|
||||||
if (c2 == color)
|
if (c2 == color)
|
||||||
continue;
|
continue;
|
||||||
if (c2 != c1)
|
if (c2 != c1)
|
||||||
@ -3082,7 +3082,7 @@ void Pixel_in_screen_thomson(word x,word y,byte color)
|
|||||||
|
|
||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + (x2+start)+y*Main_image_width);
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + (x2+start)+y*Main.image_width);
|
||||||
if (c2 == c1) {
|
if (c2 == c1) {
|
||||||
Pixel_in_screen_layered(x2+start,y,color);
|
Pixel_in_screen_layered(x2+start,y,color);
|
||||||
}
|
}
|
||||||
@ -3096,14 +3096,14 @@ void Pixel_in_screen_thomson_with_preview(word x,word y,byte color)
|
|||||||
uint8_t c1, c2;
|
uint8_t c1, c2;
|
||||||
|
|
||||||
// The color we are going to replace
|
// The color we are going to replace
|
||||||
c1 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width);
|
c1 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
if (c1 == color)
|
if (c1 == color)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + (x2+start)+y*Main_image_width);
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + (x2+start)+y*Main.image_width);
|
||||||
if (c2 == color)
|
if (c2 == color)
|
||||||
continue;
|
continue;
|
||||||
if (c2 != c1)
|
if (c2 != c1)
|
||||||
@ -3119,7 +3119,7 @@ void Pixel_in_screen_thomson_with_preview(word x,word y,byte color)
|
|||||||
|
|
||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels + (x2+start)+y*Main_image_width);
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels + (x2+start)+y*Main.image_width);
|
||||||
if (c2 == c1) {
|
if (c2 == c1) {
|
||||||
Pixel_in_screen_layered_with_preview(x2+start,y,color);
|
Pixel_in_screen_layered_with_preview(x2+start,y,color);
|
||||||
}
|
}
|
||||||
@ -3134,8 +3134,8 @@ void Pixel_in_screen_zx(word x,word y,byte color)
|
|||||||
uint8_t c1, c2;
|
uint8_t c1, c2;
|
||||||
|
|
||||||
// The color we are going to replace
|
// The color we are going to replace
|
||||||
c1 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c1 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ x + y * Main_image_width);
|
+ x + y * Main.image_width);
|
||||||
|
|
||||||
if (c1 == color)
|
if (c1 == color)
|
||||||
return;
|
return;
|
||||||
@ -3144,8 +3144,8 @@ void Pixel_in_screen_zx(word x,word y,byte color)
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ (x2 + start) + (y2 + starty) * Main_image_width);
|
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
||||||
// Pixel is already of the color we are going to add, it is no problem
|
// Pixel is already of the color we are going to add, it is no problem
|
||||||
if (c2 == color)
|
if (c2 == color)
|
||||||
continue;
|
continue;
|
||||||
@ -3177,8 +3177,8 @@ done:
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ (x2 + start) + (y2 + starty) * Main_image_width);
|
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
||||||
if (c2 == c1) {
|
if (c2 == c1) {
|
||||||
Pixel_in_screen_layered(x2+start,y2+starty,color);
|
Pixel_in_screen_layered(x2+start,y2+starty,color);
|
||||||
} else {
|
} else {
|
||||||
@ -3196,8 +3196,8 @@ void Pixel_in_screen_zx_with_preview(word x,word y,byte color)
|
|||||||
uint8_t c1, c2;
|
uint8_t c1, c2;
|
||||||
|
|
||||||
// The color we are going to replace
|
// The color we are going to replace
|
||||||
c1 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c1 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ x + y * Main_image_width);
|
+ x + y * Main.image_width);
|
||||||
|
|
||||||
// Pixel is already of the wanted color: nothing to do
|
// Pixel is already of the wanted color: nothing to do
|
||||||
if (c1 == color)
|
if (c1 == color)
|
||||||
@ -3207,8 +3207,8 @@ void Pixel_in_screen_zx_with_preview(word x,word y,byte color)
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ (x2 + start) + (y2 + starty) * Main_image_width);
|
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
||||||
// Pixel is already of the color we are going to add, it is no problem
|
// Pixel is already of the color we are going to add, it is no problem
|
||||||
if (c2 == color)
|
if (c2 == color)
|
||||||
continue;
|
continue;
|
||||||
@ -3240,8 +3240,8 @@ done:
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main_backups->Pages->Image[Main_current_layer].Pixels
|
c2 = *(Main_backups->Pages->Image[Main.current_layer].Pixels
|
||||||
+ (x2 + start) + (y2 + starty) * Main_image_width);
|
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
||||||
if (c2 == c1) {
|
if (c2 == c1) {
|
||||||
Pixel_in_screen_layered_with_preview(x2+start,y2+starty,color);
|
Pixel_in_screen_layered_with_preview(x2+start,y2+starty,color);
|
||||||
} else {
|
} else {
|
||||||
@ -3257,14 +3257,14 @@ void Pixel_in_screen_underlay(word x,word y,byte color)
|
|||||||
byte depth;
|
byte depth;
|
||||||
|
|
||||||
// Paste in layer
|
// Paste in layer
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
// Search depth
|
// Search depth
|
||||||
depth = *(Main_backups->Pages->Image[4].Pixels + x+y*Main_image_width);
|
depth = *(Main_backups->Pages->Image[4].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
if ( depth == Main_current_layer)
|
if ( depth == Main.current_layer)
|
||||||
{
|
{
|
||||||
// Draw that color on the visible image buffer
|
// Draw that color on the visible image buffer
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3274,14 +3274,14 @@ void Pixel_in_screen_underlay_with_preview(word x,word y,byte color)
|
|||||||
byte depth;
|
byte depth;
|
||||||
|
|
||||||
// Paste in layer
|
// Paste in layer
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
// Search depth
|
// Search depth
|
||||||
depth = *(Main_backups->Pages->Image[4].Pixels + x+y*Main_image_width);
|
depth = *(Main_backups->Pages->Image[4].Pixels + x+y*Main.image_width);
|
||||||
|
|
||||||
if ( depth == Main_current_layer)
|
if ( depth == Main.current_layer)
|
||||||
{
|
{
|
||||||
// Draw that color on the visible image buffer
|
// Draw that color on the visible image buffer
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
|
|
||||||
Pixel_preview(x,y,color);
|
Pixel_preview(x,y,color);
|
||||||
}
|
}
|
||||||
@ -3293,14 +3293,14 @@ void Pixel_in_screen_overlay(word x,word y,byte color)
|
|||||||
if (color<4)
|
if (color<4)
|
||||||
{
|
{
|
||||||
// Paste in layer
|
// Paste in layer
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
// Paste in depth buffer
|
// Paste in depth buffer
|
||||||
*(Main_visible_image_depth_buffer.Image+x+y*Main_image_width)=color;
|
*(Main_visible_image_depth_buffer.Image+x+y*Main.image_width)=color;
|
||||||
// Fetch pixel color from the target raster layer
|
// Fetch pixel color from the target raster layer
|
||||||
if (Main_layers_visible & (1 << color))
|
if (Main.layers_visible & (1 << color))
|
||||||
color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width);
|
color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main.image_width);
|
||||||
// Draw that color on the visible image buffer
|
// Draw that color on the visible image buffer
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3310,14 +3310,14 @@ void Pixel_in_screen_overlay_with_preview(word x,word y,byte color)
|
|||||||
if (color<4)
|
if (color<4)
|
||||||
{
|
{
|
||||||
// Paste in layer
|
// Paste in layer
|
||||||
*(Main_backups->Pages->Image[Main_current_layer].Pixels + x+y*Main_image_width)=color;
|
*(Main_backups->Pages->Image[Main.current_layer].Pixels + x+y*Main.image_width)=color;
|
||||||
// Paste in depth buffer
|
// Paste in depth buffer
|
||||||
*(Main_visible_image_depth_buffer.Image+x+y*Main_image_width)=color;
|
*(Main_visible_image_depth_buffer.Image+x+y*Main.image_width)=color;
|
||||||
// Fetch pixel color from the target raster layer
|
// Fetch pixel color from the target raster layer
|
||||||
if (Main_layers_visible & (1 << color))
|
if (Main.layers_visible & (1 << color))
|
||||||
color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width);
|
color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main.image_width);
|
||||||
// Draw that color on the visible image buffer
|
// Draw that color on the visible image buffer
|
||||||
*(x+y*Main_image_width+Main_screen)=color;
|
*(x+y*Main.image_width+Main_screen)=color;
|
||||||
|
|
||||||
Pixel_preview(x,y,color);
|
Pixel_preview(x,y,color);
|
||||||
}
|
}
|
||||||
@ -3328,17 +3328,17 @@ Func_pixel Pixel_in_current_screen_with_preview=Pixel_in_screen_direct_with_prev
|
|||||||
|
|
||||||
void Pixel_in_spare(word x,word y, byte color)
|
void Pixel_in_spare(word x,word y, byte color)
|
||||||
{
|
{
|
||||||
*((y)*Spare_image_width+(x)+Spare_backups->Pages->Image[Spare_current_layer].Pixels)=color;
|
*((y)*Spare.image_width+(x)+Spare_backups->Pages->Image[Spare.current_layer].Pixels)=color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_in_current_layer(word x,word y, byte color)
|
void Pixel_in_current_layer(word x,word y, byte color)
|
||||||
{
|
{
|
||||||
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer].Pixels)=color;
|
*((y)*Main.image_width+(x)+Main_backups->Pages->Image[Main.current_layer].Pixels)=color;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte Read_pixel_from_current_layer(word x,word y)
|
byte Read_pixel_from_current_layer(word x,word y)
|
||||||
{
|
{
|
||||||
return *((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer].Pixels);
|
return *((y)*Main.image_width+(x)+Main_backups->Pages->Image[Main.current_layer].Pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update_pixel_renderer(void)
|
void Update_pixel_renderer(void)
|
||||||
@ -3377,13 +3377,13 @@ void Update_pixel_renderer(void)
|
|||||||
Pixel_in_current_screen_with_preview = Pixel_in_screen_zx_with_preview;
|
Pixel_in_current_screen_with_preview = Pixel_in_screen_zx_with_preview;
|
||||||
}
|
}
|
||||||
// Implicit else : Image_mode must be IMAGE_MODE_MODE5
|
// Implicit else : Image_mode must be IMAGE_MODE_MODE5
|
||||||
else if ( Main_current_layer == 4)
|
else if ( Main.current_layer == 4)
|
||||||
{
|
{
|
||||||
// overlay
|
// overlay
|
||||||
Pixel_in_current_screen = Pixel_in_screen_overlay;
|
Pixel_in_current_screen = Pixel_in_screen_overlay;
|
||||||
Pixel_in_current_screen_with_preview = Pixel_in_screen_overlay_with_preview;
|
Pixel_in_current_screen_with_preview = Pixel_in_screen_overlay_with_preview;
|
||||||
}
|
}
|
||||||
else if (Main_current_layer<4 && (Main_layers_visible & (1<<4)))
|
else if (Main.current_layer<4 && (Main.layers_visible & (1<<4)))
|
||||||
{
|
{
|
||||||
// underlay
|
// underlay
|
||||||
Pixel_in_current_screen = Pixel_in_screen_underlay;
|
Pixel_in_current_screen = Pixel_in_screen_underlay;
|
||||||
|
|||||||
18
src/help.c
18
src/help.c
@ -785,17 +785,17 @@ void Button_Stats(void)
|
|||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER tailleU;
|
ULARGE_INTEGER tailleU;
|
||||||
GetDiskFreeSpaceEx(Main_selector.Directory,&tailleU,NULL,NULL);
|
GetDiskFreeSpaceEx(Main.selector.Directory,&tailleU,NULL,NULL);
|
||||||
mem_size = tailleU.QuadPart;
|
mem_size = tailleU.QuadPart;
|
||||||
}
|
}
|
||||||
#elif defined(__linux__) || defined(__macosx__) || defined(__FreeBSD__) || defined(__SYLLABLE__) || defined(__AROS__)
|
#elif defined(__linux__) || defined(__macosx__) || defined(__FreeBSD__) || defined(__SYLLABLE__) || defined(__AROS__)
|
||||||
{
|
{
|
||||||
struct statfs disk_info;
|
struct statfs disk_info;
|
||||||
statfs(Main_selector.Directory,&disk_info);
|
statfs(Main.selector.Directory,&disk_info);
|
||||||
mem_size=(qword) disk_info.f_bfree * (qword) disk_info.f_bsize;
|
mem_size=(qword) disk_info.f_bfree * (qword) disk_info.f_bsize;
|
||||||
}
|
}
|
||||||
#elif defined(__HAIKU__)
|
#elif defined(__HAIKU__)
|
||||||
mem_size = haiku_get_free_space(Main_selector.Directory);
|
mem_size = haiku_get_free_space(Main.selector.Directory);
|
||||||
#elif defined (__MINT__)
|
#elif defined (__MINT__)
|
||||||
mem_size=0;
|
mem_size=0;
|
||||||
Dfree(&drvInfo,0);
|
Dfree(&drvInfo,0);
|
||||||
@ -813,16 +813,16 @@ void Button_Stats(void)
|
|||||||
if (mem_size != 0)
|
if (mem_size != 0)
|
||||||
{
|
{
|
||||||
#if defined(__AROS__)
|
#if defined(__AROS__)
|
||||||
char *colon = strchr(Main_selector.Directory, ':');
|
char *colon = strchr(Main.selector.Directory, ':');
|
||||||
int len = strlen(Main_selector.Directory);
|
int len = strlen(Main.selector.Directory);
|
||||||
if (colon)
|
if (colon)
|
||||||
{
|
{
|
||||||
len = (long)colon - (long)Main_selector.Directory;
|
len = (long)colon - (long)Main.selector.Directory;
|
||||||
}
|
}
|
||||||
if (len > 8) len = 8;
|
if (len > 8) len = 8;
|
||||||
sprintf(buffer,"Free space on %.*s:",len,Main_selector.Directory);
|
sprintf(buffer,"Free space on %.*s:",len,Main.selector.Directory);
|
||||||
#else
|
#else
|
||||||
sprintf(buffer,"Free space on %c:",Main_selector.Directory[0]);
|
sprintf(buffer,"Free space on %c:",Main.selector.Directory[0]);
|
||||||
#endif
|
#endif
|
||||||
Print_in_window(10,y,buffer,STATS_TITLE_COLOR,MC_Black);
|
Print_in_window(10,y,buffer,STATS_TITLE_COLOR,MC_Black);
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ void Button_Stats(void)
|
|||||||
|
|
||||||
// Affichage des dimensions de l'image
|
// Affichage des dimensions de l'image
|
||||||
Print_in_window(18,y,"Dimensions :",STATS_TITLE_COLOR,MC_Black);
|
Print_in_window(18,y,"Dimensions :",STATS_TITLE_COLOR,MC_Black);
|
||||||
sprintf(buffer,"%dx%d",Main_image_width,Main_image_height);
|
sprintf(buffer,"%dx%d",Main.image_width,Main.image_height);
|
||||||
Print_in_window(122,y,buffer,STATS_DATA_COLOR,MC_Black);
|
Print_in_window(122,y,buffer,STATS_DATA_COLOR,MC_Black);
|
||||||
y+=8;
|
y+=8;
|
||||||
|
|
||||||
|
|||||||
32
src/input.c
32
src/input.c
@ -231,22 +231,22 @@ int Move_cursor_with_constraints()
|
|||||||
Input_new_mouse_Y=Menu_Y-1; //La ligne !!au-dessus!! du menu
|
Input_new_mouse_Y=Menu_Y-1; //La ligne !!au-dessus!! du menu
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Main_magnifier_mode)
|
if(Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
if(Operation_in_magnifier==0)
|
if(Operation_in_magnifier==0)
|
||||||
{
|
{
|
||||||
if(Input_new_mouse_X>=Main_separator_position)
|
if(Input_new_mouse_X>=Main.separator_position)
|
||||||
{
|
{
|
||||||
mouse_blocked=1;
|
mouse_blocked=1;
|
||||||
Input_new_mouse_X=Main_separator_position-1;
|
Input_new_mouse_X=Main.separator_position-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Input_new_mouse_X<Main_X_zoom)
|
if(Input_new_mouse_X<Main.X_zoom)
|
||||||
{
|
{
|
||||||
mouse_blocked=1;
|
mouse_blocked=1;
|
||||||
Input_new_mouse_X=Main_X_zoom;
|
Input_new_mouse_X=Main.X_zoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -789,18 +789,18 @@ int Cursor_displace(short delta_x, short delta_y)
|
|||||||
short x=Input_new_mouse_X;
|
short x=Input_new_mouse_X;
|
||||||
short y=Input_new_mouse_Y;
|
short y=Input_new_mouse_Y;
|
||||||
|
|
||||||
if(Main_magnifier_mode && Input_new_mouse_Y < Menu_Y && Input_new_mouse_X > Main_separator_position)
|
if(Main.magnifier_mode && Input_new_mouse_Y < Menu_Y && Input_new_mouse_X > Main.separator_position)
|
||||||
{
|
{
|
||||||
// Cursor in zoomed area
|
// Cursor in zoomed area
|
||||||
|
|
||||||
if (delta_x<0)
|
if (delta_x<0)
|
||||||
Input_new_mouse_X = Max(Main_separator_position, x-Main_magnifier_factor);
|
Input_new_mouse_X = Max(Main.separator_position, x-Main.magnifier_factor);
|
||||||
else if (delta_x>0)
|
else if (delta_x>0)
|
||||||
Input_new_mouse_X = Min(Screen_width-1, x+Main_magnifier_factor);
|
Input_new_mouse_X = Min(Screen_width-1, x+Main.magnifier_factor);
|
||||||
if (delta_y<0)
|
if (delta_y<0)
|
||||||
Input_new_mouse_Y = Max(0, y-Main_magnifier_factor);
|
Input_new_mouse_Y = Max(0, y-Main.magnifier_factor);
|
||||||
else if (delta_y>0)
|
else if (delta_y>0)
|
||||||
Input_new_mouse_Y = Min(Screen_height-1, y+Main_magnifier_factor);
|
Input_new_mouse_Y = Min(Screen_height-1, y+Main.magnifier_factor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1110,9 +1110,9 @@ int Color_cycling(void)
|
|||||||
// Initialize the palette
|
// Initialize the palette
|
||||||
for(color=0;color<256;color++)
|
for(color=0;color<256;color++)
|
||||||
{
|
{
|
||||||
PaletteSDL[color].r=Main_palette[color].R;
|
PaletteSDL[color].r=Main.palette[color].R;
|
||||||
PaletteSDL[color].g=Main_palette[color].G;
|
PaletteSDL[color].g=Main.palette[color].G;
|
||||||
PaletteSDL[color].b=Main_palette[color].B;
|
PaletteSDL[color].b=Main.palette[color].B;
|
||||||
}
|
}
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
{
|
{
|
||||||
@ -1123,9 +1123,9 @@ int Color_cycling(void)
|
|||||||
{
|
{
|
||||||
for(color=Main_backups->Pages->Gradients->Range[i].Start;color<=Main_backups->Pages->Gradients->Range[i].End;color++)
|
for(color=Main_backups->Pages->Gradients->Range[i].Start;color<=Main_backups->Pages->Gradients->Range[i].End;color++)
|
||||||
{
|
{
|
||||||
PaletteSDL[color].r=Main_palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].R;
|
PaletteSDL[color].r=Main.palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].R;
|
||||||
PaletteSDL[color].g=Main_palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].G;
|
PaletteSDL[color].g=Main.palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].G;
|
||||||
PaletteSDL[color].b=Main_palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].B;
|
PaletteSDL[color].b=Main.palette[Main_backups->Pages->Gradients->Range[i].Start+((color-Main_backups->Pages->Gradients->Range[i].Start+offset[i])%len)].B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
90
src/layers.c
90
src/layers.c
@ -40,39 +40,39 @@ void Layer_activate(int layer, short side)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Keep a copy of which layers were visible
|
// Keep a copy of which layers were visible
|
||||||
old_layers = Main_layers_visible;
|
old_layers = Main.layers_visible;
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
if (side == RIGHT_SIDE)
|
if (side == RIGHT_SIDE)
|
||||||
{
|
{
|
||||||
// Right-click on current layer
|
// Right-click on current layer
|
||||||
if (Main_current_layer == layer)
|
if (Main.current_layer == layer)
|
||||||
{
|
{
|
||||||
if (Main_layers_visible == (dword)(1<<layer))
|
if (Main.layers_visible == (dword)(1<<layer))
|
||||||
{
|
{
|
||||||
// return to previous state (layers that were on before showing
|
// return to previous state (layers that were on before showing
|
||||||
// only this one)
|
// only this one)
|
||||||
Main_layers_visible = Main_layers_visible_backup;
|
Main.layers_visible = Main.layers_visible_backup;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set only this one visible
|
// Set only this one visible
|
||||||
Main_layers_visible_backup = Main_layers_visible;
|
Main.layers_visible_backup = Main.layers_visible;
|
||||||
Main_layers_visible = 1<<layer;
|
Main.layers_visible = 1<<layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Right-click on an other layer : toggle its visibility
|
// Right-click on an other layer : toggle its visibility
|
||||||
Main_layers_visible ^= 1<<layer;
|
Main.layers_visible ^= 1<<layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Left-click on any layer
|
// Left-click on any layer
|
||||||
Main_current_layer = layer;
|
Main.current_layer = layer;
|
||||||
Main_layers_visible |= 1<<layer;
|
Main.layers_visible |= 1<<layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -80,15 +80,15 @@ void Layer_activate(int layer, short side)
|
|||||||
// Only allow one visible at a time
|
// Only allow one visible at a time
|
||||||
if (side == LEFT_SIDE)
|
if (side == LEFT_SIDE)
|
||||||
{
|
{
|
||||||
Main_current_layer = layer;
|
Main.current_layer = layer;
|
||||||
Main_layers_visible = 1<<layer;
|
Main.layers_visible = 1<<layer;
|
||||||
|
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
if (Main_layers_visible != old_layers)
|
if (Main.layers_visible != old_layers)
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
else
|
else
|
||||||
Update_depth_buffer(); // Only need the depth buffer
|
Update_depth_buffer(); // Only need the depth buffer
|
||||||
@ -110,7 +110,7 @@ void Button_Layer_add(void)
|
|||||||
{
|
{
|
||||||
// Backup with unchanged layers
|
// Backup with unchanged layers
|
||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
if (!Add_layer(Main_backups,Main_current_layer+1))
|
if (!Add_layer(Main_backups,Main.current_layer+1))
|
||||||
{
|
{
|
||||||
Update_depth_buffer();
|
Update_depth_buffer();
|
||||||
// I just noticed this might be unneeded, since the new layer
|
// I just noticed this might be unneeded, since the new layer
|
||||||
@ -137,12 +137,12 @@ void Button_Layer_duplicate(void)
|
|||||||
{
|
{
|
||||||
// Backup with unchanged layers
|
// Backup with unchanged layers
|
||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
if (!Add_layer(Main_backups,Main_current_layer+1))
|
if (!Add_layer(Main_backups,Main.current_layer+1))
|
||||||
{
|
{
|
||||||
// Make a copy of current image
|
// Make a copy of current image
|
||||||
memcpy(
|
memcpy(
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
Main_backups->Pages->Image[Main_current_layer-1].Pixels,
|
Main_backups->Pages->Image[Main.current_layer-1].Pixels,
|
||||||
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION) {
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION) {
|
||||||
@ -169,7 +169,7 @@ void Button_Layer_remove(void)
|
|||||||
{
|
{
|
||||||
// Backup with unchanged layers
|
// Backup with unchanged layers
|
||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
if (!Delete_layer(Main_backups,Main_current_layer))
|
if (!Delete_layer(Main_backups,Main.current_layer))
|
||||||
{
|
{
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
@ -352,10 +352,10 @@ void Button_Layer_merge(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
if (Main_current_layer>0)
|
if (Main.current_layer>0)
|
||||||
{
|
{
|
||||||
// Backup layer below the current
|
// Backup layer below the current
|
||||||
Backup_layers(Main_current_layer-1);
|
Backup_layers(Main.current_layer-1);
|
||||||
|
|
||||||
Merge_layer();
|
Merge_layer();
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ void Button_Layer_up(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
if (Main_current_layer < (Main_backups->Pages->Nb_layers-1))
|
if (Main.current_layer < (Main_backups->Pages->Nb_layers-1))
|
||||||
{
|
{
|
||||||
T_Image tmp;
|
T_Image tmp;
|
||||||
dword layer_flags;
|
dword layer_flags;
|
||||||
@ -383,20 +383,20 @@ void Button_Layer_up(void)
|
|||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
|
|
||||||
// swap
|
// swap
|
||||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
tmp = Main_backups->Pages->Image[Main.current_layer];
|
||||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer+1];
|
Main_backups->Pages->Image[Main.current_layer] = Main_backups->Pages->Image[Main.current_layer+1];
|
||||||
Main_backups->Pages->Image[Main_current_layer+1] = tmp;
|
Main_backups->Pages->Image[Main.current_layer+1] = tmp;
|
||||||
|
|
||||||
// Swap visibility indicators
|
// Swap visibility indicators
|
||||||
layer_flags = (Main_layers_visible >> Main_current_layer) & 3;
|
layer_flags = (Main.layers_visible >> Main.current_layer) & 3;
|
||||||
// Only needed if they are different.
|
// Only needed if they are different.
|
||||||
if (layer_flags == 1 || layer_flags == 2)
|
if (layer_flags == 1 || layer_flags == 2)
|
||||||
{
|
{
|
||||||
// One is on, the other is off. Negating them will
|
// One is on, the other is off. Negating them will
|
||||||
// perform the swap.
|
// perform the swap.
|
||||||
Main_layers_visible ^= (3 << Main_current_layer);
|
Main.layers_visible ^= (3 << Main.current_layer);
|
||||||
}
|
}
|
||||||
Main_current_layer++;
|
Main.current_layer++;
|
||||||
|
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
@ -414,7 +414,7 @@ void Button_Layer_down(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
if (Main_current_layer > 0)
|
if (Main.current_layer > 0)
|
||||||
{
|
{
|
||||||
T_Image tmp;
|
T_Image tmp;
|
||||||
dword layer_flags;
|
dword layer_flags;
|
||||||
@ -423,21 +423,21 @@ void Button_Layer_down(void)
|
|||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
|
|
||||||
// swap
|
// swap
|
||||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
tmp = Main_backups->Pages->Image[Main.current_layer];
|
||||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer-1];
|
Main_backups->Pages->Image[Main.current_layer] = Main_backups->Pages->Image[Main.current_layer-1];
|
||||||
Main_backups->Pages->Image[Main_current_layer-1] = tmp;
|
Main_backups->Pages->Image[Main.current_layer-1] = tmp;
|
||||||
|
|
||||||
// Swap visibility indicators
|
// Swap visibility indicators
|
||||||
layer_flags = (Main_layers_visible >> (Main_current_layer-1)) & 3;
|
layer_flags = (Main.layers_visible >> (Main.current_layer-1)) & 3;
|
||||||
// Only needed if they are different.
|
// Only needed if they are different.
|
||||||
if (layer_flags == 1 || layer_flags == 2)
|
if (layer_flags == 1 || layer_flags == 2)
|
||||||
{
|
{
|
||||||
// Only needed if they are different.
|
// Only needed if they are different.
|
||||||
// One is on, the other is off. Negating them will
|
// One is on, the other is off. Negating them will
|
||||||
// perform the swap.
|
// perform the swap.
|
||||||
Main_layers_visible ^= (3 << (Main_current_layer-1));
|
Main.layers_visible ^= (3 << (Main.current_layer-1));
|
||||||
}
|
}
|
||||||
Main_current_layer--;
|
Main.current_layer--;
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
Display_layerbar();
|
Display_layerbar();
|
||||||
@ -466,7 +466,7 @@ void Button_Anim_time(void)
|
|||||||
int frame;
|
int frame;
|
||||||
char buffer[6+1];
|
char buffer[6+1];
|
||||||
T_Special_button * input_duration_button;
|
T_Special_button * input_duration_button;
|
||||||
int duration=Main_backups->Pages->Image[Main_current_layer].Duration;
|
int duration=Main_backups->Pages->Image[Main.current_layer].Duration;
|
||||||
|
|
||||||
Open_window(166,110,"Animation speed");
|
Open_window(166,110,"Animation speed");
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ void Button_Anim_time(void)
|
|||||||
duration=0;
|
duration=0;
|
||||||
else if (duration>655350)
|
else if (duration>655350)
|
||||||
duration=655350;
|
duration=655350;
|
||||||
Main_backups->Pages->Image[Main_current_layer].Duration = duration;
|
Main_backups->Pages->Image[Main.current_layer].Duration = duration;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (duration<0)
|
if (duration<0)
|
||||||
@ -581,7 +581,7 @@ void Button_Anim_time(void)
|
|||||||
|
|
||||||
void Button_Anim_first_frame(void)
|
void Button_Anim_first_frame(void)
|
||||||
{
|
{
|
||||||
if (Main_current_layer>0)
|
if (Main.current_layer>0)
|
||||||
Layer_activate(0,LEFT_SIDE);
|
Layer_activate(0,LEFT_SIDE);
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -593,10 +593,10 @@ void Button_Anim_prev_frame(void)
|
|||||||
{
|
{
|
||||||
if (Main_backups->Pages->Nb_layers>1)
|
if (Main_backups->Pages->Nb_layers>1)
|
||||||
{
|
{
|
||||||
if (Main_current_layer==0)
|
if (Main.current_layer==0)
|
||||||
Layer_activate(Main_backups->Pages->Nb_layers-1,LEFT_SIDE);
|
Layer_activate(Main_backups->Pages->Nb_layers-1,LEFT_SIDE);
|
||||||
else
|
else
|
||||||
Layer_activate(Main_current_layer-1,LEFT_SIDE);
|
Layer_activate(Main.current_layer-1,LEFT_SIDE);
|
||||||
}
|
}
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Unselect_button(BUTTON_ANIM_PREV_FRAME);
|
Unselect_button(BUTTON_ANIM_PREV_FRAME);
|
||||||
@ -607,10 +607,10 @@ void Button_Anim_next_frame(void)
|
|||||||
{
|
{
|
||||||
if (Main_backups->Pages->Nb_layers>1)
|
if (Main_backups->Pages->Nb_layers>1)
|
||||||
{
|
{
|
||||||
if (Main_current_layer==Main_backups->Pages->Nb_layers-1)
|
if (Main.current_layer==Main_backups->Pages->Nb_layers-1)
|
||||||
Layer_activate(0,LEFT_SIDE);
|
Layer_activate(0,LEFT_SIDE);
|
||||||
else
|
else
|
||||||
Layer_activate(Main_current_layer+1,LEFT_SIDE);
|
Layer_activate(Main.current_layer+1,LEFT_SIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -620,7 +620,7 @@ void Button_Anim_next_frame(void)
|
|||||||
|
|
||||||
void Button_Anim_last_frame(void)
|
void Button_Anim_last_frame(void)
|
||||||
{
|
{
|
||||||
if (Main_current_layer < (Main_backups->Pages->Nb_layers-1))
|
if (Main.current_layer < (Main_backups->Pages->Nb_layers-1))
|
||||||
Layer_activate((Main_backups->Pages->Nb_layers-1),LEFT_SIDE);
|
Layer_activate((Main_backups->Pages->Nb_layers-1),LEFT_SIDE);
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -645,13 +645,13 @@ void Button_Anim_continuous_next(void)
|
|||||||
time_now=SDL_GetTicks();
|
time_now=SDL_GetTicks();
|
||||||
time_in_current_frame += time_now-time_start;
|
time_in_current_frame += time_now-time_start;
|
||||||
time_start=time_now;
|
time_start=time_now;
|
||||||
target_frame = Main_current_layer;
|
target_frame = Main.current_layer;
|
||||||
while (time_in_current_frame > Main_backups->Pages->Image[target_frame].Duration)
|
while (time_in_current_frame > Main_backups->Pages->Image[target_frame].Duration)
|
||||||
{
|
{
|
||||||
time_in_current_frame -= Interpret_delay(Main_backups->Pages->Image[target_frame].Duration);
|
time_in_current_frame -= Interpret_delay(Main_backups->Pages->Image[target_frame].Duration);
|
||||||
target_frame = (target_frame+1) % Main_backups->Pages->Nb_layers;
|
target_frame = (target_frame+1) % Main_backups->Pages->Nb_layers;
|
||||||
}
|
}
|
||||||
if (target_frame != Main_current_layer)
|
if (target_frame != Main.current_layer)
|
||||||
{
|
{
|
||||||
Layer_activate(target_frame,LEFT_SIDE);
|
Layer_activate(target_frame,LEFT_SIDE);
|
||||||
}
|
}
|
||||||
@ -680,13 +680,13 @@ void Button_Anim_continuous_prev(void)
|
|||||||
time_now=SDL_GetTicks();
|
time_now=SDL_GetTicks();
|
||||||
time_in_current_frame += time_now-time_start;
|
time_in_current_frame += time_now-time_start;
|
||||||
time_start=time_now;
|
time_start=time_now;
|
||||||
target_frame = Main_current_layer;
|
target_frame = Main.current_layer;
|
||||||
while (time_in_current_frame > Main_backups->Pages->Image[target_frame].Duration)
|
while (time_in_current_frame > Main_backups->Pages->Image[target_frame].Duration)
|
||||||
{
|
{
|
||||||
time_in_current_frame -= Interpret_delay(Main_backups->Pages->Image[target_frame].Duration);
|
time_in_current_frame -= Interpret_delay(Main_backups->Pages->Image[target_frame].Duration);
|
||||||
target_frame = (target_frame+Main_backups->Pages->Nb_layers-1) % Main_backups->Pages->Nb_layers;
|
target_frame = (target_frame+Main_backups->Pages->Nb_layers-1) % Main_backups->Pages->Nb_layers;
|
||||||
}
|
}
|
||||||
if (target_frame != Main_current_layer)
|
if (target_frame != Main.current_layer)
|
||||||
{
|
{
|
||||||
Layer_activate(target_frame,LEFT_SIDE);
|
Layer_activate(target_frame,LEFT_SIDE);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,7 +276,7 @@ void Fill_canvas(T_IO_Context *context, byte color)
|
|||||||
break;
|
break;
|
||||||
case CONTEXT_MAIN_IMAGE:
|
case CONTEXT_MAIN_IMAGE:
|
||||||
memset(
|
memset(
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
color,
|
color,
|
||||||
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
Main_backups->Pages->Width*Main_backups->Pages->Height);
|
||||||
break;
|
break;
|
||||||
@ -485,8 +485,8 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
|
|||||||
|
|
||||||
// Load into layer 0, by default.
|
// Load into layer 0, by default.
|
||||||
context->Nb_layers=1;
|
context->Nb_layers=1;
|
||||||
Main_current_layer=0;
|
Main.current_layer=0;
|
||||||
Main_layers_visible=1<<0;
|
Main.layers_visible=1<<0;
|
||||||
Set_loading_layer(context,0);
|
Set_loading_layer(context,0);
|
||||||
|
|
||||||
// Remove previous comment, unless we load just a palette
|
// Remove previous comment, unless we load just a palette
|
||||||
@ -777,7 +777,7 @@ void Load_image(T_IO_Context *context)
|
|||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
}
|
}
|
||||||
// Copy the loaded palette
|
// Copy the loaded palette
|
||||||
memcpy(Main_palette, context->Palette, sizeof(T_Palette));
|
memcpy(Main.palette, context->Palette, sizeof(T_Palette));
|
||||||
memcpy(Main_backups->Pages->Palette, context->Palette, sizeof(T_Palette));
|
memcpy(Main_backups->Pages->Palette, context->Palette, sizeof(T_Palette));
|
||||||
|
|
||||||
// For formats that handle more than just the palette:
|
// For formats that handle more than just the palette:
|
||||||
@ -797,9 +797,9 @@ void Load_image(T_IO_Context *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// On considère que l'image chargée n'est plus modifiée
|
// On considère que l'image chargée n'est plus modifiée
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
// Et on documente la variable Main_fileformat avec la valeur:
|
// Et on documente la variable Main_fileformat avec la valeur:
|
||||||
Main_fileformat=format->Identifier;
|
Main.fileformat=format->Identifier;
|
||||||
|
|
||||||
// already done initially on Backup_with_new_dimensions
|
// already done initially on Backup_with_new_dimensions
|
||||||
//Main_image_width= context->Width;
|
//Main_image_width= context->Width;
|
||||||
@ -807,12 +807,12 @@ void Load_image(T_IO_Context *context)
|
|||||||
|
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
Main_current_layer = 0;
|
Main.current_layer = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main_current_layer = context->Nb_layers - 1;
|
Main.current_layer = context->Nb_layers - 1;
|
||||||
Main_layers_visible = (2<<Main_current_layer)-1;
|
Main.layers_visible = (2<<Main.current_layer)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the transparency data
|
// Load the transparency data
|
||||||
@ -820,10 +820,10 @@ void Load_image(T_IO_Context *context)
|
|||||||
Main_backups->Pages->Background_transparent = context->Background_transparent;
|
Main_backups->Pages->Background_transparent = context->Background_transparent;
|
||||||
|
|
||||||
// Correction des dimensions
|
// Correction des dimensions
|
||||||
if (Main_image_width<1)
|
if (Main.image_width<1)
|
||||||
Main_image_width=1;
|
Main.image_width=1;
|
||||||
if (Main_image_height<1)
|
if (Main.image_height<1)
|
||||||
Main_image_height=1;
|
Main.image_height=1;
|
||||||
|
|
||||||
// Color cyling ranges:
|
// Color cyling ranges:
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
@ -844,9 +844,9 @@ void Load_image(T_IO_Context *context)
|
|||||||
else if (File_error!=1)
|
else if (File_error!=1)
|
||||||
{
|
{
|
||||||
// On considère que l'image chargée est encore modifiée
|
// On considère que l'image chargée est encore modifiée
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
// Et on documente la variable Main_fileformat avec la valeur:
|
// Et on documente la variable Main_fileformat avec la valeur:
|
||||||
Main_fileformat=format->Identifier;
|
Main.fileformat=format->Identifier;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -999,7 +999,7 @@ void Save_image(T_IO_Context *context)
|
|||||||
}
|
}
|
||||||
// current layer
|
// current layer
|
||||||
context->Nb_layers=1;
|
context->Nb_layers=1;
|
||||||
context->Target_address=Main_backups->Pages->Image[Main_current_layer].Pixels;
|
context->Target_address=Main_backups->Pages->Image[Main.current_layer].Pixels;
|
||||||
}
|
}
|
||||||
else // all other layer-based formats
|
else // all other layer-based formats
|
||||||
{
|
{
|
||||||
@ -1035,7 +1035,7 @@ void Save_image(T_IO_Context *context)
|
|||||||
break;
|
break;
|
||||||
case 2: // current layer
|
case 2: // current layer
|
||||||
context->Nb_layers=1;
|
context->Nb_layers=1;
|
||||||
context->Target_address=Main_backups->Pages->Image[Main_current_layer].Pixels;
|
context->Target_address=Main_backups->Pages->Image[Main.current_layer].Pixels;
|
||||||
break;
|
break;
|
||||||
default: // Cancel
|
default: // Cancel
|
||||||
// File_error is already set to 1.
|
// File_error is already set to 1.
|
||||||
@ -1233,9 +1233,9 @@ void Emergency_backup(const char *fname, byte *source, int width, int height, T_
|
|||||||
void Image_emergency_backup()
|
void Image_emergency_backup()
|
||||||
{
|
{
|
||||||
if (Main_backups && Main_backups->Pages && Main_backups->Pages->Nb_layers == 1)
|
if (Main_backups && Main_backups->Pages && Main_backups->Pages->Nb_layers == 1)
|
||||||
Emergency_backup(SAFETYBACKUP_PREFIX_A "999999" BACKUP_FILE_EXTENSION,Main_screen, Main_image_width, Main_image_height, &Main_palette);
|
Emergency_backup(SAFETYBACKUP_PREFIX_A "999999" BACKUP_FILE_EXTENSION,Main_screen, Main.image_width, Main.image_height, &Main.palette);
|
||||||
if (Spare_backups && Spare_backups->Pages && Spare_backups->Pages->Nb_layers == 1)
|
if (Spare_backups && Spare_backups->Pages && Spare_backups->Pages->Nb_layers == 1)
|
||||||
Emergency_backup(SAFETYBACKUP_PREFIX_B "999999" BACKUP_FILE_EXTENSION,Spare_visible_image.Image, Spare_image_width, Spare_image_height, &Spare_palette);
|
Emergency_backup(SAFETYBACKUP_PREFIX_B "999999" BACKUP_FILE_EXTENSION,Spare_visible_image.Image, Spare.image_width, Spare.image_height, &Spare.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
T_Format * Get_fileformat(byte format)
|
T_Format * Get_fileformat(byte format)
|
||||||
@ -1279,7 +1279,7 @@ void Init_context_preview(T_IO_Context * context, char *file_name, char *file_di
|
|||||||
context->Type = CONTEXT_PREVIEW;
|
context->Type = CONTEXT_PREVIEW;
|
||||||
context->File_name = file_name;
|
context->File_name = file_name;
|
||||||
context->File_directory = file_directory;
|
context->File_directory = file_directory;
|
||||||
context->Format = Main_fileformat; // FIXME ?
|
context->Format = Main.fileformat; // FIXME ?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup for loading/saving an intermediate backup
|
// Setup for loading/saving an intermediate backup
|
||||||
@ -1298,10 +1298,10 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
|
|||||||
context->Type = CONTEXT_MAIN_IMAGE;
|
context->Type = CONTEXT_MAIN_IMAGE;
|
||||||
context->File_name = file_name;
|
context->File_name = file_name;
|
||||||
context->File_directory = file_directory;
|
context->File_directory = file_directory;
|
||||||
context->Format = Main_fileformat;
|
context->Format = Main.fileformat;
|
||||||
memcpy(context->Palette, Main_palette, sizeof(T_Palette));
|
memcpy(context->Palette, Main.palette, sizeof(T_Palette));
|
||||||
context->Width = Main_image_width;
|
context->Width = Main.image_width;
|
||||||
context->Height = Main_image_height;
|
context->Height = Main.image_height;
|
||||||
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
||||||
strcpy(context->Comment, Main_backups->Pages->Comment);
|
strcpy(context->Comment, Main_backups->Pages->Comment);
|
||||||
context->Transparent_color=Main_backups->Pages->Transparent_color;
|
context->Transparent_color=Main_backups->Pages->Transparent_color;
|
||||||
@ -1313,7 +1313,7 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
|
|||||||
else
|
else
|
||||||
context->Ratio=PIXEL_SIMPLE;
|
context->Ratio=PIXEL_SIMPLE;
|
||||||
context->Target_address=Main_backups->Pages->Image[0].Pixels;
|
context->Target_address=Main_backups->Pages->Image[0].Pixels;
|
||||||
context->Pitch=Main_image_width;
|
context->Pitch=Main.image_width;
|
||||||
|
|
||||||
// Color cyling ranges:
|
// Color cyling ranges:
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
@ -1345,7 +1345,7 @@ void Init_context_brush(T_IO_Context * context, char *file_name, char *file_dire
|
|||||||
context->File_directory = file_directory;
|
context->File_directory = file_directory;
|
||||||
context->Format = Brush_fileformat;
|
context->Format = Brush_fileformat;
|
||||||
// Use main screen's palette
|
// Use main screen's palette
|
||||||
memcpy(context->Palette, Main_palette, sizeof(T_Palette));
|
memcpy(context->Palette, Main.palette, sizeof(T_Palette));
|
||||||
context->Width = Brush_width;
|
context->Width = Brush_width;
|
||||||
context->Height = Brush_height;
|
context->Height = Brush_height;
|
||||||
context->Nb_layers = 1;
|
context->Nb_layers = 1;
|
||||||
@ -1414,9 +1414,9 @@ void Set_loading_layer(T_IO_Context *context, int layer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
||||||
Main_layers_visible = (2<<layer)-1;
|
Main.layers_visible = (2<<layer)-1;
|
||||||
}
|
}
|
||||||
Main_current_layer = layer;
|
Main.current_layer = layer;
|
||||||
context->Target_address=Main_backups->Pages->Image[layer].Pixels;
|
context->Target_address=Main_backups->Pages->Image[layer].Pixels;
|
||||||
|
|
||||||
Update_pixel_renderer();
|
Update_pixel_renderer();
|
||||||
@ -1465,9 +1465,9 @@ void Add_backup_file(const char *name)
|
|||||||
Extract_filename(file_name, name);
|
Extract_filename(file_name, name);
|
||||||
|
|
||||||
// Check first character
|
// Check first character
|
||||||
if (file_name[0]==Main_safety_backup_prefix)
|
if (file_name[0]==Main.safety_backup_prefix)
|
||||||
list = &Backups_main;
|
list = &Backups_main;
|
||||||
else if (file_name[0]==Spare_safety_backup_prefix)
|
else if (file_name[0]==Spare.safety_backup_prefix)
|
||||||
list = &Backups_spare;
|
list = &Backups_spare;
|
||||||
else {
|
else {
|
||||||
// Not a good file
|
// Not a good file
|
||||||
@ -1555,7 +1555,7 @@ byte Process_backups(T_String_list **list)
|
|||||||
context.Original_file_name = file_name;
|
context.Original_file_name = file_name;
|
||||||
context.Original_file_directory = file_directory;
|
context.Original_file_directory = file_directory;
|
||||||
Load_image(&context);
|
Load_image(&context);
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
Destroy_context(&context);
|
Destroy_context(&context);
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
@ -1608,8 +1608,8 @@ if (Create_lock_file(Config_directory))
|
|||||||
restored_spare = Process_backups(&Backups_spare);
|
restored_spare = Process_backups(&Backups_spare);
|
||||||
if (restored_spare)
|
if (restored_spare)
|
||||||
{
|
{
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
if (Backups_main)
|
if (Backups_main)
|
||||||
@ -1619,8 +1619,8 @@ if (Create_lock_file(Config_directory))
|
|||||||
|
|
||||||
if (restored_main)
|
if (restored_main)
|
||||||
{
|
{
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
}
|
}
|
||||||
@ -1642,28 +1642,28 @@ void Rotate_safety_backups(void)
|
|||||||
// - Many edits have taken place
|
// - Many edits have taken place
|
||||||
// - A minimum number of edits have taken place AND a minimum time has passed
|
// - A minimum number of edits have taken place AND a minimum time has passed
|
||||||
// - At least one edit was done, and a maximum time has passed
|
// - At least one edit was done, and a maximum time has passed
|
||||||
if ((Main_edits_since_safety_backup > Max_edits_for_safety_backup) ||
|
if ((Main.edits_since_safety_backup > Max_edits_for_safety_backup) ||
|
||||||
(Main_edits_since_safety_backup > Min_edits_for_safety_backup &&
|
(Main.edits_since_safety_backup > Min_edits_for_safety_backup &&
|
||||||
now > Main_time_of_safety_backup + Min_interval_for_safety_backup) ||
|
now > Main.time_of_safety_backup + Min_interval_for_safety_backup) ||
|
||||||
(Main_edits_since_safety_backup > 1 &&
|
(Main.edits_since_safety_backup > 1 &&
|
||||||
now > Main_time_of_safety_backup + Max_interval_for_safety_backup))
|
now > Main.time_of_safety_backup + Max_interval_for_safety_backup))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Clear a previous save (rotating saves)
|
// Clear a previous save (rotating saves)
|
||||||
sprintf(deleted_file, "%s%c%6.6d" BACKUP_FILE_EXTENSION,
|
sprintf(deleted_file, "%s%c%6.6d" BACKUP_FILE_EXTENSION,
|
||||||
Config_directory,
|
Config_directory,
|
||||||
Main_safety_backup_prefix,
|
Main.safety_backup_prefix,
|
||||||
(Uint32)(Main_safety_number + 1000000l - Rotation_safety_backup) % (Uint32)1000000l);
|
(Uint32)(Main.safety_number + 1000000l - Rotation_safety_backup) % (Uint32)1000000l);
|
||||||
remove(deleted_file); // no matter if fail
|
remove(deleted_file); // no matter if fail
|
||||||
|
|
||||||
// Reset counters
|
// Reset counters
|
||||||
Main_edits_since_safety_backup=0;
|
Main.edits_since_safety_backup=0;
|
||||||
Main_time_of_safety_backup=now;
|
Main.time_of_safety_backup=now;
|
||||||
|
|
||||||
// Create a new file name and save
|
// Create a new file name and save
|
||||||
sprintf(file_name, "%c%6.6d" BACKUP_FILE_EXTENSION,
|
sprintf(file_name, "%c%6.6d" BACKUP_FILE_EXTENSION,
|
||||||
Main_safety_backup_prefix,
|
Main.safety_backup_prefix,
|
||||||
(Uint32)Main_safety_number);
|
(Uint32)Main.safety_number);
|
||||||
Init_context_backup_image(&context, file_name, Config_directory);
|
Init_context_backup_image(&context, file_name, Config_directory);
|
||||||
context.Format=FORMAT_GIF;
|
context.Format=FORMAT_GIF;
|
||||||
// Provide original file data, to store as a GIF Application Extension
|
// Provide original file data, to store as a GIF Application Extension
|
||||||
@ -1673,7 +1673,7 @@ void Rotate_safety_backups(void)
|
|||||||
Save_image(&context);
|
Save_image(&context);
|
||||||
Destroy_context(&context);
|
Destroy_context(&context);
|
||||||
|
|
||||||
Main_safety_number++;
|
Main.safety_number++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
126
src/main.c
126
src/main.c
@ -490,10 +490,10 @@ int Init_program(int argc,char * argv[])
|
|||||||
// Choose directory for settings (read/write)
|
// Choose directory for settings (read/write)
|
||||||
Set_config_directory(program_directory,Config_directory);
|
Set_config_directory(program_directory,Config_directory);
|
||||||
#if defined(__MINT__)
|
#if defined(__MINT__)
|
||||||
strcpy(Main_selector.Directory,program_directory);
|
strcpy(Main.selector.Directory,program_directory);
|
||||||
#else
|
#else
|
||||||
// On détermine le répertoire courant:
|
// On détermine le répertoire courant:
|
||||||
getcwd(Main_selector.Directory,MAX_PATH_CHARACTERS);
|
getcwd(Main.selector.Directory,MAX_PATH_CHARACTERS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FILENAMES_ICONV
|
#ifdef ENABLE_FILENAMES_ICONV
|
||||||
@ -504,68 +504,68 @@ int Init_program(int argc,char * argv[])
|
|||||||
#endif /* ENABLE_FILENAMES_ICONV */
|
#endif /* ENABLE_FILENAMES_ICONV */
|
||||||
|
|
||||||
// On en profite pour le mémoriser dans le répertoire principal:
|
// On en profite pour le mémoriser dans le répertoire principal:
|
||||||
strcpy(Initial_directory,Main_selector.Directory);
|
strcpy(Initial_directory,Main.selector.Directory);
|
||||||
|
|
||||||
// On initialise les données sur le nom de fichier de l'image de brouillon:
|
// On initialise les données sur le nom de fichier de l'image de brouillon:
|
||||||
strcpy(Spare_selector.Directory,Main_selector.Directory);
|
strcpy(Spare.selector.Directory,Main.selector.Directory);
|
||||||
|
|
||||||
Main_fileformat=DEFAULT_FILEFORMAT;
|
Main.fileformat=DEFAULT_FILEFORMAT;
|
||||||
Spare_fileformat =Main_fileformat;
|
Spare.fileformat =DEFAULT_FILEFORMAT;
|
||||||
|
|
||||||
strcpy(Brush_selector.Directory,Main_selector.Directory);
|
strcpy(Brush_selector.Directory,Main.selector.Directory);
|
||||||
strcpy(Brush_file_directory,Main_selector.Directory);
|
strcpy(Brush_file_directory,Main.selector.Directory);
|
||||||
strcpy(Brush_filename ,"NO_NAME.GIF");
|
strcpy(Brush_filename ,"NO_NAME.GIF");
|
||||||
Brush_fileformat =Main_fileformat;
|
Brush_fileformat =DEFAULT_FILEFORMAT;
|
||||||
|
|
||||||
// On initialise ce qu'il faut pour que les fileselects ne plantent pas:
|
// On initialise ce qu'il faut pour que les fileselects ne plantent pas:
|
||||||
|
|
||||||
Main_selector.Position=0; // Au début, le fileselect est en haut de la liste des fichiers
|
Main.selector.Position=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||||
Main_selector.Offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
Main.selector.Offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||||
Main_selector.Format_filter=FORMAT_ALL_IMAGES;
|
Main.selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||||
|
|
||||||
Main_current_layer=0;
|
Main.current_layer=0;
|
||||||
Main_layers_visible=0xFFFFFFFF;
|
Main.layers_visible=0xFFFFFFFF;
|
||||||
Main_layers_visible_backup=0xFFFFFFFF;
|
Main.layers_visible_backup=0xFFFFFFFF;
|
||||||
Spare_current_layer=0;
|
Spare.current_layer=0;
|
||||||
Spare_layers_visible=0xFFFFFFFF;
|
Spare.layers_visible=0xFFFFFFFF;
|
||||||
Spare_layers_visible_backup=0xFFFFFFFF;
|
Spare.layers_visible_backup=0xFFFFFFFF;
|
||||||
|
|
||||||
Spare_selector.Position=0;
|
Spare.selector.Position=0;
|
||||||
Spare_selector.Offset=0;
|
Spare.selector.Offset=0;
|
||||||
Spare_selector.Format_filter=FORMAT_ALL_IMAGES;
|
Spare.selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||||
Brush_selector.Position=0;
|
Brush_selector.Position=0;
|
||||||
Brush_selector.Offset=0;
|
Brush_selector.Offset=0;
|
||||||
Brush_selector.Format_filter=FORMAT_ALL_IMAGES;
|
Brush_selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||||
|
|
||||||
// On initialise d'ot' trucs
|
// On initialise d'ot' trucs
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Main_separator_position=0;
|
Main.separator_position=0;
|
||||||
Main_X_zoom=0;
|
Main.X_zoom=0;
|
||||||
Main_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
Main.separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Main_magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
Main.magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
||||||
Main_magnifier_height=0;
|
Main.magnifier_height=0;
|
||||||
Main_magnifier_width=0;
|
Main.magnifier_width=0;
|
||||||
Main_magnifier_offset_X=0;
|
Main.magnifier_offset_X=0;
|
||||||
Main_magnifier_offset_Y=0;
|
Main.magnifier_offset_Y=0;
|
||||||
Spare_offset_X=0;
|
Spare.offset_X=0;
|
||||||
Spare_offset_Y=0;
|
Spare.offset_Y=0;
|
||||||
Spare_separator_position=0;
|
Spare.separator_position=0;
|
||||||
Spare_X_zoom=0;
|
Spare.X_zoom=0;
|
||||||
Spare_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
Spare.separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
||||||
Spare_magnifier_mode=0;
|
Spare.magnifier_mode=0;
|
||||||
Spare_magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
Spare.magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
||||||
Spare_magnifier_height=0;
|
Spare.magnifier_height=0;
|
||||||
Spare_magnifier_width=0;
|
Spare.magnifier_width=0;
|
||||||
Spare_magnifier_offset_X=0;
|
Spare.magnifier_offset_X=0;
|
||||||
Spare_magnifier_offset_Y=0;
|
Spare.magnifier_offset_Y=0;
|
||||||
Keyboard_click_allowed = 1;
|
Keyboard_click_allowed = 1;
|
||||||
|
|
||||||
Main_safety_backup_prefix = SAFETYBACKUP_PREFIX_A[0];
|
Main.safety_backup_prefix = SAFETYBACKUP_PREFIX_A[0];
|
||||||
Spare_safety_backup_prefix = SAFETYBACKUP_PREFIX_B[0];
|
Spare.safety_backup_prefix = SAFETYBACKUP_PREFIX_B[0];
|
||||||
Main_time_of_safety_backup = 0;
|
Main.time_of_safety_backup = 0;
|
||||||
Spare_time_of_safety_backup = 0;
|
Spare.time_of_safety_backup = 0;
|
||||||
|
|
||||||
|
|
||||||
// SDL
|
// SDL
|
||||||
@ -611,10 +611,10 @@ int Init_program(int argc,char * argv[])
|
|||||||
Selected_curve_mode =OPERATION_3_POINTS_CURVE;
|
Selected_curve_mode =OPERATION_3_POINTS_CURVE;
|
||||||
Effect_function=No_effect;
|
Effect_function=No_effect;
|
||||||
// On initialise les infos de la loupe:
|
// On initialise les infos de la loupe:
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Main_magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
Main.magnifier_factor=DEFAULT_ZOOM_FACTOR;
|
||||||
Main_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
Main.separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
||||||
Spare_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
Spare.separator_proportion=INITIAL_SEPARATOR_PROPORTION;
|
||||||
// On initialise les infos du mode smear:
|
// On initialise les infos du mode smear:
|
||||||
Smear_mode=0;
|
Smear_mode=0;
|
||||||
Smear_brush_width=PAINTBRUSH_WIDTH;
|
Smear_brush_width=PAINTBRUSH_WIDTH;
|
||||||
@ -746,7 +746,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
Error(ERROR_GUI_MISSING);
|
Error(ERROR_GUI_MISSING);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(Main_palette, Gfx->Default_palette, sizeof(T_Palette));
|
memcpy(Main.palette, Gfx->Default_palette, sizeof(T_Palette));
|
||||||
|
|
||||||
Fore_color=Best_color_range(255,255,255,Config.Palette_cells_X*Config.Palette_cells_Y);
|
Fore_color=Best_color_range(255,255,255,Config.Palette_cells_X*Config.Palette_cells_Y);
|
||||||
Back_color=Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
Back_color=Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
||||||
@ -785,10 +785,10 @@ int Init_program(int argc,char * argv[])
|
|||||||
//ActivateConsole();
|
//ActivateConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Main_image_width=Screen_width/Pixel_width;
|
Main.image_width=Screen_width/Pixel_width;
|
||||||
Main_image_height=Screen_height/Pixel_height;
|
Main.image_height=Screen_height/Pixel_height;
|
||||||
Spare_image_width=Screen_width/Pixel_width;
|
Spare.image_width=Screen_width/Pixel_width;
|
||||||
Spare_image_height=Screen_height/Pixel_height;
|
Spare.image_height=Screen_height/Pixel_height;
|
||||||
|
|
||||||
starting_image_mode = Config.Default_mode_layers ?
|
starting_image_mode = Config.Default_mode_layers ?
|
||||||
IMAGE_MODE_LAYERED : IMAGE_MODE_ANIMATION;
|
IMAGE_MODE_LAYERED : IMAGE_MODE_ANIMATION;
|
||||||
@ -799,7 +799,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
|
|
||||||
// Nettoyage de l'écran virtuel (les autres recevront celui-ci par copie)
|
// Nettoyage de l'écran virtuel (les autres recevront celui-ci par copie)
|
||||||
memset(Main_screen,0,Main_image_width*Main_image_height);
|
memset(Main_screen,0,Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// Now that the backup system is there, we can store the gradients.
|
// Now that the backup system is there, we can store the gradients.
|
||||||
memcpy(Main_backups->Pages->Gradients->Range, initial_gradients.Range, sizeof(initial_gradients.Range));
|
memcpy(Main_backups->Pages->Gradients->Range, initial_gradients.Range, sizeof(initial_gradients.Range));
|
||||||
@ -828,8 +828,8 @@ int Init_program(int argc,char * argv[])
|
|||||||
// On affiche le curseur pour débuter correctement l'état du programme:
|
// On affiche le curseur pour débuter correctement l'état du programme:
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
Spare_image_is_modified=0;
|
Spare.image_is_modified=0;
|
||||||
Main_image_is_modified=0;
|
Main.image_is_modified=0;
|
||||||
|
|
||||||
// Gestionnaire de signaux, quand il ne reste plus aucun espoir
|
// Gestionnaire de signaux, quand il ne reste plus aucun espoir
|
||||||
Init_sighandler();
|
Init_sighandler();
|
||||||
@ -851,7 +851,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
// backups
|
// backups
|
||||||
if (file_in_command_line > 0)
|
if (file_in_command_line > 0)
|
||||||
{
|
{
|
||||||
strcpy(Main_selector.Directory, main_directory);
|
strcpy(Main.selector.Directory, main_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test de recuperation de fichiers sauvés
|
// Test de recuperation de fichiers sauvés
|
||||||
@ -862,7 +862,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
default:
|
default:
|
||||||
// Some files were loaded from last crash-exit.
|
// Some files were loaded from last crash-exit.
|
||||||
// Do not load files from command-line, nor show splash screen.
|
// Do not load files from command-line, nor show splash screen.
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_menu();
|
Display_menu();
|
||||||
@ -918,11 +918,11 @@ int Init_program(int argc,char * argv[])
|
|||||||
Spare_backups->Pages->Image_mode = Main_backups->Pages->Image_mode;
|
Spare_backups->Pages->Image_mode = Main_backups->Pages->Image_mode;
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
Back_color=Main_backups->Pages->Background_transparent ?
|
Back_color=Main_backups->Pages->Background_transparent ?
|
||||||
Main_backups->Pages->Transparent_color :
|
Main_backups->Pages->Transparent_color :
|
||||||
Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
||||||
Fore_color=Main_palette[Back_color].R+Main_palette[Back_color].G+Main_palette[Back_color].B < 3*127 ?
|
Fore_color=Main.palette[Back_color].R+Main.palette[Back_color].G+Main.palette[Back_color].B < 3*127 ?
|
||||||
Best_color_range(255,255,255,Config.Palette_cells_X*Config.Palette_cells_Y) :
|
Best_color_range(255,255,255,Config.Palette_cells_X*Config.Palette_cells_Y) :
|
||||||
Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
Best_color_range(0,0,0,Config.Palette_cells_X*Config.Palette_cells_Y);
|
||||||
Check_menu_mode();
|
Check_menu_mode();
|
||||||
|
|||||||
96
src/misc.c
96
src/misc.c
@ -56,7 +56,7 @@ word Count_used_colors(dword* usage)
|
|||||||
for (i = 0; i < 256; i++) usage[i]=0;
|
for (i = 0; i < 256; i++) usage[i]=0;
|
||||||
|
|
||||||
// Compute total number of pixels in the picture
|
// Compute total number of pixels in the picture
|
||||||
nb_pixels = Main_image_height * Main_image_width;
|
nb_pixels = Main.image_height * Main.image_width;
|
||||||
|
|
||||||
// For each layer
|
// For each layer
|
||||||
for (layer = 0; layer < Main_backups->Pages->Nb_layers; layer++)
|
for (layer = 0; layer < Main_backups->Pages->Nb_layers; layer++)
|
||||||
@ -137,7 +137,7 @@ word Count_used_colors_area(dword* usage, word start_x, word start_y,
|
|||||||
for (x = 0; x < width; x++)
|
for (x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
// Get color from picture
|
// Get color from picture
|
||||||
color=*(Main_screen+((start_x + x)+(start_y + y)*Main_image_width));
|
color=*(Main_screen+((start_x + x)+(start_y + y)*Main.image_width));
|
||||||
usage[color]++; //Un point de plus pour cette couleur
|
usage[color]++; //Un point de plus pour cette couleur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,10 +204,10 @@ void Clear_current_image_with_stencil(byte color, byte * stencil)
|
|||||||
int nb_pixels=0; //ECX
|
int nb_pixels=0; //ECX
|
||||||
//al=color
|
//al=color
|
||||||
//edi=Screen_pixels
|
//edi=Screen_pixels
|
||||||
byte* pixel=Main_backups->Pages->Image[Main_current_layer].Pixels;
|
byte* pixel=Main_backups->Pages->Image[Main.current_layer].Pixels;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
nb_pixels=Main_image_height*Main_image_width;
|
nb_pixels=Main.image_height*Main.image_width;
|
||||||
|
|
||||||
for(i=0;i<nb_pixels;i++)
|
for(i=0;i<nb_pixels;i++)
|
||||||
{
|
{
|
||||||
@ -221,9 +221,9 @@ void Clear_current_image(byte color)
|
|||||||
// Effacer l'image courante avec une certaine couleur
|
// Effacer l'image courante avec une certaine couleur
|
||||||
{
|
{
|
||||||
memset(
|
memset(
|
||||||
Main_backups->Pages->Image[Main_current_layer].Pixels,
|
Main_backups->Pages->Image[Main.current_layer].Pixels,
|
||||||
color ,
|
color ,
|
||||||
Main_image_width * Main_image_height
|
Main.image_width * Main.image_height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,19 +298,19 @@ void Copy_part_of_image_to_another(byte * source,word source_x,word source_y,wor
|
|||||||
|
|
||||||
byte Read_pixel_from_spare_screen(word x,word y)
|
byte Read_pixel_from_spare_screen(word x,word y)
|
||||||
{
|
{
|
||||||
// return *(Spare_screen+y*Spare_image_width+x);
|
// return *(Spare_screen+y*Spare.image_width+x);
|
||||||
|
|
||||||
// Clipping is required as this can be called with coordinates from main image
|
// Clipping is required as this can be called with coordinates from main image
|
||||||
// (can be a bigger or smaller image)
|
// (can be a bigger or smaller image)
|
||||||
if (x>=Spare_image_width || y>=Spare_image_height)
|
if (x>=Spare.image_width || y>=Spare.image_height)
|
||||||
return Spare_backups->Pages->Transparent_color;
|
return Spare_backups->Pages->Transparent_color;
|
||||||
if (Spare_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
if (Spare_backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
return *(Spare_backups->Pages->Image[Spare_current_layer].Pixels + y*Spare_image_width + x);
|
return *(Spare_backups->Pages->Image[Spare.current_layer].Pixels + y*Spare.image_width + x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return *(Spare_visible_image.Image + y*Spare_image_width + x);
|
return *(Spare_visible_image.Image + y*Spare.image_width + x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ void Remap_general_lowlevel(byte * conversion_table,byte * in_buffer, byte *out_
|
|||||||
|
|
||||||
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width)
|
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width)
|
||||||
{
|
{
|
||||||
byte* src=start_y*image_width+start_x+Main_backups->Pages->Image[Main_current_layer].Pixels; //Adr départ image (ESI)
|
byte* src=start_y*image_width+start_x+Main_backups->Pages->Image[Main.current_layer].Pixels; //Adr départ image (ESI)
|
||||||
byte* dest=Brush_original_pixels; //Adr dest brosse (EDI)
|
byte* dest=Brush_original_pixels; //Adr dest brosse (EDI)
|
||||||
int dx;
|
int dx;
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Bru
|
|||||||
|
|
||||||
byte Read_pixel_from_feedback_screen (word x,word y)
|
byte Read_pixel_from_feedback_screen (word x,word y)
|
||||||
{
|
{
|
||||||
return *(FX_feedback_screen+y*Main_image_width+x);
|
return *(FX_feedback_screen+y*Main.image_width+x);
|
||||||
}
|
}
|
||||||
|
|
||||||
dword Round_div(dword numerator,dword divisor)
|
dword Round_div(dword numerator,dword divisor)
|
||||||
@ -410,7 +410,7 @@ void Replace_colors_within_limits(byte * replace_table)
|
|||||||
// Pour chaque pixel sur la ligne :
|
// Pour chaque pixel sur la ligne :
|
||||||
for (x = Limit_left;x <= Limit_right;x ++)
|
for (x = Limit_left;x <= Limit_right;x ++)
|
||||||
{
|
{
|
||||||
pixel = Main_backups->Pages->Image[Main_current_layer].Pixels+y*Main_image_width+x;
|
pixel = Main_backups->Pages->Image[Main.current_layer].Pixels+y*Main.image_width+x;
|
||||||
*pixel = replace_table[*pixel];
|
*pixel = replace_table[*pixel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ void Replace_colors_within_limits(byte * replace_table)
|
|||||||
|
|
||||||
byte Read_pixel_from_backup_screen (word x,word y)
|
byte Read_pixel_from_backup_screen (word x,word y)
|
||||||
{
|
{
|
||||||
return *(Screen_backup + x + Main_image_width * y);
|
return *(Screen_backup + x + Main.image_width * y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Palette_256_to_64(T_Palette palette)
|
void Palette_256_to_64(T_Palette palette)
|
||||||
@ -454,12 +454,12 @@ byte Effect_interpolated_colorize (word x,word y,byte color)
|
|||||||
// On place dans ESI 3*Couleur_dessous ( = position de cette couleur dans la
|
// On place dans ESI 3*Couleur_dessous ( = position de cette couleur dans la
|
||||||
// palette des teintes) et dans EDI, 3*color.
|
// palette des teintes) et dans EDI, 3*color.
|
||||||
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
||||||
byte blue_under=Main_palette[color_under].B;
|
byte blue_under=Main.palette[color_under].B;
|
||||||
byte blue=Main_palette[color].B;
|
byte blue=Main.palette[color].B;
|
||||||
byte green_under=Main_palette[color_under].G;
|
byte green_under=Main.palette[color_under].G;
|
||||||
byte green=Main_palette[color].G;
|
byte green=Main.palette[color].G;
|
||||||
byte red_under=Main_palette[color_under].R;
|
byte red_under=Main.palette[color_under].R;
|
||||||
byte red=Main_palette[color].R;
|
byte red=Main.palette[color].R;
|
||||||
|
|
||||||
// On récupère les 3 composantes RVB
|
// On récupère les 3 composantes RVB
|
||||||
|
|
||||||
@ -477,12 +477,12 @@ byte Effect_interpolated_colorize (word x,word y,byte color)
|
|||||||
byte Effect_additive_colorize (word x,word y,byte color)
|
byte Effect_additive_colorize (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
||||||
byte blue_under=Main_palette[color_under].B;
|
byte blue_under=Main.palette[color_under].B;
|
||||||
byte green_under=Main_palette[color_under].G;
|
byte green_under=Main.palette[color_under].G;
|
||||||
byte red_under=Main_palette[color_under].R;
|
byte red_under=Main.palette[color_under].R;
|
||||||
byte blue=Main_palette[color].B;
|
byte blue=Main.palette[color].B;
|
||||||
byte green=Main_palette[color].G;
|
byte green=Main.palette[color].G;
|
||||||
byte red=Main_palette[color].R;
|
byte red=Main.palette[color].R;
|
||||||
|
|
||||||
return Best_color(
|
return Best_color(
|
||||||
red>red_under?red:red_under,
|
red>red_under?red:red_under,
|
||||||
@ -493,12 +493,12 @@ byte Effect_additive_colorize (word x,word y,byte color)
|
|||||||
byte Effect_substractive_colorize(word x,word y,byte color)
|
byte Effect_substractive_colorize(word x,word y,byte color)
|
||||||
{
|
{
|
||||||
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
||||||
byte blue_under=Main_palette[color_under].B;
|
byte blue_under=Main.palette[color_under].B;
|
||||||
byte green_under=Main_palette[color_under].G;
|
byte green_under=Main.palette[color_under].G;
|
||||||
byte red_under=Main_palette[color_under].R;
|
byte red_under=Main.palette[color_under].R;
|
||||||
byte blue=Main_palette[color].B;
|
byte blue=Main.palette[color].B;
|
||||||
byte green=Main_palette[color].G;
|
byte green=Main.palette[color].G;
|
||||||
byte red=Main_palette[color].R;
|
byte red=Main.palette[color].R;
|
||||||
|
|
||||||
return Best_color(
|
return Best_color(
|
||||||
red<red_under?red:red_under,
|
red<red_under?red:red_under,
|
||||||
@ -509,17 +509,17 @@ byte Effect_substractive_colorize(word x,word y,byte color)
|
|||||||
byte Effect_alpha_colorize (word x,word y,byte color)
|
byte Effect_alpha_colorize (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
||||||
byte blue_under=Main_palette[color_under].B;
|
byte blue_under=Main.palette[color_under].B;
|
||||||
byte green_under=Main_palette[color_under].G;
|
byte green_under=Main.palette[color_under].G;
|
||||||
byte red_under=Main_palette[color_under].R;
|
byte red_under=Main.palette[color_under].R;
|
||||||
int factor=(Main_palette[color].R*76 +
|
int factor=(Main.palette[color].R*76 +
|
||||||
Main_palette[color].G*151 +
|
Main.palette[color].G*151 +
|
||||||
Main_palette[color].B*28)/255;
|
Main.palette[color].B*28)/255;
|
||||||
|
|
||||||
return Best_color(
|
return Best_color(
|
||||||
(Main_palette[Fore_color].R*factor + red_under*(255-factor))/255,
|
(Main.palette[Fore_color].R*factor + red_under*(255-factor))/255,
|
||||||
(Main_palette[Fore_color].G*factor + green_under*(255-factor))/255,
|
(Main.palette[Fore_color].G*factor + green_under*(255-factor))/255,
|
||||||
(Main_palette[Fore_color].B*factor + blue_under*(255-factor))/255);
|
(Main.palette[Fore_color].B*factor + blue_under*(255-factor))/255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Check_timer(void)
|
void Check_timer(void)
|
||||||
@ -687,18 +687,18 @@ void Rescale(byte *src_buffer, short src_width, short src_height, byte *dst_buff
|
|||||||
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset)
|
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset)
|
||||||
{
|
{
|
||||||
byte* src = main_src; //source de la copie
|
byte* src = main_src; //source de la copie
|
||||||
byte* dest = main_dest + y_offset * Main_image_width + x_offset;
|
byte* dest = main_dest + y_offset * Main.image_width + x_offset;
|
||||||
const word length = Main_image_width - x_offset; // Nombre de pixels ŕ copier ŕ droite
|
const word length = Main.image_width - x_offset; // Nombre de pixels ŕ copier ŕ droite
|
||||||
word y;
|
word y;
|
||||||
for(y = Main_image_height - y_offset;y>0;y--)
|
for(y = Main.image_height - y_offset;y>0;y--)
|
||||||
{
|
{
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
memcpy(dest,src,length);
|
memcpy(dest,src,length);
|
||||||
memcpy(dest - x_offset,src+length,x_offset);
|
memcpy(dest - x_offset,src+length,x_offset);
|
||||||
|
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
dest += Main_image_width;
|
dest += Main.image_width;
|
||||||
src += Main_image_width;
|
src += Main.image_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On vient de faire le traitement pour otutes les lignes au-dessous de y_offset
|
// On vient de faire le traitement pour otutes les lignes au-dessous de y_offset
|
||||||
@ -709,8 +709,8 @@ void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_of
|
|||||||
memcpy(dest,src,length);
|
memcpy(dest,src,length);
|
||||||
memcpy(dest - x_offset,src+length,x_offset);
|
memcpy(dest - x_offset,src+length,x_offset);
|
||||||
|
|
||||||
dest += Main_image_width;
|
dest += Main.image_width;
|
||||||
src += Main_image_width;
|
src += Main.image_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Update_rect(0,0,0,0);
|
Update_rect(0,0,0,0);
|
||||||
|
|||||||
18
src/oldies.c
18
src/oldies.c
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
void Pixel_in_layer(word x,word y, byte layer, byte color)
|
void Pixel_in_layer(word x,word y, byte layer, byte color)
|
||||||
{
|
{
|
||||||
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[layer].Pixels)=color;
|
*((y)*Main.image_width+(x)+Main_backups->Pages->Image[layer].Pixels)=color;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
||||||
@ -57,7 +57,7 @@ byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
|||||||
// Prerequisites
|
// Prerequisites
|
||||||
if (Main_backups->Pages->Nb_layers < 3)
|
if (Main_backups->Pages->Nb_layers < 3)
|
||||||
return 1;
|
return 1;
|
||||||
if (Main_image_width != 160 || Main_image_height != 200)
|
if (Main.image_width != 160 || Main.image_height != 200)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
memset(used_colors,0,200*40*sizeof(word));
|
memset(used_colors,0,200*40*sizeof(word));
|
||||||
@ -76,7 +76,7 @@ byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
|||||||
{
|
{
|
||||||
for (x=0;x<4;x++)
|
for (x=0;x<4;x++)
|
||||||
{
|
{
|
||||||
byte c=*((row)*Main_image_width+(col*4+x)+Main_backups->Pages->Image[2].Pixels);
|
byte c=*((row)*Main.image_width+(col*4+x)+Main_backups->Pages->Image[2].Pixels);
|
||||||
used_colors[row][col] |= 1<<c;
|
used_colors[row][col] |= 1<<c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
|||||||
// Get "mandatory colors" from layer 1
|
// Get "mandatory colors" from layer 1
|
||||||
for (row=0;row<200;row++)
|
for (row=0;row<200;row++)
|
||||||
{
|
{
|
||||||
byte c=*((row)*Main_image_width+0+Main_backups->Pages->Image[0].Pixels);
|
byte c=*((row)*Main.image_width+0+Main_backups->Pages->Image[0].Pixels);
|
||||||
if (c<16)
|
if (c<16)
|
||||||
{
|
{
|
||||||
line_color[row]=c;
|
line_color[row]=c;
|
||||||
@ -100,7 +100,7 @@ byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
|||||||
{
|
{
|
||||||
for (col=0;col<40;col++)
|
for (col=0;col<40;col++)
|
||||||
{
|
{
|
||||||
byte c=*((row)*Main_image_width+(col*4)+Main_backups->Pages->Image[1].Pixels);
|
byte c=*((row)*Main.image_width+(col*4)+Main_backups->Pages->Image[1].Pixels);
|
||||||
if (c<16)
|
if (c<16)
|
||||||
{
|
{
|
||||||
block_color[row/8][col]=c;
|
block_color[row/8][col]=c;
|
||||||
@ -312,7 +312,7 @@ byte C64_FLI(byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
|
|||||||
for(x=0; x<4; x++)
|
for(x=0; x<4; x++)
|
||||||
{
|
{
|
||||||
byte bits;
|
byte bits;
|
||||||
byte c=*((row*8+y)*Main_image_width+(col*4+x)+Main_backups->Pages->Image[2].Pixels);
|
byte c=*((row*8+y)*Main.image_width+(col*4+x)+Main_backups->Pages->Image[2].Pixels);
|
||||||
|
|
||||||
if (c==line_color[row*8+y])
|
if (c==line_color[row*8+y])
|
||||||
// BG color
|
// BG color
|
||||||
@ -356,9 +356,9 @@ byte C64_FLI_enforcer(void)
|
|||||||
byte c[4];
|
byte c[4];
|
||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
if (Main_image_width != 160)
|
if (Main.image_width != 160)
|
||||||
return 1;
|
return 1;
|
||||||
if (Main_image_height != 200)
|
if (Main.image_height != 200)
|
||||||
return 1;
|
return 1;
|
||||||
if (Main_backups->Pages->Nb_layers != 4)
|
if (Main_backups->Pages->Nb_layers != 4)
|
||||||
return 2;
|
return 2;
|
||||||
@ -397,7 +397,7 @@ byte C64_FLI_enforcer(void)
|
|||||||
// Visible feedback:
|
// Visible feedback:
|
||||||
|
|
||||||
// If the "check" layer was visible, manually update the whole thing
|
// If the "check" layer was visible, manually update the whole thing
|
||||||
if (Main_layers_visible & (1<<3))
|
if (Main.layers_visible & (1<<3))
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
|
|||||||
@ -110,7 +110,7 @@ void Start_operation_stack(word new_operation)
|
|||||||
|
|
||||||
void Init_start_operation(void)
|
void Init_start_operation(void)
|
||||||
{
|
{
|
||||||
Operation_in_magnifier=(Mouse_X>=Main_X_zoom);
|
Operation_in_magnifier=(Mouse_X>=Main.X_zoom);
|
||||||
Smear_start=1;
|
Smear_start=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,14 +1435,14 @@ void Draw_curve_cross(short x_pos, short y_pos)
|
|||||||
for (i=start_x; i<=end_x; i++)
|
for (i=start_x; i<=end_x; i++)
|
||||||
{
|
{
|
||||||
temp=x_pos+i-3;
|
temp=x_pos+i-3;
|
||||||
Pixel_preview(temp,y_pos,xor_lut[Read_pixel(temp -Main_offset_X,
|
Pixel_preview(temp,y_pos,xor_lut[Read_pixel(temp -Main.offset_X,
|
||||||
y_pos-Main_offset_Y)]);
|
y_pos-Main.offset_Y)]);
|
||||||
}
|
}
|
||||||
for (i=start_y; i<=end_y; i++)
|
for (i=start_y; i<=end_y; i++)
|
||||||
{
|
{
|
||||||
temp=y_pos+i-3;
|
temp=y_pos+i-3;
|
||||||
Pixel_preview(x_pos,temp,xor_lut[Read_pixel(x_pos-Main_offset_X,
|
Pixel_preview(x_pos,temp,xor_lut[Read_pixel(x_pos-Main.offset_X,
|
||||||
temp -Main_offset_Y)]);
|
temp -Main.offset_Y)]);
|
||||||
}
|
}
|
||||||
Update_part_of_screen(x_pos+start_x-3,y_pos+start_y-3,end_x-start_x+1,end_y-start_y+1);
|
Update_part_of_screen(x_pos+start_x-3,y_pos+start_y-3,end_x-start_x+1,end_y-start_y+1);
|
||||||
}
|
}
|
||||||
@ -2784,14 +2784,14 @@ void Scroll_12_0(void)
|
|||||||
Backup();
|
Backup();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Backup_layers(LAYER_ALL); // Main_layers_visible
|
Backup_layers(LAYER_ALL); // Main.layers_visible
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
// Ensure the backup visible image is up-to-date
|
// Ensure the backup visible image is up-to-date
|
||||||
// (after swapping some layers on/off, it gets outdated)
|
// (after swapping some layers on/off, it gets outdated)
|
||||||
memcpy(Main_visible_image_backup.Image,
|
memcpy(Main_visible_image_backup.Image,
|
||||||
Main_visible_image.Image,
|
Main_visible_image.Image,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update_screen_targets();
|
Update_screen_targets();
|
||||||
@ -2832,14 +2832,14 @@ void Scroll_12_5(void)
|
|||||||
// L'utilisateur a bougé, il faut scroller l'image
|
// L'utilisateur a bougé, il faut scroller l'image
|
||||||
|
|
||||||
if (Paintbrush_X>=center_x)
|
if (Paintbrush_X>=center_x)
|
||||||
x_offset=(Paintbrush_X-center_x)%Main_image_width;
|
x_offset=(Paintbrush_X-center_x)%Main.image_width;
|
||||||
else
|
else
|
||||||
x_offset=Main_image_width-((center_x-Paintbrush_X)%Main_image_width);
|
x_offset=Main.image_width-((center_x-Paintbrush_X)%Main.image_width);
|
||||||
|
|
||||||
if (Paintbrush_Y>=center_y)
|
if (Paintbrush_Y>=center_y)
|
||||||
y_offset=(Paintbrush_Y-center_y)%Main_image_height;
|
y_offset=(Paintbrush_Y-center_y)%Main.image_height;
|
||||||
else
|
else
|
||||||
y_offset=Main_image_height-((center_y-Paintbrush_Y)%Main_image_height);
|
y_offset=Main.image_height-((center_y-Paintbrush_Y)%Main.image_height);
|
||||||
|
|
||||||
Display_coords_rel_or_abs(center_x,center_y);
|
Display_coords_rel_or_abs(center_x,center_y);
|
||||||
|
|
||||||
@ -2851,7 +2851,7 @@ void Scroll_12_5(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// One layer at once
|
// One layer at once
|
||||||
Scroll_picture(Main_backups->Pages->Next->Image[Main_current_layer].Pixels, Main_backups->Pages->Image[Main_current_layer].Pixels, x_offset, y_offset);
|
Scroll_picture(Main_backups->Pages->Next->Image[Main.current_layer].Pixels, Main_backups->Pages->Image[Main.current_layer].Pixels, x_offset, y_offset);
|
||||||
Redraw_current_layer();
|
Redraw_current_layer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2895,18 +2895,18 @@ void Scroll_0_5(void)
|
|||||||
{
|
{
|
||||||
// All layers at once
|
// All layers at once
|
||||||
if (x_pos>=center_x)
|
if (x_pos>=center_x)
|
||||||
x_offset=(x_pos-center_x)%Main_image_width;
|
x_offset=(x_pos-center_x)%Main.image_width;
|
||||||
else
|
else
|
||||||
x_offset=Main_image_width-((center_x-x_pos)%Main_image_width);
|
x_offset=Main.image_width-((center_x-x_pos)%Main.image_width);
|
||||||
|
|
||||||
if (y_pos>=center_y)
|
if (y_pos>=center_y)
|
||||||
y_offset=(y_pos-center_y)%Main_image_height;
|
y_offset=(y_pos-center_y)%Main.image_height;
|
||||||
else
|
else
|
||||||
y_offset=Main_image_height-((center_y-y_pos)%Main_image_height);
|
y_offset=Main.image_height-((center_y-y_pos)%Main.image_height);
|
||||||
|
|
||||||
// Do the actual scroll operation on all layers.
|
// Do the actual scroll operation on all layers.
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
//if ((1<<i) & Main_layers_visible)
|
//if ((1<<i) & Main.layers_visible)
|
||||||
Scroll_picture(Main_backups->Pages->Next->Image[i].Pixels, Main_backups->Pages->Image[i].Pixels, x_offset, y_offset);
|
Scroll_picture(Main_backups->Pages->Next->Image[i].Pixels, Main_backups->Pages->Image[i].Pixels, x_offset, y_offset);
|
||||||
// Update the depth buffer too ...
|
// Update the depth buffer too ...
|
||||||
// It would be faster to scroll it, but we don't have method
|
// It would be faster to scroll it, but we don't have method
|
||||||
@ -2917,7 +2917,7 @@ void Scroll_0_5(void)
|
|||||||
{
|
{
|
||||||
// One layer : everything was done while dragging the mouse
|
// One layer : everything was done while dragging the mouse
|
||||||
}
|
}
|
||||||
if (Main_tilemap_mode)
|
if (Main.tilemap_mode)
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
|
|
||||||
Cursor_hidden=Cursor_hidden_before_scroll;
|
Cursor_hidden=Cursor_hidden_before_scroll;
|
||||||
@ -3511,59 +3511,59 @@ void Draw_xor_rect(short start_x, short start_y, short end_x, short end_y)
|
|||||||
short height = end_y-start_y;
|
short height = end_y-start_y;
|
||||||
|
|
||||||
// Handle clipping
|
// Handle clipping
|
||||||
if (end_x-Main_offset_X > Min(Main_image_width,
|
if (end_x-Main.offset_X > Min(Main.image_width,
|
||||||
Main_magnifier_mode?Main_separator_position:Screen_width))
|
Main.magnifier_mode?Main.separator_position:Screen_width))
|
||||||
{
|
{
|
||||||
offset_width = end_x - Min(Main_image_width,
|
offset_width = end_x - Min(Main.image_width,
|
||||||
Main_magnifier_mode?Main_separator_position:Screen_width);
|
Main.magnifier_mode?Main.separator_position:Screen_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end_y-Main_offset_Y > Min(Main_image_height, Menu_Y))
|
if (end_y-Main.offset_Y > Min(Main.image_height, Menu_Y))
|
||||||
offset_height = end_y - Min(Main_image_height, Menu_Y);
|
offset_height = end_y - Min(Main.image_height, Menu_Y);
|
||||||
|
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
{
|
{
|
||||||
// Single line
|
// Single line
|
||||||
Vertical_XOR_line(start_x-Main_offset_X, start_y
|
Vertical_XOR_line(start_x-Main.offset_X, start_y
|
||||||
- Main_offset_Y, height - offset_height + 1);
|
- Main.offset_Y, height - offset_height + 1);
|
||||||
}
|
}
|
||||||
else if (height == 0)
|
else if (height == 0)
|
||||||
{
|
{
|
||||||
// Single line
|
// Single line
|
||||||
Horizontal_XOR_line(start_x-Main_offset_X,
|
Horizontal_XOR_line(start_x-Main.offset_X,
|
||||||
start_y - Main_offset_Y, width - offset_width + 1);
|
start_y - Main.offset_Y, width - offset_width + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Dessin dans la zone de dessin normale
|
// Dessin dans la zone de dessin normale
|
||||||
Horizontal_XOR_line(start_x-Main_offset_X,
|
Horizontal_XOR_line(start_x-Main.offset_X,
|
||||||
start_y - Main_offset_Y, width - offset_width + 1);
|
start_y - Main.offset_Y, width - offset_width + 1);
|
||||||
|
|
||||||
// If not, this line is out of the picture so there is no need to draw it
|
// If not, this line is out of the picture so there is no need to draw it
|
||||||
if (offset_height == 0 || end_y - 1 > Menu_Y + Main_offset_Y)
|
if (offset_height == 0 || end_y - 1 > Menu_Y + Main.offset_Y)
|
||||||
{
|
{
|
||||||
Horizontal_XOR_line(start_x - Main_offset_X, end_y
|
Horizontal_XOR_line(start_x - Main.offset_X, end_y
|
||||||
- Main_offset_Y, width - offset_width + 1);
|
- Main.offset_Y, width - offset_width + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > offset_height + 2)
|
if (height > offset_height + 2)
|
||||||
{
|
{
|
||||||
Vertical_XOR_line(start_x-Main_offset_X, start_y
|
Vertical_XOR_line(start_x-Main.offset_X, start_y
|
||||||
- Main_offset_Y + 1, height - offset_height - 1);
|
- Main.offset_Y + 1, height - offset_height - 1);
|
||||||
|
|
||||||
if (offset_width == 0)
|
if (offset_width == 0)
|
||||||
{
|
{
|
||||||
Vertical_XOR_line(end_x - Main_offset_X, start_y
|
Vertical_XOR_line(end_x - Main.offset_X, start_y
|
||||||
- Main_offset_Y + 1, height - offset_height - 1);
|
- Main.offset_Y + 1, height - offset_height - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Update_rect(start_x - Main_offset_X, start_y - Main_offset_Y,
|
Update_rect(start_x - Main.offset_X, start_y - Main.offset_Y,
|
||||||
width + 1 - offset_width, height + 1 - offset_height);
|
width + 1 - offset_width, height + 1 - offset_height);
|
||||||
|
|
||||||
// Dessin dans la zone zoomée
|
// Dessin dans la zone zoomée
|
||||||
if (Main_magnifier_mode && start_x <= Limit_right_zoom
|
if (Main.magnifier_mode && start_x <= Limit_right_zoom
|
||||||
&& end_x > Limit_left_zoom
|
&& end_x > Limit_left_zoom
|
||||||
&& start_y <= Limit_bottom_zoom
|
&& start_y <= Limit_bottom_zoom
|
||||||
&& end_y > Limit_top_zoom )
|
&& end_y > Limit_top_zoom )
|
||||||
@ -3652,9 +3652,9 @@ void Grad_rectangle_0_5(void)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
// Check if the rectangle is not fully outside the picture
|
// Check if the rectangle is not fully outside the picture
|
||||||
if (start_x > Main_image_width // Rectangle at right of picture
|
if (start_x > Main.image_width // Rectangle at right of picture
|
||||||
|| start_y > Main_image_height // Rectangle below picture
|
|| start_y > Main.image_height // Rectangle below picture
|
||||||
|| start_y - 1 - Main_offset_Y > Menu_Y ) // Rectangle below viewport
|
|| start_y - 1 - Main.offset_Y > Menu_Y ) // Rectangle below viewport
|
||||||
{
|
{
|
||||||
Operation_pop(&end_y); // reset the stack
|
Operation_pop(&end_y); // reset the stack
|
||||||
return; // cancel the operation
|
return; // cancel the operation
|
||||||
@ -4084,7 +4084,7 @@ void Pan_view_12_2(void)
|
|||||||
if (Paintbrush_X!=start_x || Paintbrush_Y!=start_y)
|
if (Paintbrush_X!=start_x || Paintbrush_Y!=start_y)
|
||||||
{
|
{
|
||||||
// User moved
|
// User moved
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Scroll_magnifier(start_x-Paintbrush_X,start_y-Paintbrush_Y);
|
Scroll_magnifier(start_x-Paintbrush_X,start_y-Paintbrush_Y);
|
||||||
else
|
else
|
||||||
Scroll_screen(start_x-Paintbrush_X,start_y-Paintbrush_Y);
|
Scroll_screen(start_x-Paintbrush_X,start_y-Paintbrush_Y);
|
||||||
|
|||||||
199
src/pages.c
199
src/pages.c
@ -172,19 +172,19 @@ void Download_infos_page_main(T_Page * page)
|
|||||||
|
|
||||||
if (page!=NULL)
|
if (page!=NULL)
|
||||||
{
|
{
|
||||||
size_is_modified=(Main_image_width!=page->Width) ||
|
size_is_modified=(Main.image_width!=page->Width) ||
|
||||||
(Main_image_height!=page->Height);
|
(Main.image_height!=page->Height);
|
||||||
|
|
||||||
Main_image_width=page->Width;
|
Main.image_width=page->Width;
|
||||||
Main_image_height=page->Height;
|
Main.image_height=page->Height;
|
||||||
memcpy(Main_palette,page->Palette,sizeof(T_Palette));
|
memcpy(Main.palette,page->Palette,sizeof(T_Palette));
|
||||||
Main_fileformat=page->File_format;
|
Main.fileformat=page->File_format;
|
||||||
|
|
||||||
if (size_is_modified)
|
if (size_is_modified)
|
||||||
{
|
{
|
||||||
Main_magnifier_mode=0;
|
Main.magnifier_mode=0;
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
Pixel_preview=Pixel_preview_normal;
|
Pixel_preview=Pixel_preview_normal;
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
@ -192,7 +192,7 @@ void Download_infos_page_main(T_Page * page)
|
|||||||
|
|
||||||
}
|
}
|
||||||
//Update_buffers( page->Width, page->Height);
|
//Update_buffers( page->Width, page->Height);
|
||||||
//memcpy(Main_screen, page->Image[Main_current_layer].Pixels, page->Width*page->Height);
|
//memcpy(Main_screen, page->Image[Main.current_layer].Pixels, page->Width*page->Height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,15 +203,15 @@ void Redraw_layered_image(void)
|
|||||||
// Re-construct the image with the visible layers
|
// Re-construct the image with the visible layers
|
||||||
byte layer=0;
|
byte layer=0;
|
||||||
// First layer
|
// First layer
|
||||||
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main_layers_visible & (1<<4))
|
if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5 && Main.layers_visible & (1<<4))
|
||||||
{
|
{
|
||||||
// The raster result layer is visible: start there
|
// The raster result layer is visible: start there
|
||||||
// Copy it in Main_visible_image
|
// Copy it in Main_visible_image
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i< Main_image_width*Main_image_height; i++)
|
for (i=0; i< Main.image_width*Main.image_height; i++)
|
||||||
{
|
{
|
||||||
layer = *(Main_backups->Pages->Image[4].Pixels+i);
|
layer = *(Main_backups->Pages->Image[4].Pixels+i);
|
||||||
if (Main_layers_visible & (1 << layer))
|
if (Main.layers_visible & (1 << layer))
|
||||||
Main_visible_image.Image[i]=*(Main_backups->Pages->Image[layer].Pixels+i);
|
Main_visible_image.Image[i]=*(Main_backups->Pages->Image[layer].Pixels+i);
|
||||||
else
|
else
|
||||||
Main_visible_image.Image[i] = layer;
|
Main_visible_image.Image[i] = layer;
|
||||||
@ -220,7 +220,7 @@ void Redraw_layered_image(void)
|
|||||||
// Copy it to the depth buffer
|
// Copy it to the depth buffer
|
||||||
memcpy(Main_visible_image_depth_buffer.Image,
|
memcpy(Main_visible_image_depth_buffer.Image,
|
||||||
Main_backups->Pages->Image[4].Pixels,
|
Main_backups->Pages->Image[4].Pixels,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
layer= (1<<4)+1;
|
layer= (1<<4)+1;
|
||||||
@ -229,17 +229,17 @@ void Redraw_layered_image(void)
|
|||||||
{
|
{
|
||||||
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
if ((1<<layer) & Main_layers_visible)
|
if ((1<<layer) & Main.layers_visible)
|
||||||
{
|
{
|
||||||
// Copy it in Main_visible_image
|
// Copy it in Main_visible_image
|
||||||
memcpy(Main_visible_image.Image,
|
memcpy(Main_visible_image.Image,
|
||||||
Main_backups->Pages->Image[layer].Pixels,
|
Main_backups->Pages->Image[layer].Pixels,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// Initialize the depth buffer
|
// Initialize the depth buffer
|
||||||
memset(Main_visible_image_depth_buffer.Image,
|
memset(Main_visible_image_depth_buffer.Image,
|
||||||
layer,
|
layer,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// skip all other layers
|
// skip all other layers
|
||||||
layer++;
|
layer++;
|
||||||
@ -250,16 +250,16 @@ void Redraw_layered_image(void)
|
|||||||
// subsequent layer(s)
|
// subsequent layer(s)
|
||||||
for (; layer<Main_backups->Pages->Nb_layers; layer++)
|
for (; layer<Main_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
if ((1<<layer) & Main_layers_visible)
|
if ((1<<layer) & Main.layers_visible)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<Main_image_width*Main_image_height; i++)
|
for (i=0; i<Main.image_width*Main.image_height; i++)
|
||||||
{
|
{
|
||||||
byte color = *(Main_backups->Pages->Image[layer].Pixels+i);
|
byte color = *(Main_backups->Pages->Image[layer].Pixels+i);
|
||||||
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
||||||
{
|
{
|
||||||
*(Main_visible_image.Image+i) = color;
|
*(Main_visible_image.Image+i) = color;
|
||||||
if (layer != Main_current_layer)
|
if (layer != Main.current_layer)
|
||||||
*(Main_visible_image_depth_buffer.Image+i) = layer;
|
*(Main_visible_image_depth_buffer.Image+i) = layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,12 +285,12 @@ void Update_depth_buffer(void)
|
|||||||
// First layer
|
// First layer
|
||||||
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
if ((1<<layer) & Main_layers_visible)
|
if ((1<<layer) & Main.layers_visible)
|
||||||
{
|
{
|
||||||
// Initialize the depth buffer
|
// Initialize the depth buffer
|
||||||
memset(Main_visible_image_depth_buffer.Image,
|
memset(Main_visible_image_depth_buffer.Image,
|
||||||
layer,
|
layer,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// skip all other layers
|
// skip all other layers
|
||||||
layer++;
|
layer++;
|
||||||
@ -301,13 +301,13 @@ void Update_depth_buffer(void)
|
|||||||
for (; layer<Main_backups->Pages->Nb_layers; layer++)
|
for (; layer<Main_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
// skip the current layer, whenever we reach it
|
// skip the current layer, whenever we reach it
|
||||||
if (layer == Main_current_layer)
|
if (layer == Main.current_layer)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((1<<layer) & Main_layers_visible)
|
if ((1<<layer) & Main.layers_visible)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<Main_image_width*Main_image_height; i++)
|
for (i=0; i<Main.image_width*Main.image_height; i++)
|
||||||
{
|
{
|
||||||
byte color = *(Main_backups->Pages->Image[layer].Pixels+i);
|
byte color = *(Main_backups->Pages->Image[layer].Pixels+i);
|
||||||
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
||||||
@ -330,17 +330,17 @@ void Redraw_spare_image(void)
|
|||||||
// First layer
|
// First layer
|
||||||
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
if ((1<<layer) & Spare_layers_visible)
|
if ((1<<layer) & Spare.layers_visible)
|
||||||
{
|
{
|
||||||
// Copy it in Spare_visible_image
|
// Copy it in Spare_visible_image
|
||||||
memcpy(Spare_visible_image.Image,
|
memcpy(Spare_visible_image.Image,
|
||||||
Spare_backups->Pages->Image[layer].Pixels,
|
Spare_backups->Pages->Image[layer].Pixels,
|
||||||
Spare_image_width*Spare_image_height);
|
Spare.image_width*Spare.image_height);
|
||||||
|
|
||||||
// No depth buffer in the spare
|
// No depth buffer in the spare
|
||||||
//memset(Spare_visible_image_depth_buffer.Image,
|
//memset(Spare_visible_image_depth_buffer.Image,
|
||||||
// layer,
|
// layer,
|
||||||
// Spare_image_width*Spare_image_height);
|
// Spare.image_width*Spare.image_height);
|
||||||
|
|
||||||
// skip all other layers
|
// skip all other layers
|
||||||
layer++;
|
layer++;
|
||||||
@ -350,16 +350,16 @@ void Redraw_spare_image(void)
|
|||||||
// subsequent layer(s)
|
// subsequent layer(s)
|
||||||
for (; layer<Spare_backups->Pages->Nb_layers; layer++)
|
for (; layer<Spare_backups->Pages->Nb_layers; layer++)
|
||||||
{
|
{
|
||||||
if ((1<<layer) & Spare_layers_visible)
|
if ((1<<layer) & Spare.layers_visible)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<Spare_image_width*Spare_image_height; i++)
|
for (i=0; i<Spare.image_width*Spare.image_height; i++)
|
||||||
{
|
{
|
||||||
byte color = *(Spare_backups->Pages->Image[layer].Pixels+i);
|
byte color = *(Spare_backups->Pages->Image[layer].Pixels+i);
|
||||||
if (color != Spare_backups->Pages->Transparent_color) // transparent color
|
if (color != Spare_backups->Pages->Transparent_color) // transparent color
|
||||||
{
|
{
|
||||||
*(Spare_visible_image.Image+i) = color;
|
*(Spare_visible_image.Image+i) = color;
|
||||||
//if (layer != Spare_current_layer)
|
//if (layer != Spare.current_layer)
|
||||||
// *(Spare_visible_image_depth_buffer.Image+i) = layer;
|
// *(Spare_visible_image_depth_buffer.Image+i) = layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,12 +373,12 @@ void Redraw_current_layer(void)
|
|||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<Main_image_width*Main_image_height; i++)
|
for (i=0; i<Main.image_width*Main.image_height; i++)
|
||||||
{
|
{
|
||||||
byte depth = *(Main_visible_image_depth_buffer.Image+i);
|
byte depth = *(Main_visible_image_depth_buffer.Image+i);
|
||||||
if (depth<=Main_current_layer)
|
if (depth<=Main.current_layer)
|
||||||
{
|
{
|
||||||
byte color = *(Main_backups->Pages->Image[Main_current_layer].Pixels+i);
|
byte color = *(Main_backups->Pages->Image[Main.current_layer].Pixels+i);
|
||||||
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
||||||
{
|
{
|
||||||
*(Main_visible_image.Image+i) = color;
|
*(Main_visible_image.Image+i) = color;
|
||||||
@ -392,27 +392,29 @@ void Redraw_current_layer(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : Upload_infos_page_main/Upload_infos_page_spare => Upload_infos_page()
|
||||||
void Upload_infos_page_main(T_Page * page)
|
void Upload_infos_page_main(T_Page * page)
|
||||||
// Sauve l'écran courant dans la page
|
// Sauve l'écran courant dans la page
|
||||||
{
|
{
|
||||||
if (page!=NULL)
|
if (page!=NULL)
|
||||||
{
|
{
|
||||||
//page->Image[Main_current_layer].Pixels=Main_screen;
|
//page->Image[Main.current_layer].Pixels=Main_screen;
|
||||||
page->Width=Main_image_width;
|
page->Width=Main.image_width;
|
||||||
page->Height=Main_image_height;
|
page->Height=Main.image_height;
|
||||||
memcpy(page->Palette,Main_palette,sizeof(T_Palette));
|
memcpy(page->Palette,Main.palette,sizeof(T_Palette));
|
||||||
page->File_format=Main_fileformat;
|
page->File_format=Main.fileformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : Download_infos_page_main/Download_infos_page_spare => Download_infos_page()
|
||||||
void Download_infos_page_spare(T_Page * page)
|
void Download_infos_page_spare(T_Page * page)
|
||||||
{
|
{
|
||||||
if (page!=NULL)
|
if (page!=NULL)
|
||||||
{
|
{
|
||||||
Spare_image_width=page->Width;
|
Spare.image_width=page->Width;
|
||||||
Spare_image_height=page->Height;
|
Spare.image_height=page->Height;
|
||||||
memcpy(Spare_palette,page->Palette,sizeof(T_Palette));
|
memcpy(Spare.palette,page->Palette,sizeof(T_Palette));
|
||||||
Spare_fileformat=page->File_format;
|
Spare.fileformat=page->File_format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,11 +422,11 @@ void Upload_infos_page_spare(T_Page * page)
|
|||||||
{
|
{
|
||||||
if (page!=NULL)
|
if (page!=NULL)
|
||||||
{
|
{
|
||||||
//page->Image[Spare_current_layer].Pixels=Spare_screen;
|
//page->Image[Spare.current_layer].Pixels=Spare_screen;
|
||||||
page->Width=Spare_image_width;
|
page->Width=Spare.image_width;
|
||||||
page->Height=Spare_image_height;
|
page->Height=Spare.image_height;
|
||||||
memcpy(page->Palette,Spare_palette,sizeof(T_Palette));
|
memcpy(page->Palette,Spare.palette,sizeof(T_Palette));
|
||||||
page->File_format=Spare_fileformat;
|
page->File_format=Spare.fileformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,9 +436,9 @@ void Update_FX_feedback(byte with_feedback)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (with_feedback)
|
if (with_feedback)
|
||||||
FX_feedback_screen=Main_backups->Pages->Image[Main_current_layer].Pixels;
|
FX_feedback_screen=Main_backups->Pages->Image[Main.current_layer].Pixels;
|
||||||
else
|
else
|
||||||
FX_feedback_screen=Main_backups->Pages->Next->Image[Main_current_layer].Pixels;
|
FX_feedback_screen=Main_backups->Pages->Next->Image[Main.current_layer].Pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear_page(T_Page * page)
|
void Clear_page(T_Page * page)
|
||||||
@ -686,7 +688,7 @@ void Update_screen_targets(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main_screen=Main_backups->Pages->Image[Main_current_layer].Pixels;
|
Main_screen=Main_backups->Pages->Image[Main.current_layer].Pixels;
|
||||||
// Sometimes this function will be called in situations where the
|
// Sometimes this function will be called in situations where the
|
||||||
// current history step and previous one don't have as many layers.
|
// current history step and previous one don't have as many layers.
|
||||||
// I don't like the idea of letting Screen_backup NULL or dangling,
|
// I don't like the idea of letting Screen_backup NULL or dangling,
|
||||||
@ -697,7 +699,7 @@ void Update_screen_targets(void)
|
|||||||
|| Main_backups->Pages->Height != Main_backups->Pages->Next->Height)
|
|| Main_backups->Pages->Height != Main_backups->Pages->Next->Height)
|
||||||
Screen_backup=Main_screen;
|
Screen_backup=Main_screen;
|
||||||
else
|
else
|
||||||
Screen_backup=Main_backups->Pages->Next->Image[Main_current_layer].Pixels;
|
Screen_backup=Main_backups->Pages->Next->Image[Main.current_layer].Pixels;
|
||||||
}
|
}
|
||||||
Update_pixel_renderer();
|
Update_pixel_renderer();
|
||||||
}
|
}
|
||||||
@ -785,7 +787,7 @@ int Init_all_backup_lists(enum IMAGE_MODES image_mode, int width, int height)
|
|||||||
// On y met les infos sur la dimension de démarrage
|
// On y met les infos sur la dimension de démarrage
|
||||||
Main_backups->Pages->Width=width;
|
Main_backups->Pages->Width=width;
|
||||||
Main_backups->Pages->Height=height;
|
Main_backups->Pages->Height=height;
|
||||||
strcpy(Main_backups->Pages->File_directory,Main_selector.Directory);
|
strcpy(Main_backups->Pages->File_directory,Main.selector.Directory);
|
||||||
strcpy(Main_backups->Pages->Filename,"NO_NAME.GIF");
|
strcpy(Main_backups->Pages->Filename,"NO_NAME.GIF");
|
||||||
|
|
||||||
|
|
||||||
@ -828,16 +830,16 @@ int Init_all_backup_lists(enum IMAGE_MODES image_mode, int width, int height)
|
|||||||
// Default values for spare page
|
// Default values for spare page
|
||||||
Spare_backups->Pages->Width = width;
|
Spare_backups->Pages->Width = width;
|
||||||
Spare_backups->Pages->Height = height;
|
Spare_backups->Pages->Height = height;
|
||||||
memcpy(Spare_backups->Pages->Palette,Main_palette,sizeof(T_Palette));
|
memcpy(Spare_backups->Pages->Palette,Main.palette,sizeof(T_Palette));
|
||||||
strcpy(Spare_backups->Pages->Comment,"");
|
strcpy(Spare_backups->Pages->Comment,"");
|
||||||
strcpy(Spare_backups->Pages->File_directory,Main_selector.Directory);
|
strcpy(Spare_backups->Pages->File_directory,Main.selector.Directory);
|
||||||
strcpy(Spare_backups->Pages->Filename,"NO_NAME2.GIF");
|
strcpy(Spare_backups->Pages->Filename,"NO_NAME2.GIF");
|
||||||
Spare_backups->Pages->File_format=DEFAULT_FILEFORMAT;
|
Spare_backups->Pages->File_format=DEFAULT_FILEFORMAT;
|
||||||
// Copy this informations in the global Spare_ variables
|
// Copy this informations in the global Spare_ variables
|
||||||
Download_infos_page_spare(Spare_backups->Pages);
|
Download_infos_page_spare(Spare_backups->Pages);
|
||||||
|
|
||||||
// Clear the initial Visible buffer
|
// Clear the initial Visible buffer
|
||||||
//memset(Main_screen,0,Main_image_width*Main_image_height);
|
//memset(Main_screen,0,Main.image_width*Main.image_height);
|
||||||
|
|
||||||
// Spare
|
// Spare
|
||||||
for (i=0; i<NB_LAYERS; i++)
|
for (i=0; i<NB_LAYERS; i++)
|
||||||
@ -848,7 +850,7 @@ int Init_all_backup_lists(enum IMAGE_MODES image_mode, int width, int height)
|
|||||||
memset(Spare_backups->Pages->Image[i].Pixels, 0, width*height);
|
memset(Spare_backups->Pages->Image[i].Pixels, 0, width*height);
|
||||||
|
|
||||||
}
|
}
|
||||||
//memset(Spare_screen,0,Spare_image_width*Spare_image_height);
|
//memset(Spare_screen,0,Spare.image_width*Spare.image_height);
|
||||||
|
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
return 1;
|
return 1;
|
||||||
@ -946,7 +948,7 @@ int Backup_with_new_dimensions(int width,int height)
|
|||||||
{
|
{
|
||||||
memcpy(Main_visible_image_backup.Image,
|
memcpy(Main_visible_image_backup.Image,
|
||||||
Main_visible_image.Image,
|
Main_visible_image.Image,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1077,7 +1079,7 @@ int Backup_and_resize_the_spare(int width,int height)
|
|||||||
Download_infos_page_spare(Spare_backups->Pages);
|
Download_infos_page_spare(Spare_backups->Pages);
|
||||||
|
|
||||||
// Light up the 'has unsaved changes' indicator
|
// Light up the 'has unsaved changes' indicator
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
|
|
||||||
return_code=1;
|
return_code=1;
|
||||||
}
|
}
|
||||||
@ -1088,7 +1090,7 @@ void Backup(void)
|
|||||||
// Sauve la page courante comme première page de backup et crée une nouvelle page
|
// Sauve la page courante comme première page de backup et crée une nouvelle page
|
||||||
// pur continuer à dessiner. Utilisé par exemple pour le fill
|
// pur continuer à dessiner. Utilisé par exemple pour le fill
|
||||||
{
|
{
|
||||||
Backup_layers(Main_current_layer);
|
Backup_layers(Main.current_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Backup_layers(int layer)
|
void Backup_layers(int layer)
|
||||||
@ -1097,7 +1099,7 @@ void Backup_layers(int layer)
|
|||||||
T_Page *new_page;
|
T_Page *new_page;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (Last_backed_up_layers == (1<<Main_current_layer))
|
if (Last_backed_up_layers == (1<<Main.current_layer))
|
||||||
return; // Already done.
|
return; // Already done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1129,14 +1131,14 @@ void Backup_layers(int layer)
|
|||||||
if (layer == LAYER_ALL || i == layer)
|
if (layer == LAYER_ALL || i == layer)
|
||||||
memcpy(Main_backups->Pages->Image[i].Pixels,
|
memcpy(Main_backups->Pages->Image[i].Pixels,
|
||||||
Main_backups->Pages->Next->Image[i].Pixels,
|
Main_backups->Pages->Next->Image[i].Pixels,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Light up the 'has unsaved changes' indicator
|
// Light up the 'has unsaved changes' indicator
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Last_backed_up_layers = 1<<Main_current_layer;
|
Last_backed_up_layers = 1<<Main.current_layer;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,27 +1188,27 @@ void Backup_the_spare(int layer)
|
|||||||
if (layer == LAYER_ALL || i == layer)
|
if (layer == LAYER_ALL || i == layer)
|
||||||
memcpy(Spare_backups->Pages->Image[i].Pixels,
|
memcpy(Spare_backups->Pages->Image[i].Pixels,
|
||||||
Spare_backups->Pages->Next->Image[i].Pixels,
|
Spare_backups->Pages->Next->Image[i].Pixels,
|
||||||
Spare_image_width*Spare_image_height);
|
Spare.image_width*Spare.image_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Light up the 'has unsaved changes' indicator
|
// Light up the 'has unsaved changes' indicator
|
||||||
Spare_image_is_modified=1;
|
Spare.image_is_modified=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Check_layers_limits()
|
void Check_layers_limits()
|
||||||
{
|
{
|
||||||
if (Main_current_layer > Main_backups->Pages->Nb_layers-1)
|
if (Main.current_layer > Main_backups->Pages->Nb_layers-1)
|
||||||
{
|
{
|
||||||
Main_current_layer = Main_backups->Pages->Nb_layers-1;
|
Main.current_layer = Main_backups->Pages->Nb_layers-1;
|
||||||
Main_layers_visible |= 1<<Main_current_layer;
|
Main.layers_visible |= 1<<Main.current_layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Undo(void)
|
void Undo(void)
|
||||||
{
|
{
|
||||||
int width = Main_image_width;
|
int width = Main.image_width;
|
||||||
int height = Main_image_height;
|
int height = Main.image_height;
|
||||||
|
|
||||||
if (Last_backed_up_layers)
|
if (Last_backed_up_layers)
|
||||||
{
|
{
|
||||||
@ -1233,14 +1235,14 @@ void Undo(void)
|
|||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
|
|
||||||
if (width != Main_image_width || height != Main_image_height)
|
if (width != Main.image_width || height != Main.image_height)
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Redo(void)
|
void Redo(void)
|
||||||
{
|
{
|
||||||
int width = Main_image_width;
|
int width = Main.image_width;
|
||||||
int height = Main_image_height;
|
int height = Main.image_height;
|
||||||
|
|
||||||
if (Last_backed_up_layers)
|
if (Last_backed_up_layers)
|
||||||
{
|
{
|
||||||
@ -1266,7 +1268,7 @@ void Redo(void)
|
|||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
|
|
||||||
if (width != Main_image_width || height != Main_image_height)
|
if (width != Main.image_width || height != Main.image_height)
|
||||||
Tilemap_update();
|
Tilemap_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1299,6 +1301,7 @@ void Exchange_main_and_spare(void)
|
|||||||
Upload_infos_page_spare(Spare_backups->Pages);
|
Upload_infos_page_spare(Spare_backups->Pages);
|
||||||
|
|
||||||
// On inverse les listes de pages
|
// On inverse les listes de pages
|
||||||
|
//TODO
|
||||||
temp_list=Main_backups;
|
temp_list=Main_backups;
|
||||||
Main_backups=Spare_backups;
|
Main_backups=Spare_backups;
|
||||||
Spare_backups=temp_list;
|
Spare_backups=temp_list;
|
||||||
@ -1312,8 +1315,8 @@ void Exchange_main_and_spare(void)
|
|||||||
// un changement de dimensions et va bêtement sortir du mode loupe, alors
|
// un changement de dimensions et va bêtement sortir du mode loupe, alors
|
||||||
// que lors d'un changement de page, on veut bien conserver l'état du mode
|
// que lors d'un changement de page, on veut bien conserver l'état du mode
|
||||||
// loupe du brouillon.
|
// loupe du brouillon.
|
||||||
Main_image_width=Main_backups->Pages->Width;
|
Main.image_width=Main_backups->Pages->Width;
|
||||||
Main_image_height=Main_backups->Pages->Height;
|
Main.image_height=Main_backups->Pages->Height;
|
||||||
|
|
||||||
Download_infos_page_main(Main_backups->Pages);
|
Download_infos_page_main(Main_backups->Pages);
|
||||||
Download_infos_page_spare(Spare_backups->Pages);
|
Download_infos_page_spare(Spare_backups->Pages);
|
||||||
@ -1322,18 +1325,18 @@ void Exchange_main_and_spare(void)
|
|||||||
void End_of_modification(void)
|
void End_of_modification(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Update_buffers(Main_image_width, Main_image_height);
|
//Update_buffers(Main.image_width, Main.image_height);
|
||||||
|
|
||||||
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
if (Main_backups->Pages->Image_mode != IMAGE_MODE_ANIMATION)
|
||||||
{
|
{
|
||||||
// Backup buffer can have "wrong" size if a Lua script
|
// Backup buffer can have "wrong" size if a Lua script
|
||||||
// performs a resize.
|
// performs a resize.
|
||||||
Update_buffers(Main_image_width, Main_image_height);
|
Update_buffers(Main.image_width, Main.image_height);
|
||||||
//
|
//
|
||||||
|
|
||||||
memcpy(Main_visible_image_backup.Image,
|
memcpy(Main_visible_image_backup.Image,
|
||||||
Main_visible_image.Image,
|
Main_visible_image.Image,
|
||||||
Main_image_width*Main_image_height);
|
Main.image_width*Main.image_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1347,7 +1350,7 @@ void End_of_modification(void)
|
|||||||
//
|
//
|
||||||
// Processing safety backups
|
// Processing safety backups
|
||||||
//
|
//
|
||||||
Main_edits_since_safety_backup++;
|
Main.edits_since_safety_backup++;
|
||||||
Rotate_safety_backups();
|
Rotate_safety_backups();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1423,13 +1426,13 @@ byte Add_layer(T_List_of_pages *list, int layer)
|
|||||||
// Determine if we're modifying the spare or the main page.
|
// Determine if we're modifying the spare or the main page.
|
||||||
if (list == Main_backups)
|
if (list == Main_backups)
|
||||||
{
|
{
|
||||||
visible_layers_flag = &Main_layers_visible;
|
visible_layers_flag = &Main.layers_visible;
|
||||||
Main_current_layer = layer;
|
Main.current_layer = layer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
visible_layers_flag = &Spare_layers_visible;
|
visible_layers_flag = &Spare.layers_visible;
|
||||||
Spare_current_layer = layer;
|
Spare.current_layer = layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fun with binary!
|
// Fun with binary!
|
||||||
@ -1482,17 +1485,17 @@ byte Delete_layer(T_List_of_pages *list, int layer)
|
|||||||
// Determine if we're modifying the spare or the main page.
|
// Determine if we're modifying the spare or the main page.
|
||||||
if (list == Main_backups)
|
if (list == Main_backups)
|
||||||
{
|
{
|
||||||
visible_layers_flag = &Main_layers_visible;
|
visible_layers_flag = &Main.layers_visible;
|
||||||
if (Main_current_layer>=layer && Main_current_layer>0)
|
if (Main.current_layer>=layer && Main.current_layer>0)
|
||||||
Main_current_layer--;
|
Main.current_layer--;
|
||||||
new_current_layer = Main_current_layer;
|
new_current_layer = Main.current_layer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
visible_layers_flag = &Spare_layers_visible;
|
visible_layers_flag = &Spare.layers_visible;
|
||||||
if (Spare_current_layer>=layer && Spare_current_layer>0)
|
if (Spare.current_layer>=layer && Spare.current_layer>0)
|
||||||
Spare_current_layer--;
|
Spare.current_layer--;
|
||||||
new_current_layer = Spare_current_layer;
|
new_current_layer = Spare.current_layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fun with binary!
|
// Fun with binary!
|
||||||
@ -1511,13 +1514,13 @@ byte Delete_layer(T_List_of_pages *list, int layer)
|
|||||||
byte Merge_layer()
|
byte Merge_layer()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<Main_image_width*Main_image_height; i++)
|
for (i=0; i<Main.image_width*Main.image_height; i++)
|
||||||
{
|
{
|
||||||
byte color = *(Main_backups->Pages->Image[Main_current_layer].Pixels+i);
|
byte color = *(Main_backups->Pages->Image[Main.current_layer].Pixels+i);
|
||||||
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
if (color != Main_backups->Pages->Transparent_color) // transparent color
|
||||||
*(Main_backups->Pages->Image[Main_current_layer-1].Pixels+i) = color;
|
*(Main_backups->Pages->Image[Main.current_layer-1].Pixels+i) = color;
|
||||||
}
|
}
|
||||||
return Delete_layer(Main_backups,Main_current_layer);
|
return Delete_layer(Main_backups,Main.current_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Switch_layer_mode(enum IMAGE_MODES new_mode)
|
void Switch_layer_mode(enum IMAGE_MODES new_mode)
|
||||||
@ -1532,7 +1535,7 @@ void Switch_layer_mode(enum IMAGE_MODES new_mode)
|
|||||||
case IMAGE_MODE_MODE5:
|
case IMAGE_MODE_MODE5:
|
||||||
case IMAGE_MODE_LAYERED:
|
case IMAGE_MODE_LAYERED:
|
||||||
default:
|
default:
|
||||||
Update_buffers(Main_image_width, Main_image_height);
|
Update_buffers(Main.image_width, Main.image_height);
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
break;
|
break;
|
||||||
case IMAGE_MODE_ANIMATION:
|
case IMAGE_MODE_ANIMATION:
|
||||||
|
|||||||
@ -348,58 +348,58 @@ void Remap_image_highlevel(byte * conversion_table)
|
|||||||
&& Main_backups->Pages->Image_mode != IMAGE_MODE_MODE5)
|
&& Main_backups->Pages->Image_mode != IMAGE_MODE_MODE5)
|
||||||
{
|
{
|
||||||
Remap_general_lowlevel(conversion_table,Main_visible_image.Image,Main_visible_image.Image,
|
Remap_general_lowlevel(conversion_table,Main_visible_image.Image,Main_visible_image.Image,
|
||||||
Main_image_width,Main_image_height,Main_image_width);
|
Main.image_width,Main.image_height,Main.image_width);
|
||||||
}
|
}
|
||||||
// Remap all layers
|
// Remap all layers
|
||||||
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
for (layer=0; layer<Main_backups->Pages->Nb_layers; layer++)
|
||||||
Remap_general_lowlevel(conversion_table,Main_backups->Pages->Image[layer].Pixels,Main_backups->Pages->Image[layer].Pixels,Main_image_width,Main_image_height,Main_image_width);
|
Remap_general_lowlevel(conversion_table,Main_backups->Pages->Image[layer].Pixels,Main_backups->Pages->Image[layer].Pixels,Main.image_width,Main.image_height,Main.image_width);
|
||||||
|
|
||||||
// Remap transparent color
|
// Remap transparent color
|
||||||
Main_backups->Pages->Transparent_color =
|
Main_backups->Pages->Transparent_color =
|
||||||
conversion_table[Main_backups->Pages->Transparent_color];
|
conversion_table[Main_backups->Pages->Transparent_color];
|
||||||
|
|
||||||
// On calcule les limites à l'écran de l'image
|
// On calcule les limites à l'écran de l'image
|
||||||
if (Main_image_height>=Menu_Y_before_window)
|
if (Main.image_height>=Menu_Y_before_window)
|
||||||
end_y=Menu_Y_before_window;
|
end_y=Menu_Y_before_window;
|
||||||
else
|
else
|
||||||
end_y=Main_image_height;
|
end_y=Main.image_height;
|
||||||
|
|
||||||
if (!Main_magnifier_mode)
|
if (!Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
if (Main_image_width>=Screen_width)
|
if (Main.image_width>=Screen_width)
|
||||||
end_x=Screen_width;
|
end_x=Screen_width;
|
||||||
else
|
else
|
||||||
end_x=Main_image_width;
|
end_x=Main.image_width;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Main_image_width>=Main_separator_position)
|
if (Main.image_width>=Main.separator_position)
|
||||||
end_x=Main_separator_position;
|
end_x=Main.separator_position;
|
||||||
else
|
else
|
||||||
end_x=Main_image_width;
|
end_x=Main.image_width;
|
||||||
|
|
||||||
if ((Main_X_zoom+(Main_image_width*Main_magnifier_factor))>=Screen_width)
|
if ((Main.X_zoom+(Main.image_width*Main.magnifier_factor))>=Screen_width)
|
||||||
end_x_mag=Screen_width;
|
end_x_mag=Screen_width;
|
||||||
else
|
else
|
||||||
end_x_mag=(Main_X_zoom+(Main_image_width*Main_magnifier_factor));
|
end_x_mag=(Main.X_zoom+(Main.image_width*Main.magnifier_factor));
|
||||||
|
|
||||||
if (Main_image_height*Main_magnifier_factor>=Menu_Y_before_window)
|
if (Main.image_height*Main.magnifier_factor>=Menu_Y_before_window)
|
||||||
end_y_mag=Menu_Y_before_window;
|
end_y_mag=Menu_Y_before_window;
|
||||||
else
|
else
|
||||||
end_y_mag=Main_image_height*Main_magnifier_factor;
|
end_y_mag=Main.image_height*Main.magnifier_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On doit maintenant faire la traduction à l'écran
|
// On doit maintenant faire la traduction à l'écran
|
||||||
Remap_zone_highlevel(0,0,end_x,end_y,conversion_table);
|
Remap_zone_highlevel(0,0,end_x,end_y,conversion_table);
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
Remap_zone_highlevel(Main_separator_position,0,end_x_mag,end_y_mag,conversion_table);
|
Remap_zone_highlevel(Main.separator_position,0,end_x_mag,end_y_mag,conversion_table);
|
||||||
// Il peut encore rester le bas de la barre de split à remapper si la
|
// Il peut encore rester le bas de la barre de split à remapper si la
|
||||||
// partie zoomée ne descend pas jusqu'en bas...
|
// partie zoomée ne descend pas jusqu'en bas...
|
||||||
Remap_zone_highlevel(Main_separator_position,end_y_mag,
|
Remap_zone_highlevel(Main.separator_position,end_y_mag,
|
||||||
(Main_separator_position+(SEPARATOR_WIDTH*Menu_factor_X)),
|
(Main.separator_position+(SEPARATOR_WIDTH*Menu_factor_X)),
|
||||||
Menu_Y_before_window,conversion_table);
|
Menu_Y_before_window,conversion_table);
|
||||||
}
|
}
|
||||||
// Remappe tous les fonds de fenetre (qui doivent contenir un bout d'écran)
|
// Remappe tous les fonds de fenetre (qui doivent contenir un bout d'écran)
|
||||||
@ -558,12 +558,12 @@ void Set_nice_menu_colors(dword * color_usage,int not_picture)
|
|||||||
|
|
||||||
target_rgb=Favorite_GUI_color(index);
|
target_rgb=Favorite_GUI_color(index);
|
||||||
color=new_colors[index];
|
color=new_colors[index];
|
||||||
rgb[index].R=Main_palette[color].R;
|
rgb[index].R=Main.palette[color].R;
|
||||||
rgb[index].G=Main_palette[color].G;
|
rgb[index].G=Main.palette[color].G;
|
||||||
rgb[index].B=Main_palette[color].B;
|
rgb[index].B=Main.palette[color].B;
|
||||||
Main_palette[color].R=Round_palette_component(target_rgb->R);
|
Main.palette[color].R=Round_palette_component(target_rgb->R);
|
||||||
Main_palette[color].G=Round_palette_component(target_rgb->G);
|
Main.palette[color].G=Round_palette_component(target_rgb->G);
|
||||||
Main_palette[color].B=Round_palette_component(target_rgb->B);
|
Main.palette[color].B=Round_palette_component(target_rgb->B);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maintenant qu'on a placé notre nouvelle palette, on va chercher quelles
|
// Maintenant qu'on a placé notre nouvelle palette, on va chercher quelles
|
||||||
@ -1153,7 +1153,7 @@ void Button_Palette(void)
|
|||||||
|
|
||||||
Open_window(299, 196,"Palette");
|
Open_window(299, 196,"Palette");
|
||||||
|
|
||||||
memcpy(working_palette, Main_palette, sizeof(T_Palette));
|
memcpy(working_palette, Main.palette, sizeof(T_Palette));
|
||||||
Palette_edit_step();
|
Palette_edit_step();
|
||||||
|
|
||||||
Window_set_palette_button(5, 89); // 1
|
Window_set_palette_button(5, 89); // 1
|
||||||
@ -1977,11 +1977,11 @@ void Button_Palette(void)
|
|||||||
|
|
||||||
if ((Config.Safety_colors) && (used_colors<4))
|
if ((Config.Safety_colors) && (used_colors<4))
|
||||||
{
|
{
|
||||||
memcpy(temp_palette, Main_palette, sizeof(T_Palette));
|
memcpy(temp_palette, Main.palette, sizeof(T_Palette));
|
||||||
memcpy(Main_palette, working_palette, sizeof(T_Palette));
|
memcpy(Main.palette, working_palette, sizeof(T_Palette));
|
||||||
Set_nice_menu_colors(color_usage, 0);
|
Set_nice_menu_colors(color_usage, 0);
|
||||||
memcpy(working_palette, Main_palette, sizeof(T_Palette));
|
memcpy(working_palette, Main.palette, sizeof(T_Palette));
|
||||||
memcpy(Main_palette, temp_palette, sizeof(T_Palette));
|
memcpy(Main.palette, temp_palette, sizeof(T_Palette));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_palette(working_palette); // On définit la nouvelle palette
|
Set_palette(working_palette); // On définit la nouvelle palette
|
||||||
@ -2024,11 +2024,11 @@ void Button_Palette(void)
|
|||||||
|
|
||||||
if ((Config.Safety_colors) && (used_colors<4) && (block_end==block_start))
|
if ((Config.Safety_colors) && (used_colors<4) && (block_end==block_start))
|
||||||
{
|
{
|
||||||
memcpy(temp_palette,Main_palette,sizeof(T_Palette));
|
memcpy(temp_palette,Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
memcpy(Main.palette,working_palette,sizeof(T_Palette));
|
||||||
Set_nice_menu_colors(color_usage,0);
|
Set_nice_menu_colors(color_usage,0);
|
||||||
memcpy(working_palette,Main_palette,sizeof(T_Palette));
|
memcpy(working_palette,Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Main_palette,temp_palette,sizeof(T_Palette));
|
memcpy(Main.palette,temp_palette,sizeof(T_Palette));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_palette(working_palette);
|
Set_palette(working_palette);
|
||||||
@ -2706,11 +2706,11 @@ void Button_Palette(void)
|
|||||||
Update_color_count(&used_colors, color_usage);
|
Update_color_count(&used_colors, color_usage);
|
||||||
|
|
||||||
Palette_edit_step();
|
Palette_edit_step();
|
||||||
memcpy(temp_palette,Main_palette,sizeof(T_Palette));
|
memcpy(temp_palette,Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
memcpy(Main.palette,working_palette,sizeof(T_Palette));
|
||||||
Set_nice_menu_colors(color_usage,0);
|
Set_nice_menu_colors(color_usage,0);
|
||||||
memcpy(working_palette,Main_palette,sizeof(T_Palette));
|
memcpy(working_palette,Main.palette,sizeof(T_Palette));
|
||||||
memcpy(Main_palette,temp_palette,sizeof(T_Palette));
|
memcpy(Main.palette,temp_palette,sizeof(T_Palette));
|
||||||
Set_palette(working_palette);
|
Set_palette(working_palette);
|
||||||
memcpy(temp_palette,working_palette,sizeof(T_Palette));
|
memcpy(temp_palette,working_palette,sizeof(T_Palette));
|
||||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||||
@ -2827,14 +2827,14 @@ void Button_Palette(void)
|
|||||||
if (clicked_button==14) // Sortie par OK
|
if (clicked_button==14) // Sortie par OK
|
||||||
{
|
{
|
||||||
if ( (!image_is_backed_up)
|
if ( (!image_is_backed_up)
|
||||||
&& memcmp(Main_palette,working_palette,sizeof(T_Palette)) )
|
&& memcmp(Main.palette,working_palette,sizeof(T_Palette)) )
|
||||||
Backup_layers(LAYER_NONE);
|
Backup_layers(LAYER_NONE);
|
||||||
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
memcpy(Main.palette,working_palette,sizeof(T_Palette));
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
// Not really needed, the change was in palette entries
|
// Not really needed, the change was in palette entries
|
||||||
}
|
}
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
|
||||||
// La variable employée ici n'a pas vraiment de rapport avec son nom...
|
// La variable employée ici n'a pas vraiment de rapport avec son nom...
|
||||||
need_to_remap=(Window_pos_Y+(Window_height*Menu_factor_Y)<Menu_Y_before_window);
|
need_to_remap=(Window_pos_Y+(Window_height*Menu_factor_Y)<Menu_Y_before_window);
|
||||||
@ -2854,7 +2854,7 @@ void Button_Palette(void)
|
|||||||
|
|
||||||
if (clicked_button==13) // Sortie par CANCEL
|
if (clicked_button==13) // Sortie par CANCEL
|
||||||
{
|
{
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
if (image_is_backed_up)
|
if (image_is_backed_up)
|
||||||
Select_button(BUTTON_UNDO,LEFT_SIDE);
|
Select_button(BUTTON_UNDO,LEFT_SIDE);
|
||||||
}
|
}
|
||||||
@ -3030,8 +3030,8 @@ void Button_Secondary_palette(void)
|
|||||||
{
|
{
|
||||||
Gamma = gamma;
|
Gamma = gamma;
|
||||||
Set_palette_RGB_scale(rgb_scale);
|
Set_palette_RGB_scale(rgb_scale);
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main.palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clicked_button==1)
|
if (clicked_button==1)
|
||||||
|
|||||||
@ -65,7 +65,7 @@ void Display_part_of_screen_double (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -95,14 +95,14 @@ void Pixel_preview_normal_double (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_double(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_double(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_double (word x,word y,byte color)
|
void Pixel_preview_magnifier_double (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_double(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_double(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -110,18 +110,18 @@ void Pixel_preview_magnifier_double (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_double(
|
Block_double(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ void Display_brush_mono_double(word x_pos, word y_pos,
|
|||||||
void Clear_brush_double(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_double(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -349,8 +349,8 @@ void Display_part_of_screen_scaled_double(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -359,24 +359,24 @@ void Display_part_of_screen_scaled_double(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor;
|
x = Main.magnifier_factor;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_double(
|
Display_line_on_screen_fast_double(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height)
|
if(y==height)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -401,12 +401,12 @@ void Display_brush_color_zoom_double(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
Display_transparent_line_on_screen_wide(x_pos,y*ZOOMY,width*Main_magnifier_factor,buffer,transp_color);
|
Display_transparent_line_on_screen_wide(x_pos,y*ZOOMY,width*Main.magnifier_factor,buffer,transp_color);
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -437,18 +437,18 @@ void Display_brush_mono_zoom_double(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_double(
|
Display_transparent_mono_line_on_screen_double(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -457,9 +457,9 @@ void Display_brush_mono_zoom_double(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -482,23 +482,23 @@ void Clear_brush_scaled_double(word x_pos,word y_pos,word x_offset,word y_offset
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
Display_line_on_screen_fast_double(x_pos,y,
|
Display_line_on_screen_fast_double(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
70
src/pxquad.c
70
src/pxquad.c
@ -76,7 +76,7 @@ void Display_part_of_screen_quad (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -110,14 +110,14 @@ void Pixel_preview_normal_quad (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_quad(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_quad(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_quad (word x,word y,byte color)
|
void Pixel_preview_magnifier_quad (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_quad(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_quad(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -125,18 +125,18 @@ void Pixel_preview_magnifier_quad (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_quad(
|
Block_quad(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ void Display_brush_mono_quad(word x_pos, word y_pos,
|
|||||||
void Clear_brush_quad(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_quad(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -366,8 +366,8 @@ void Display_part_of_screen_scaled_quad(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -376,24 +376,24 @@ void Display_part_of_screen_scaled_quad(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor/**ZOOMY*/;
|
x = Main.magnifier_factor/**ZOOMY*/;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_quad(
|
Display_line_on_screen_fast_quad(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height/**ZOOMY*/)
|
if(y==height/**ZOOMY*/)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -418,15 +418,15 @@ void Display_brush_color_zoom_quad(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
byte* line_src = buffer;
|
byte* line_src = buffer;
|
||||||
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
||||||
word x;
|
word x;
|
||||||
// Pour chaque pixel de la ligne
|
// Pour chaque pixel de la ligne
|
||||||
for(x = width*Main_magnifier_factor;x > 0;x--)
|
for(x = width*Main.magnifier_factor;x > 0;x--)
|
||||||
{
|
{
|
||||||
if(*line_src!=transp_color)
|
if(*line_src!=transp_color)
|
||||||
{
|
{
|
||||||
@ -436,11 +436,11 @@ void Display_brush_color_zoom_quad(word x_pos,word y_pos,
|
|||||||
dest+=ZOOMX;
|
dest+=ZOOMX;
|
||||||
}
|
}
|
||||||
// Double the line
|
// Double the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Triple the line
|
// Triple the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Quadruple it
|
// Quadruple it
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -471,18 +471,18 @@ void Display_brush_mono_zoom_quad(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_quad(
|
Display_transparent_mono_line_on_screen_quad(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -491,9 +491,9 @@ void Display_brush_mono_zoom_quad(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -516,24 +516,24 @@ void Clear_brush_scaled_quad(word x_pos,word y_pos,word x_offset,word y_offset,w
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// TODO a verifier
|
// TODO a verifier
|
||||||
Display_line_on_screen_fast_quad(x_pos,y,
|
Display_line_on_screen_fast_quad(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -58,7 +58,7 @@ void Display_part_of_screen_simple (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
for(y=height;y!=0;y--)
|
for(y=height;y!=0;y--)
|
||||||
@ -80,14 +80,14 @@ void Pixel_preview_normal_simple (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_simple(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_simple(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_simple (word x,word y,byte color)
|
void Pixel_preview_magnifier_simple (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_simple(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_simple(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -95,18 +95,18 @@ void Pixel_preview_magnifier_simple (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_simple(
|
Block_simple(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ void Display_brush_mono_simple(word x_pos, word y_pos,
|
|||||||
void Clear_brush_simple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_simple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos+y_pos*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos+y_pos*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
(void)y_offset; // unused
|
(void)y_offset; // unused
|
||||||
@ -307,8 +307,8 @@ void Display_part_of_screen_scaled_simple(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -317,24 +317,24 @@ void Display_part_of_screen_scaled_simple(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor;
|
x = Main.magnifier_factor;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_simple(
|
Display_line_on_screen_simple(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height)
|
if(y==height)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -376,11 +376,11 @@ void Display_brush_color_zoom_simple(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
Display_transparent_line_on_screen_simple(x_pos,y,width*Main_magnifier_factor,buffer,transp_color);
|
Display_transparent_line_on_screen_simple(x_pos,y,width*Main.magnifier_factor,buffer,transp_color);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -411,18 +411,18 @@ void Display_brush_mono_zoom_simple(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor;
|
bx = Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_simple(
|
Display_transparent_mono_line_on_screen_simple(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -431,9 +431,9 @@ void Display_brush_mono_zoom_simple(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos)
|
if(y == end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -455,23 +455,23 @@ void Clear_brush_scaled_simple(word x_pos,word y_pos,word x_offset,word y_offset
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
Display_line_on_screen_simple(x_pos,y,
|
Display_line_on_screen_simple(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
66
src/pxtall.c
66
src/pxtall.c
@ -63,7 +63,7 @@ void Display_part_of_screen_tall (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
for(y=height;y!=0;y--)
|
for(y=height;y!=0;y--)
|
||||||
@ -87,14 +87,14 @@ void Pixel_preview_normal_tall (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_tall(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_tall (word x,word y,byte color)
|
void Pixel_preview_magnifier_tall (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_tall(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -102,18 +102,18 @@ void Pixel_preview_magnifier_tall (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_tall(
|
Block_tall(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ void Display_brush_mono_tall(word x_pos, word y_pos,
|
|||||||
void Clear_brush_tall(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_tall(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
(void)y_offset; // unused
|
(void)y_offset; // unused
|
||||||
@ -308,8 +308,8 @@ void Display_part_of_screen_scaled_tall(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -318,24 +318,24 @@ void Display_part_of_screen_scaled_tall(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor*ZOOMY;
|
x = Main.magnifier_factor*ZOOMY;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_simple(
|
Display_line_on_screen_simple(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height*ZOOMY)
|
if(y==height*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -360,12 +360,12 @@ void Display_brush_color_zoom_tall(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
Display_transparent_line_on_screen_simple(x_pos,y*ZOOMY,width*Main_magnifier_factor,buffer,transp_color);
|
Display_transparent_line_on_screen_simple(x_pos,y*ZOOMY,width*Main.magnifier_factor,buffer,transp_color);
|
||||||
memcpy(Screen_pixels + (y*ZOOMY +1) * VIDEO_LINE_WIDTH + x_pos, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos, width*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY +1) * VIDEO_LINE_WIDTH + x_pos, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos, width*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -396,18 +396,18 @@ void Display_brush_mono_zoom_tall(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_simple(
|
Display_transparent_mono_line_on_screen_simple(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -416,9 +416,9 @@ void Display_brush_mono_zoom_tall(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -440,23 +440,23 @@ void Clear_brush_scaled_tall(word x_pos,word y_pos,word x_offset,word y_offset,w
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
Display_line_on_screen_tall(x_pos,y,
|
Display_line_on_screen_tall(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -68,7 +68,7 @@ void Display_part_of_screen_tall2 (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -102,14 +102,14 @@ void Pixel_preview_normal_tall2 (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_tall2(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall2(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_tall2 (word x,word y,byte color)
|
void Pixel_preview_magnifier_tall2 (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_tall2(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall2(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -117,18 +117,18 @@ void Pixel_preview_magnifier_tall2 (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_tall2(
|
Block_tall2(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ void Display_brush_mono_tall2(word x_pos, word y_pos,
|
|||||||
void Clear_brush_tall2(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_tall2(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -358,8 +358,8 @@ void Display_part_of_screen_scaled_tall2(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -368,24 +368,24 @@ void Display_part_of_screen_scaled_tall2(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor/**ZOOMY*/;
|
x = Main.magnifier_factor/**ZOOMY*/;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_tall2(
|
Display_line_on_screen_fast_tall2(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height/**ZOOMY*/)
|
if(y==height/**ZOOMY*/)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -410,15 +410,15 @@ void Display_brush_color_zoom_tall2(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
byte* line_src = buffer;
|
byte* line_src = buffer;
|
||||||
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
||||||
word x;
|
word x;
|
||||||
// Pour chaque pixel de la ligne
|
// Pour chaque pixel de la ligne
|
||||||
for(x = width*Main_magnifier_factor;x > 0;x--)
|
for(x = width*Main.magnifier_factor;x > 0;x--)
|
||||||
{
|
{
|
||||||
if(*line_src!=transp_color)
|
if(*line_src!=transp_color)
|
||||||
{
|
{
|
||||||
@ -428,11 +428,11 @@ void Display_brush_color_zoom_tall2(word x_pos,word y_pos,
|
|||||||
dest+=ZOOMX;
|
dest+=ZOOMX;
|
||||||
}
|
}
|
||||||
// Double the line
|
// Double the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Triple the line
|
// Triple the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Quadruple it
|
// Quadruple it
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -463,18 +463,18 @@ void Display_brush_mono_zoom_tall2(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_tall2(
|
Display_transparent_mono_line_on_screen_tall2(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -483,9 +483,9 @@ void Display_brush_mono_zoom_tall2(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -508,24 +508,24 @@ void Clear_brush_scaled_tall2(word x_pos,word y_pos,word x_offset,word y_offset,
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// TODO a verifier
|
// TODO a verifier
|
||||||
Display_line_on_screen_fast_tall2(x_pos,y,
|
Display_line_on_screen_fast_tall2(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ void Display_part_of_screen_tall3 (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -106,14 +106,14 @@ void Pixel_preview_normal_tall3 (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_tall3(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall3(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_tall3 (word x,word y,byte color)
|
void Pixel_preview_magnifier_tall3 (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_tall3(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_tall3(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -121,18 +121,18 @@ void Pixel_preview_magnifier_tall3 (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_tall3(
|
Block_tall3(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ void Display_brush_mono_tall3(word x_pos, word y_pos,
|
|||||||
void Clear_brush_tall3(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_tall3(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -362,8 +362,8 @@ void Display_part_of_screen_scaled_tall3(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -372,24 +372,24 @@ void Display_part_of_screen_scaled_tall3(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor/**ZOOMY*/;
|
x = Main.magnifier_factor/**ZOOMY*/;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_tall3(
|
Display_line_on_screen_fast_tall3(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height/**ZOOMY*/)
|
if(y==height/**ZOOMY*/)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -414,15 +414,15 @@ void Display_brush_color_zoom_tall3(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
byte* line_src = buffer;
|
byte* line_src = buffer;
|
||||||
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
||||||
word x;
|
word x;
|
||||||
// Pour chaque pixel de la ligne
|
// Pour chaque pixel de la ligne
|
||||||
for(x = width*Main_magnifier_factor;x > 0;x--)
|
for(x = width*Main.magnifier_factor;x > 0;x--)
|
||||||
{
|
{
|
||||||
if(*line_src!=transp_color)
|
if(*line_src!=transp_color)
|
||||||
{
|
{
|
||||||
@ -432,11 +432,11 @@ void Display_brush_color_zoom_tall3(word x_pos,word y_pos,
|
|||||||
dest+=ZOOMX;
|
dest+=ZOOMX;
|
||||||
}
|
}
|
||||||
// Double the line
|
// Double the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Triple the line
|
// Triple the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Quadruple it
|
// Quadruple it
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+3)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -467,18 +467,18 @@ void Display_brush_mono_zoom_tall3(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_tall3(
|
Display_transparent_mono_line_on_screen_tall3(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -487,9 +487,9 @@ void Display_brush_mono_zoom_tall3(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -512,24 +512,24 @@ void Clear_brush_scaled_tall3(word x_pos,word y_pos,word x_offset,word y_offset,
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// TODO a verifier
|
// TODO a verifier
|
||||||
Display_line_on_screen_fast_tall3(x_pos,y,
|
Display_line_on_screen_fast_tall3(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ void Display_part_of_screen_triple (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -101,14 +101,14 @@ void Pixel_preview_normal_triple (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_triple(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_triple(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_triple (word x,word y,byte color)
|
void Pixel_preview_magnifier_triple (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_triple(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_triple(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -116,18 +116,18 @@ void Pixel_preview_magnifier_triple (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_triple(
|
Block_triple(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ void Display_brush_mono_triple(word x_pos, word y_pos,
|
|||||||
void Clear_brush_triple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_triple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -356,8 +356,8 @@ void Display_part_of_screen_scaled_triple(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -366,24 +366,24 @@ void Display_part_of_screen_scaled_triple(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor/**ZOOMY*/;
|
x = Main.magnifier_factor/**ZOOMY*/;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_triple(
|
Display_line_on_screen_fast_triple(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height/**ZOOMY*/)
|
if(y==height/**ZOOMY*/)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -408,15 +408,15 @@ void Display_brush_color_zoom_triple(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
byte* line_src = buffer;
|
byte* line_src = buffer;
|
||||||
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
||||||
word x;
|
word x;
|
||||||
// Pour chaque pixel de la ligne
|
// Pour chaque pixel de la ligne
|
||||||
for(x = width*Main_magnifier_factor;x > 0;x--)
|
for(x = width*Main.magnifier_factor;x > 0;x--)
|
||||||
{
|
{
|
||||||
if(*line_src!=transp_color)
|
if(*line_src!=transp_color)
|
||||||
{
|
{
|
||||||
@ -426,9 +426,9 @@ void Display_brush_color_zoom_triple(word x_pos,word y_pos,
|
|||||||
dest+=ZOOMX;
|
dest+=ZOOMX;
|
||||||
}
|
}
|
||||||
// Double the line
|
// Double the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
// Triple the line
|
// Triple the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+2)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -459,18 +459,18 @@ void Display_brush_mono_zoom_triple(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_triple(
|
Display_transparent_mono_line_on_screen_triple(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -479,9 +479,9 @@ void Display_brush_mono_zoom_triple(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -504,24 +504,24 @@ void Clear_brush_scaled_triple(word x_pos,word y_pos,word x_offset,word y_offset
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// TODO a verifier
|
// TODO a verifier
|
||||||
Display_line_on_screen_fast_triple(x_pos,y,
|
Display_line_on_screen_fast_triple(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
64
src/pxwide.c
64
src/pxwide.c
@ -62,7 +62,7 @@ void Display_part_of_screen_wide (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -90,14 +90,14 @@ void Pixel_preview_normal_wide (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_wide(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_wide(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_wide (word x,word y,byte color)
|
void Pixel_preview_magnifier_wide (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_wide(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_wide(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -105,18 +105,18 @@ void Pixel_preview_magnifier_wide (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_wide(
|
Block_wide(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ void Display_brush_mono_wide(word x_pos, word y_pos,
|
|||||||
void Clear_brush_wide(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_wide(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -342,8 +342,8 @@ void Display_part_of_screen_scaled_wide(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -352,24 +352,24 @@ void Display_part_of_screen_scaled_wide(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor;
|
x = Main.magnifier_factor;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_wide(
|
Display_line_on_screen_fast_wide(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height)
|
if(y==height)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -412,11 +412,11 @@ void Display_brush_color_zoom_wide(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
Display_transparent_line_on_screen_wide(x_pos,y*ZOOMY,width*Main_magnifier_factor,buffer,transp_color);
|
Display_transparent_line_on_screen_wide(x_pos,y*ZOOMY,width*Main.magnifier_factor,buffer,transp_color);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -447,18 +447,18 @@ void Display_brush_mono_zoom_wide(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_wide(
|
Display_transparent_mono_line_on_screen_wide(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -467,9 +467,9 @@ void Display_brush_mono_zoom_wide(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -491,23 +491,23 @@ void Clear_brush_scaled_wide(word x_pos,word y_pos,word x_offset,word y_offset,w
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
Display_line_on_screen_fast_wide(x_pos,y,
|
Display_line_on_screen_fast_wide(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -68,7 +68,7 @@ void Display_part_of_screen_wide2 (word width,word height,word image_width)
|
|||||||
/* Afficher une partie de l'image telle quelle sur l'écran */
|
/* Afficher une partie de l'image telle quelle sur l'écran */
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
|
byte* src=Main.offset_Y*image_width+Main.offset_X+Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int dy;
|
int dy;
|
||||||
|
|
||||||
@ -98,14 +98,14 @@ void Pixel_preview_normal_wide2 (word x,word y,byte color)
|
|||||||
* Note: si on modifie cette procédure, il faudra penser à faire également
|
* Note: si on modifie cette procédure, il faudra penser à faire également
|
||||||
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
* la modif dans la procédure Pixel_Preview_Loupe_SDL. */
|
||||||
{
|
{
|
||||||
// if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
|
// if(x-Main.offset_X >= 0 && y - Main.offset_Y >= 0)
|
||||||
Pixel_wide2(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_wide2(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_preview_magnifier_wide2 (word x,word y,byte color)
|
void Pixel_preview_magnifier_wide2 (word x,word y,byte color)
|
||||||
{
|
{
|
||||||
// Affiche le pixel dans la partie non zoomée
|
// Affiche le pixel dans la partie non zoomée
|
||||||
Pixel_wide2(x-Main_offset_X,y-Main_offset_Y,color);
|
Pixel_wide2(x-Main.offset_X,y-Main.offset_Y,color);
|
||||||
|
|
||||||
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
// Regarde si on doit aussi l'afficher dans la partie zoomée
|
||||||
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
|
||||||
@ -113,18 +113,18 @@ void Pixel_preview_magnifier_wide2 (word x,word y,byte color)
|
|||||||
{
|
{
|
||||||
// On est dedans
|
// On est dedans
|
||||||
int height;
|
int height;
|
||||||
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
|
int y_zoom = Main.magnifier_factor * (y-Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (Menu_Y - y_zoom < Main_magnifier_factor)
|
if (Menu_Y - y_zoom < Main.magnifier_factor)
|
||||||
// On ne doit dessiner qu'un morceau du pixel
|
// On ne doit dessiner qu'un morceau du pixel
|
||||||
// sinon on dépasse sur le menu
|
// sinon on dépasse sur le menu
|
||||||
height = Menu_Y - y_zoom;
|
height = Menu_Y - y_zoom;
|
||||||
else
|
else
|
||||||
height = Main_magnifier_factor;
|
height = Main.magnifier_factor;
|
||||||
|
|
||||||
Block_wide2(
|
Block_wide2(
|
||||||
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
|
Main.magnifier_factor * (x-Main.magnifier_offset_X) + Main.X_zoom,
|
||||||
y_zoom, Main_magnifier_factor, height, color
|
y_zoom, Main.magnifier_factor, height, color
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ void Display_brush_mono_wide2(word x_pos, word y_pos,
|
|||||||
void Clear_brush_wide2(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
void Clear_brush_wide2(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word image_width)
|
||||||
{
|
{
|
||||||
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
byte* dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH; //On va se mettre en 0,0 dans l'écran (dest)
|
||||||
byte* src = ( y_pos + Main_offset_Y ) * image_width + x_pos + Main_offset_X + Main_screen; //Coords de départ ds la source (src)
|
byte* src = ( y_pos + Main.offset_Y ) * image_width + x_pos + Main.offset_X + Main_screen; //Coords de départ ds la source (src)
|
||||||
int y;
|
int y;
|
||||||
int x;
|
int x;
|
||||||
(void)x_offset; // unused
|
(void)x_offset; // unused
|
||||||
@ -352,8 +352,8 @@ void Display_part_of_screen_scaled_wide2(
|
|||||||
word height, // height zoomée
|
word height, // height zoomée
|
||||||
word image_width,byte * buffer)
|
word image_width,byte * buffer)
|
||||||
{
|
{
|
||||||
byte* src = Main_screen + Main_magnifier_offset_Y * image_width
|
byte* src = Main_screen + Main.magnifier_offset_Y * image_width
|
||||||
+ Main_magnifier_offset_X;
|
+ Main.magnifier_offset_X;
|
||||||
int y = 0; // Ligne en cours de traitement
|
int y = 0; // Ligne en cours de traitement
|
||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
@ -362,24 +362,24 @@ void Display_part_of_screen_scaled_wide2(
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
// On l'affiche Facteur fois, sur des lignes consécutives
|
// On l'affiche Facteur fois, sur des lignes consécutives
|
||||||
x = Main_magnifier_factor/**ZOOMY*/;
|
x = Main.magnifier_factor/**ZOOMY*/;
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_line_on_screen_fast_wide2(
|
Display_line_on_screen_fast_wide2(
|
||||||
Main_X_zoom, y, width*Main_magnifier_factor,
|
Main.X_zoom, y, width*Main.magnifier_factor,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
// On passe à la suivante
|
// On passe à la suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==height/**ZOOMY*/)
|
if(y==height/**ZOOMY*/)
|
||||||
{
|
{
|
||||||
Redraw_grid(Main_X_zoom,0,
|
Redraw_grid(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
Update_rect(Main_X_zoom,0,
|
Update_rect(Main.X_zoom,0,
|
||||||
width*Main_magnifier_factor,height);
|
width*Main.magnifier_factor,height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
@ -404,15 +404,15 @@ void Display_brush_color_zoom_wide2(word x_pos,word y_pos,
|
|||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
// On affiche facteur fois la ligne zoomée
|
// On affiche facteur fois la ligne zoomée
|
||||||
for(bx=Main_magnifier_factor;bx>0;bx--)
|
for(bx=Main.magnifier_factor;bx>0;bx--)
|
||||||
{
|
{
|
||||||
byte* line_src = buffer;
|
byte* line_src = buffer;
|
||||||
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
|
||||||
word x;
|
word x;
|
||||||
// Pour chaque pixel de la ligne
|
// Pour chaque pixel de la ligne
|
||||||
for(x = width*Main_magnifier_factor;x > 0;x--)
|
for(x = width*Main.magnifier_factor;x > 0;x--)
|
||||||
{
|
{
|
||||||
if(*line_src!=transp_color)
|
if(*line_src!=transp_color)
|
||||||
{
|
{
|
||||||
@ -422,7 +422,7 @@ void Display_brush_color_zoom_wide2(word x_pos,word y_pos,
|
|||||||
dest+=ZOOMX;
|
dest+=ZOOMX;
|
||||||
}
|
}
|
||||||
// Double the line
|
// Double the line
|
||||||
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main_magnifier_factor);
|
memcpy(Screen_pixels + (y*ZOOMY+1)*VIDEO_LINE_WIDTH + x_pos*ZOOMX, Screen_pixels + y*ZOOMY*VIDEO_LINE_WIDTH + x_pos*ZOOMX, width*ZOOMX*Main.magnifier_factor);
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
@ -453,18 +453,18 @@ void Display_brush_mono_zoom_wide2(word x_pos, word y_pos,
|
|||||||
int bx;
|
int bx;
|
||||||
// src = Ligne originale
|
// src = Ligne originale
|
||||||
// On éclate la ligne
|
// On éclate la ligne
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor,width);
|
||||||
|
|
||||||
// On affiche la ligne Facteur fois à l'écran (sur des
|
// On affiche la ligne Facteur fois à l'écran (sur des
|
||||||
// lignes consécutives)
|
// lignes consécutives)
|
||||||
bx = Main_magnifier_factor*ZOOMY;
|
bx = Main.magnifier_factor*ZOOMY;
|
||||||
|
|
||||||
// Pour chaque ligne écran
|
// Pour chaque ligne écran
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On affiche la ligne zoomée
|
// On affiche la ligne zoomée
|
||||||
Display_transparent_mono_line_on_screen_wide2(
|
Display_transparent_mono_line_on_screen_wide2(
|
||||||
x_pos, y, width * Main_magnifier_factor,
|
x_pos, y, width * Main.magnifier_factor,
|
||||||
buffer, transp_color, color
|
buffer, transp_color, color
|
||||||
);
|
);
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
@ -473,9 +473,9 @@ void Display_brush_mono_zoom_wide2(word x_pos, word y_pos,
|
|||||||
if(y == end_y_pos*ZOOMY)
|
if(y == end_y_pos*ZOOMY)
|
||||||
{
|
{
|
||||||
Redraw_grid( x_pos, y_pos,
|
Redraw_grid( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
Update_rect( x_pos, y_pos,
|
Update_rect( x_pos, y_pos,
|
||||||
width * Main_magnifier_factor, end_y_pos - y_pos );
|
width * Main.magnifier_factor, end_y_pos - y_pos );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx --;
|
bx --;
|
||||||
@ -498,24 +498,24 @@ void Clear_brush_scaled_wide2(word x_pos,word y_pos,word x_offset,word y_offset,
|
|||||||
|
|
||||||
// Pour chaque ligne à zoomer
|
// Pour chaque ligne à zoomer
|
||||||
while(1){
|
while(1){
|
||||||
Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
|
Zoom_a_line(src,buffer,Main.magnifier_factor*ZOOMX,width);
|
||||||
|
|
||||||
bx=Main_magnifier_factor;
|
bx=Main.magnifier_factor;
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
do{
|
do{
|
||||||
// TODO a verifier
|
// TODO a verifier
|
||||||
Display_line_on_screen_fast_wide2(x_pos,y,
|
Display_line_on_screen_fast_wide2(x_pos,y,
|
||||||
width * Main_magnifier_factor,buffer);
|
width * Main.magnifier_factor,buffer);
|
||||||
|
|
||||||
// Ligne suivante
|
// Ligne suivante
|
||||||
y++;
|
y++;
|
||||||
if(y==end_y_pos)
|
if(y==end_y_pos)
|
||||||
{
|
{
|
||||||
Redraw_grid(x_pos,y_pos,
|
Redraw_grid(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
Update_rect(x_pos,y_pos,
|
Update_rect(x_pos,y_pos,
|
||||||
width*Main_magnifier_factor,end_y_pos-y_pos);
|
width*Main.magnifier_factor,end_y_pos-y_pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bx--;
|
bx--;
|
||||||
|
|||||||
@ -259,9 +259,9 @@ byte * Surface_to_bytefield(SDL_Surface *source, byte * dest)
|
|||||||
SDL_Color Color_to_SDL_color(byte index)
|
SDL_Color Color_to_SDL_color(byte index)
|
||||||
{
|
{
|
||||||
SDL_Color color;
|
SDL_Color color;
|
||||||
color.r = Main_palette[index].R;
|
color.r = Main.palette[index].R;
|
||||||
color.g = Main_palette[index].G;
|
color.g = Main.palette[index].G;
|
||||||
color.b = Main_palette[index].B;
|
color.b = Main.palette[index].B;
|
||||||
color.unused = 255;
|
color.unused = 255;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -301,24 +301,24 @@ void Scroll_screen(short delta_x,short delta_y)
|
|||||||
short temp_x_offset;
|
short temp_x_offset;
|
||||||
short temp_y_offset;
|
short temp_y_offset;
|
||||||
|
|
||||||
temp_x_offset=Main_offset_X+delta_x;
|
temp_x_offset=Main.offset_X+delta_x;
|
||||||
temp_y_offset=Main_offset_Y+delta_y;
|
temp_y_offset=Main.offset_Y+delta_y;
|
||||||
|
|
||||||
if (temp_x_offset+Screen_width>Main_image_width)
|
if (temp_x_offset+Screen_width>Main.image_width)
|
||||||
temp_x_offset=Main_image_width-Screen_width;
|
temp_x_offset=Main.image_width-Screen_width;
|
||||||
if (temp_y_offset+Menu_Y>Main_image_height)
|
if (temp_y_offset+Menu_Y>Main.image_height)
|
||||||
temp_y_offset=Main_image_height-Menu_Y;
|
temp_y_offset=Main.image_height-Menu_Y;
|
||||||
if (temp_x_offset<0)
|
if (temp_x_offset<0)
|
||||||
temp_x_offset=0;
|
temp_x_offset=0;
|
||||||
if (temp_y_offset<0)
|
if (temp_y_offset<0)
|
||||||
temp_y_offset=0;
|
temp_y_offset=0;
|
||||||
|
|
||||||
if ( (Main_offset_X!=temp_x_offset) ||
|
if ( (Main.offset_X!=temp_x_offset) ||
|
||||||
(Main_offset_Y!=temp_y_offset) )
|
(Main.offset_Y!=temp_y_offset) )
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Main_offset_X=temp_x_offset;
|
Main.offset_X=temp_x_offset;
|
||||||
Main_offset_Y=temp_y_offset;
|
Main.offset_Y=temp_y_offset;
|
||||||
|
|
||||||
Compute_limits();
|
Compute_limits();
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
@ -335,17 +335,17 @@ void Scroll_magnifier(short delta_x,short delta_y)
|
|||||||
short temp_x_offset;
|
short temp_x_offset;
|
||||||
short temp_y_offset;
|
short temp_y_offset;
|
||||||
|
|
||||||
temp_x_offset=Main_magnifier_offset_X+delta_x;
|
temp_x_offset=Main.magnifier_offset_X+delta_x;
|
||||||
temp_y_offset=Main_magnifier_offset_Y+delta_y;
|
temp_y_offset=Main.magnifier_offset_Y+delta_y;
|
||||||
|
|
||||||
Clip_magnifier_offsets(&temp_x_offset, &temp_y_offset);
|
Clip_magnifier_offsets(&temp_x_offset, &temp_y_offset);
|
||||||
|
|
||||||
if ( (Main_magnifier_offset_X!=temp_x_offset) ||
|
if ( (Main.magnifier_offset_X!=temp_x_offset) ||
|
||||||
(Main_magnifier_offset_Y!=temp_y_offset) )
|
(Main.magnifier_offset_Y!=temp_y_offset) )
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Main_magnifier_offset_X=temp_x_offset;
|
Main.magnifier_offset_X=temp_x_offset;
|
||||||
Main_magnifier_offset_Y=temp_y_offset;
|
Main.magnifier_offset_Y=temp_y_offset;
|
||||||
|
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
|
|
||||||
@ -362,14 +362,14 @@ void Scroll_magnifier(short delta_x,short delta_y)
|
|||||||
void Zoom(short delta)
|
void Zoom(short delta)
|
||||||
{
|
{
|
||||||
short index;
|
short index;
|
||||||
for (index=0; ZOOM_FACTOR[index]!=Main_magnifier_factor; index++);
|
for (index=0; ZOOM_FACTOR[index]!=Main.magnifier_factor; index++);
|
||||||
index+=delta;
|
index+=delta;
|
||||||
|
|
||||||
if ( (index>=0) && (index<NB_ZOOM_FACTORS) )
|
if ( (index>=0) && (index<NB_ZOOM_FACTORS) )
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Change_magnifier_factor(index,1);
|
Change_magnifier_factor(index,1);
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
@ -384,13 +384,13 @@ void Zoom_set(int index)
|
|||||||
if (index<0)
|
if (index<0)
|
||||||
{
|
{
|
||||||
/* Zoom 1:1 */
|
/* Zoom 1:1 */
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
Unselect_button(BUTTON_MAGNIFIER);
|
Unselect_button(BUTTON_MAGNIFIER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Change_magnifier_factor(index,1);
|
Change_magnifier_factor(index,1);
|
||||||
if (!Main_magnifier_mode)
|
if (!Main.magnifier_mode)
|
||||||
Select_button(BUTTON_MAGNIFIER,1);
|
Select_button(BUTTON_MAGNIFIER,1);
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
|
|||||||
59
src/struct.h
59
src/struct.h
@ -549,4 +549,63 @@ typedef struct T_Selector_settings
|
|||||||
char Directory[MAX_PATH_CHARACTERS]; ///< Directory currently browsed
|
char Directory[MAX_PATH_CHARACTERS]; ///< Directory currently browsed
|
||||||
} T_Selector_settings;
|
} T_Selector_settings;
|
||||||
|
|
||||||
|
// structure for Main or Spare page global data
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/// Palette
|
||||||
|
T_Palette palette;
|
||||||
|
/// Boolean, means the page has been modified since last save.
|
||||||
|
byte image_is_modified;
|
||||||
|
/// Width in pixels of the image.
|
||||||
|
short image_width;
|
||||||
|
/// Height in pixels of the image.
|
||||||
|
short image_height;
|
||||||
|
/// X position (in image space) of the pixel to display in the top left corner of screen.
|
||||||
|
short offset_X;
|
||||||
|
/// Y position (in image space) of the pixel to display in the top left corner of screen.
|
||||||
|
short offset_Y;
|
||||||
|
/// Name of the directory that holds the image currently edited as page.
|
||||||
|
char file_directory[MAX_PATH_CHARACTERS];
|
||||||
|
/// Filename (without directory) of the image currently edited as page.
|
||||||
|
char filename[MAX_PATH_CHARACTERS];
|
||||||
|
/// File format of the image currently edited as page. It's a value of enum ::FILE_FORMATS
|
||||||
|
byte fileformat;
|
||||||
|
/// File selector settings
|
||||||
|
T_Selector_settings selector;
|
||||||
|
/// X position (in screen coordinates) of the separator between normal and magnified views.
|
||||||
|
short separator_position;
|
||||||
|
/// X position (in screen coordinates) of the first pixel of the magnified view.
|
||||||
|
short X_zoom;
|
||||||
|
/// Proportion of the non-magnified part of the screen.
|
||||||
|
float separator_proportion;
|
||||||
|
/// Boolean, true if the main image has the magnifier active.
|
||||||
|
byte magnifier_mode;
|
||||||
|
/// Zoom factor used in the magnifier.
|
||||||
|
word magnifier_factor;
|
||||||
|
/// Width of the magnified view for the page.
|
||||||
|
word magnifier_height;
|
||||||
|
/// Height of the magnified view for the page.
|
||||||
|
word magnifier_width;
|
||||||
|
/// X position (in image space) of the pixel to display in the top left corner of the magnified view.
|
||||||
|
short magnifier_offset_X;
|
||||||
|
/// Y position (in image space) of the pixel to display in the top left corner of the magnified view.
|
||||||
|
short magnifier_offset_Y;
|
||||||
|
/// Index of layer currently being edited
|
||||||
|
int current_layer;
|
||||||
|
/// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc.
|
||||||
|
dword layers_visible;
|
||||||
|
/// Backup for layers_visible
|
||||||
|
dword layers_visible_backup;
|
||||||
|
/// Index to use next time, when creating incremental backups, to make unique filename.
|
||||||
|
long safety_number;
|
||||||
|
/// Number of edit actions since the last safety backup
|
||||||
|
long edits_since_safety_backup;
|
||||||
|
/// SDL Time of the previous safety backup
|
||||||
|
dword time_of_safety_backup;
|
||||||
|
/// Letter prefix for the filenames of safety backups. a or b
|
||||||
|
byte safety_backup_prefix;
|
||||||
|
/// Tilemap mode
|
||||||
|
byte tilemap_mode;
|
||||||
|
} T_Document;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
10
src/text.c
10
src/text.c
@ -480,9 +480,9 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
|||||||
|
|
||||||
// Also, make the BG color in brush palette have same RGB values as
|
// Also, make the BG color in brush palette have same RGB values as
|
||||||
// the current BG color : this will help for remaps.
|
// the current BG color : this will help for remaps.
|
||||||
palette[Back_color].R=Main_palette[Back_color].R;
|
palette[Back_color].R=Main.palette[Back_color].R;
|
||||||
palette[Back_color].G=Main_palette[Back_color].G;
|
palette[Back_color].G=Main.palette[Back_color].G;
|
||||||
palette[Back_color].B=Main_palette[Back_color].B;
|
palette[Back_color].B=Main.palette[Back_color].B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -495,7 +495,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
|||||||
|
|
||||||
if (Fore_color==Back_color)
|
if (Fore_color==Back_color)
|
||||||
{
|
{
|
||||||
new_fore=Best_color_perceptual_except(Main_palette[Back_color].R, Main_palette[Back_color].G, Main_palette[Back_color].B, Back_color);
|
new_fore=Best_color_perceptual_except(Main.palette[Back_color].R, Main.palette[Back_color].G, Main.palette[Back_color].B, Back_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index=0; index < text_surface->w * text_surface->h; index++)
|
for (index=0; index < text_surface->w * text_surface->h; index++)
|
||||||
@ -508,7 +508,7 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
|||||||
|
|
||||||
// Now copy the current palette to brushe's, for consistency
|
// Now copy the current palette to brushe's, for consistency
|
||||||
// with the indices.
|
// with the indices.
|
||||||
memcpy(palette, Main_palette, sizeof(T_Palette));
|
memcpy(palette, Main.palette, sizeof(T_Palette));
|
||||||
|
|
||||||
}
|
}
|
||||||
*width=text_surface->w;
|
*width=text_surface->w;
|
||||||
|
|||||||
37
src/tiles.c
37
src/tiles.c
@ -118,12 +118,12 @@ int Tile_is_same(int t1, int t2)
|
|||||||
byte *bmp1,*bmp2;
|
byte *bmp1,*bmp2;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
bmp1 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t1))*Main_image_width+(TILE_X(t1));
|
bmp1 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t1))*Main.image_width+(TILE_X(t1));
|
||||||
bmp2 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t2))*Main_image_width+(TILE_X(t2));
|
bmp2 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t2))*Main.image_width+(TILE_X(t2));
|
||||||
|
|
||||||
for (y=0; y < Snap_height; y++)
|
for (y=0; y < Snap_height; y++)
|
||||||
{
|
{
|
||||||
if (memcmp(bmp1+y*Main_image_width, bmp2+y*Main_image_width, Snap_width))
|
if (memcmp(bmp1+y*Main.image_width, bmp2+y*Main.image_width, Snap_width))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -135,13 +135,13 @@ int Tile_is_same_flipped_x(int t1, int t2)
|
|||||||
byte *bmp1,*bmp2;
|
byte *bmp1,*bmp2;
|
||||||
int y, x;
|
int y, x;
|
||||||
|
|
||||||
bmp1 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t1))*Main_image_width+(TILE_X(t1));
|
bmp1 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t1))*Main.image_width+(TILE_X(t1));
|
||||||
bmp2 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t2))*Main_image_width+(TILE_X(t2)+Snap_width-1);
|
bmp2 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t2))*Main.image_width+(TILE_X(t2)+Snap_width-1);
|
||||||
|
|
||||||
for (y=0; y < Snap_height; y++)
|
for (y=0; y < Snap_height; y++)
|
||||||
{
|
{
|
||||||
for (x=0; x < Snap_width; x++)
|
for (x=0; x < Snap_width; x++)
|
||||||
if (*(bmp1+y*Main_image_width+x) != *(bmp2+y*Main_image_width-x))
|
if (*(bmp1+y*Main.image_width+x) != *(bmp2+y*Main.image_width-x))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -153,12 +153,12 @@ int Tile_is_same_flipped_y(int t1, int t2)
|
|||||||
byte *bmp1,*bmp2;
|
byte *bmp1,*bmp2;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
bmp1 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t1))*Main_image_width+(TILE_X(t1));
|
bmp1 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t1))*Main.image_width+(TILE_X(t1));
|
||||||
bmp2 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t2)+Snap_height-1)*Main_image_width+(TILE_X(t2));
|
bmp2 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t2)+Snap_height-1)*Main.image_width+(TILE_X(t2));
|
||||||
|
|
||||||
for (y=0; y < Snap_height; y++)
|
for (y=0; y < Snap_height; y++)
|
||||||
{
|
{
|
||||||
if (memcmp(bmp1+y*Main_image_width, bmp2-y*Main_image_width, Snap_width))
|
if (memcmp(bmp1+y*Main.image_width, bmp2-y*Main.image_width, Snap_width))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -171,13 +171,13 @@ int Tile_is_same_flipped_xy(int t1, int t2)
|
|||||||
byte *bmp1,*bmp2;
|
byte *bmp1,*bmp2;
|
||||||
int y, x;
|
int y, x;
|
||||||
|
|
||||||
bmp1 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t1))*Main_image_width+(TILE_X(t1));
|
bmp1 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t1))*Main.image_width+(TILE_X(t1));
|
||||||
bmp2 = Main_backups->Pages->Image[Main_current_layer].Pixels+(TILE_Y(t2)+Snap_height-1)*Main_image_width+(TILE_X(t2)+Snap_width-1);
|
bmp2 = Main_backups->Pages->Image[Main.current_layer].Pixels+(TILE_Y(t2)+Snap_height-1)*Main.image_width+(TILE_X(t2)+Snap_width-1);
|
||||||
|
|
||||||
for (y=0; y < Snap_height; y++)
|
for (y=0; y < Snap_height; y++)
|
||||||
{
|
{
|
||||||
for (x=0; x < Snap_width; x++)
|
for (x=0; x < Snap_width; x++)
|
||||||
if (*(bmp1+y*Main_image_width+x) != *(bmp2-y*Main_image_width-x))
|
if (*(bmp1+y*Main.image_width+x) != *(bmp2-y*Main.image_width-x))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -195,11 +195,11 @@ void Tilemap_update(void)
|
|||||||
int wait_window=0;
|
int wait_window=0;
|
||||||
byte old_cursor=0;
|
byte old_cursor=0;
|
||||||
|
|
||||||
if (!Main_tilemap_mode)
|
if (!Main.tilemap_mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
width=(Main_image_width-Snap_offset_X)/Snap_width;
|
width=(Main.image_width-Snap_offset_X)/Snap_width;
|
||||||
height=(Main_image_height-Snap_offset_Y)/Snap_height;
|
height=(Main.image_height-Snap_offset_Y)/Snap_height;
|
||||||
|
|
||||||
if (width<1 || height<1 || width*height>1000000l
|
if (width<1 || height<1 || width*height>1000000l
|
||||||
|| (tile_ptr=(T_Tile *)malloc(width*height*sizeof(T_Tile))) == NULL)
|
|| (tile_ptr=(T_Tile *)malloc(width*height*sizeof(T_Tile))) == NULL)
|
||||||
@ -382,7 +382,8 @@ void Tilemap_update(void)
|
|||||||
/// be called when swapping pages.
|
/// be called when swapping pages.
|
||||||
void Swap_tilemap(void)
|
void Swap_tilemap(void)
|
||||||
{
|
{
|
||||||
SWAP_BYTES(Main_tilemap_mode, Spare_tilemap_mode)
|
//TODO
|
||||||
|
SWAP_BYTES(Main.tilemap_mode, Spare.tilemap_mode)
|
||||||
{
|
{
|
||||||
T_Tile * a;
|
T_Tile * a;
|
||||||
a=Main_tilemap;
|
a=Main_tilemap;
|
||||||
@ -406,7 +407,7 @@ void Disable_main_tilemap(void)
|
|||||||
}
|
}
|
||||||
Main_tilemap_width=0;
|
Main_tilemap_width=0;
|
||||||
Main_tilemap_height=0;
|
Main_tilemap_height=0;
|
||||||
Main_tilemap_mode=0;
|
Main.tilemap_mode=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -422,5 +423,5 @@ void Disable_spare_tilemap(void)
|
|||||||
}
|
}
|
||||||
Spare_tilemap_width=0;
|
Spare_tilemap_width=0;
|
||||||
Spare_tilemap_height=0;
|
Spare_tilemap_height=0;
|
||||||
Spare_tilemap_mode=0;
|
Spare.tilemap_mode=0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,8 +92,8 @@ void Button_Transform_menu(void)
|
|||||||
short old_ratio_height;
|
short old_ratio_height;
|
||||||
short new_ratio_width;
|
short new_ratio_width;
|
||||||
short new_ratio_height;
|
short new_ratio_height;
|
||||||
short new_width=Main_image_width;
|
short new_width=Main.image_width;
|
||||||
short new_height=Main_image_height;
|
short new_height=Main.image_height;
|
||||||
byte need_display_size = 0;
|
byte need_display_size = 0;
|
||||||
|
|
||||||
// Persistent data
|
// Persistent data
|
||||||
@ -162,9 +162,9 @@ void Button_Transform_menu(void)
|
|||||||
case UNIT_PIXELS:
|
case UNIT_PIXELS:
|
||||||
default:
|
default:
|
||||||
input_value[0]=&new_width;
|
input_value[0]=&new_width;
|
||||||
input_value[1]=&Main_image_width; // Don't worry, it's read-only
|
input_value[1]=&Main.image_width; // Don't worry, it's read-only
|
||||||
input_value[2]=&new_height;
|
input_value[2]=&new_height;
|
||||||
input_value[3]=&Main_image_height; // Don't worry, it's read-only
|
input_value[3]=&Main.image_height; // Don't worry, it's read-only
|
||||||
break;
|
break;
|
||||||
case UNIT_PERCENT:
|
case UNIT_PERCENT:
|
||||||
case UNIT_RATIO:
|
case UNIT_RATIO:
|
||||||
@ -220,14 +220,14 @@ void Button_Transform_menu(void)
|
|||||||
old_ratio_width = 100;
|
old_ratio_width = 100;
|
||||||
old_ratio_height = 100;
|
old_ratio_height = 100;
|
||||||
// Update pixel dimensions, to match percentage exactly
|
// Update pixel dimensions, to match percentage exactly
|
||||||
new_width=Compute_dimension(Main_image_width, new_ratio_width, old_ratio_width);
|
new_width=Compute_dimension(Main.image_width, new_ratio_width, old_ratio_width);
|
||||||
new_height=Compute_dimension(Main_image_height, new_ratio_height, old_ratio_height);
|
new_height=Compute_dimension(Main.image_height, new_ratio_height, old_ratio_height);
|
||||||
}
|
}
|
||||||
else // unit_index == UNIT_PIXELS
|
else // unit_index == UNIT_PIXELS
|
||||||
{
|
{
|
||||||
// Approximate from current pixel size
|
// Approximate from current pixel size
|
||||||
new_ratio_width = new_width*100/Main_image_width;
|
new_ratio_width = new_width*100/Main.image_width;
|
||||||
new_ratio_height = new_height*100/Main_image_height;
|
new_ratio_height = new_height*100/Main.image_height;
|
||||||
old_ratio_width = 100;
|
old_ratio_width = 100;
|
||||||
old_ratio_height = 100;
|
old_ratio_height = 100;
|
||||||
}
|
}
|
||||||
@ -244,8 +244,8 @@ void Button_Transform_menu(void)
|
|||||||
// Compute simplest ratio from current pixel size
|
// Compute simplest ratio from current pixel size
|
||||||
new_ratio_width = new_width;
|
new_ratio_width = new_width;
|
||||||
new_ratio_height = new_height;
|
new_ratio_height = new_height;
|
||||||
old_ratio_width = Main_image_width;
|
old_ratio_width = Main.image_width;
|
||||||
old_ratio_height = Main_image_height;
|
old_ratio_height = Main.image_height;
|
||||||
Factorize(&new_ratio_width, &old_ratio_width);
|
Factorize(&new_ratio_width, &old_ratio_width);
|
||||||
Factorize(&new_ratio_height, &old_ratio_height);
|
Factorize(&new_ratio_height, &old_ratio_height);
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ void Button_Transform_menu(void)
|
|||||||
// Get Y value because X changed
|
// Get Y value because X changed
|
||||||
if (unit_index == UNIT_PIXELS)
|
if (unit_index == UNIT_PIXELS)
|
||||||
{
|
{
|
||||||
new_height=Compute_dimension(Main_image_height, new_width, Main_image_width);
|
new_height=Compute_dimension(Main.image_height, new_width, Main.image_width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -306,7 +306,7 @@ void Button_Transform_menu(void)
|
|||||||
// Get X value because Y changed
|
// Get X value because Y changed
|
||||||
if (unit_index == UNIT_PIXELS)
|
if (unit_index == UNIT_PIXELS)
|
||||||
{
|
{
|
||||||
new_width=Compute_dimension(Main_image_width, new_height, Main_image_height);
|
new_width=Compute_dimension(Main.image_width, new_height, Main.image_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -320,13 +320,13 @@ void Button_Transform_menu(void)
|
|||||||
// Re-compute ratio from size in pixels
|
// Re-compute ratio from size in pixels
|
||||||
if (unit_index == UNIT_PIXELS)
|
if (unit_index == UNIT_PIXELS)
|
||||||
{
|
{
|
||||||
//new_width=(long)Main_image_width*new_ratio_width/old_ratio_width;
|
//new_width=(long)Main.image_width*new_ratio_width/old_ratio_width;
|
||||||
//new_height=(long)Main_image_height*new_ratio_height/old_ratio_height;
|
//new_height=(long)Main.image_height*new_ratio_height/old_ratio_height;
|
||||||
}
|
}
|
||||||
else // Re-compute size in pixels from ratio
|
else // Re-compute size in pixels from ratio
|
||||||
{
|
{
|
||||||
new_width=Compute_dimension(Main_image_width,new_ratio_width,old_ratio_width);
|
new_width=Compute_dimension(Main.image_width,new_ratio_width,old_ratio_width);
|
||||||
new_height=Compute_dimension(Main_image_height,new_ratio_height,old_ratio_height);
|
new_height=Compute_dimension(Main.image_height,new_ratio_height,old_ratio_height);
|
||||||
}
|
}
|
||||||
need_display_size=1;
|
need_display_size=1;
|
||||||
}
|
}
|
||||||
@ -356,20 +356,20 @@ void Button_Transform_menu(void)
|
|||||||
case 2 : // Flip X
|
case 2 : // Flip X
|
||||||
case 3 : // Flip Y
|
case 3 : // Flip Y
|
||||||
case 6 : // 180° Rotation
|
case 6 : // 180° Rotation
|
||||||
new_width=Main_image_width;
|
new_width=Main.image_width;
|
||||||
new_height=Main_image_height;
|
new_height=Main.image_height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4 : // -90° Rotation
|
case 4 : // -90° Rotation
|
||||||
case 5 : // +90° Rotation
|
case 5 : // +90° Rotation
|
||||||
|
|
||||||
new_width=Main_image_height;
|
new_width=Main.image_height;
|
||||||
new_height=Main_image_width;
|
new_height=Main.image_width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Memorize the current dimensions
|
// Memorize the current dimensions
|
||||||
old_width=Main_image_width;
|
old_width=Main.image_width;
|
||||||
old_height=Main_image_height;
|
old_height=Main.image_height;
|
||||||
|
|
||||||
Upload_infos_page_main(Main_backups->Pages);
|
Upload_infos_page_main(Main_backups->Pages);
|
||||||
// Allocate a new page
|
// Allocate a new page
|
||||||
@ -377,7 +377,7 @@ void Button_Transform_menu(void)
|
|||||||
{
|
{
|
||||||
// The new image is allocated, the new dimensions are already updated.
|
// The new image is allocated, the new dimensions are already updated.
|
||||||
|
|
||||||
Main_image_is_modified=1;
|
Main.image_is_modified=1;
|
||||||
|
|
||||||
// Process the transformation:
|
// Process the transformation:
|
||||||
switch(clicked_button)
|
switch(clicked_button)
|
||||||
@ -387,15 +387,15 @@ void Button_Transform_menu(void)
|
|||||||
case 2 : // Flip X
|
case 2 : // Flip X
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main_image_width*Main_image_height);
|
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main.image_width*Main.image_height);
|
||||||
Flip_X_lowlevel(Main_backups->Pages->Image[i].Pixels, Main_image_width, Main_image_height);
|
Flip_X_lowlevel(Main_backups->Pages->Image[i].Pixels, Main.image_width, Main.image_height);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3 : // Flip Y
|
case 3 : // Flip Y
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main_image_width*Main_image_height);
|
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main.image_width*Main.image_height);
|
||||||
Flip_Y_lowlevel(Main_backups->Pages->Image[i].Pixels, Main_image_width, Main_image_height);
|
Flip_Y_lowlevel(Main_backups->Pages->Image[i].Pixels, Main.image_width, Main.image_height);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4 : // -90° Rotation
|
case 4 : // -90° Rotation
|
||||||
@ -413,14 +413,14 @@ void Button_Transform_menu(void)
|
|||||||
case 6 : // 180° Rotation
|
case 6 : // 180° Rotation
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main_image_width*Main_image_height);
|
memcpy(Main_backups->Pages->Image[i].Pixels,Main_backups->Pages->Next->Image[i].Pixels,Main.image_width*Main.image_height);
|
||||||
Rotate_180_deg_lowlevel(Main_backups->Pages->Image[i].Pixels, Main_image_width, Main_image_height);
|
Rotate_180_deg_lowlevel(Main_backups->Pages->Image[i].Pixels, Main.image_width, Main.image_height);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7 : // Resize
|
case 7 : // Resize
|
||||||
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
|
||||||
{
|
{
|
||||||
Rescale(Main_backups->Pages->Next->Image[i].Pixels, old_width, old_height, Main_backups->Pages->Image[i].Pixels, Main_image_width, Main_image_height, 0, 0);
|
Rescale(Main_backups->Pages->Next->Image[i].Pixels, old_width, old_height, Main_backups->Pages->Image[i].Pixels, Main.image_width, Main.image_height, 0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -428,9 +428,9 @@ void Button_Transform_menu(void)
|
|||||||
for (i=0; i<NB_LAYERS; i++)
|
for (i=0; i<NB_LAYERS; i++)
|
||||||
{
|
{
|
||||||
Copy_part_of_image_to_another(
|
Copy_part_of_image_to_another(
|
||||||
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Main_image_width),
|
Main_backups->Pages->Next->Image[i].Pixels,0,0,Min(old_width,Main.image_width),
|
||||||
Min(old_height,Main_image_height),old_width,
|
Min(old_height,Main.image_height),old_width,
|
||||||
Main_backups->Pages->Image[i].Pixels,0,0,Main_image_width);
|
Main_backups->Pages->Image[i].Pixels,0,0,Main.image_width);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
|
|||||||
508
src/windows.c
508
src/windows.c
@ -534,9 +534,9 @@ void Display_layerbar(void)
|
|||||||
word y_pos;
|
word y_pos;
|
||||||
word sprite_index;
|
word sprite_index;
|
||||||
|
|
||||||
if (Main_current_layer == current_button)
|
if (Main.current_layer == current_button)
|
||||||
sprite_index=1;
|
sprite_index=1;
|
||||||
else if (Main_layers_visible & (1 << current_button))
|
else if (Main.layers_visible & (1 << current_button))
|
||||||
sprite_index=0;
|
sprite_index=0;
|
||||||
else
|
else
|
||||||
sprite_index=2;
|
sprite_index=2;
|
||||||
@ -592,7 +592,7 @@ void Display_layerbar(void)
|
|||||||
// Frame# background rectangle
|
// Frame# background rectangle
|
||||||
// Block((Menu_bars[MENUBAR_ANIMATION].Skin_width)*Menu_factor_X,(0+Menu_bars[MENUBAR_ANIMATION].Top)*Menu_factor_Y+Menu_Y,8*8*Menu_factor_X,8*Menu_factor_Y,MC_Light);
|
// Block((Menu_bars[MENUBAR_ANIMATION].Skin_width)*Menu_factor_X,(0+Menu_bars[MENUBAR_ANIMATION].Top)*Menu_factor_Y+Menu_Y,8*8*Menu_factor_X,8*Menu_factor_Y,MC_Light);
|
||||||
// Frame #/#
|
// Frame #/#
|
||||||
snprintf(str, 8, "%3d/%3d", Main_current_layer+1, Main_backups->Pages->Nb_layers);
|
snprintf(str, 8, "%3d/%3d", Main.current_layer+1, Main_backups->Pages->Nb_layers);
|
||||||
Print_general((59)*Menu_factor_X,(Menu_bars[MENUBAR_ANIMATION].Top+3)*Menu_factor_Y+Menu_Y,str,MC_Black,MC_Light);
|
Print_general((59)*Menu_factor_X,(Menu_bars[MENUBAR_ANIMATION].Top+3)*Menu_factor_Y+Menu_Y,str,MC_Black,MC_Light);
|
||||||
Update_rect(
|
Update_rect(
|
||||||
(59)*Menu_factor_X,
|
(59)*Menu_factor_X,
|
||||||
@ -650,7 +650,7 @@ void Display_menu(void)
|
|||||||
if (!Windows_open)
|
if (!Windows_open)
|
||||||
{
|
{
|
||||||
if ((Mouse_Y<Menu_Y) && // Mouse in the picture area
|
if ((Mouse_Y<Menu_Y) && // Mouse in the picture area
|
||||||
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ))
|
( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ))
|
||||||
{
|
{
|
||||||
// Prepare display of XY coordinates even if in some cases they will be
|
// Prepare display of XY coordinates even if in some cases they will be
|
||||||
// erased with some other text
|
// erased with some other text
|
||||||
@ -768,8 +768,8 @@ void Print_coordinates(void)
|
|||||||
|| (Current_operation==OPERATION_REPLACE) )
|
|| (Current_operation==OPERATION_REPLACE) )
|
||||||
{
|
{
|
||||||
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
|
||||||
&& (Paintbrush_X<Main_image_width)
|
&& (Paintbrush_X<Main.image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height) )
|
&& (Paintbrush_Y<Main.image_height) )
|
||||||
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
||||||
else
|
else
|
||||||
Colorpicker_color=0;
|
Colorpicker_color=0;
|
||||||
@ -1492,55 +1492,55 @@ void Compute_limits(void)
|
|||||||
Avant l'appel à cette fonction, les données de la loupe doivent être à jour.
|
Avant l'appel à cette fonction, les données de la loupe doivent être à jour.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// -- Calcul des limites de la partie non zoomée de l'image --
|
// -- Calcul des limites de la partie non zoomée de l'image --
|
||||||
Limit_top =Main_offset_Y;
|
Limit_top =Main.offset_Y;
|
||||||
Limit_left=Main_offset_X;
|
Limit_left=Main.offset_X;
|
||||||
Limit_visible_bottom =Limit_top+Menu_Y-1;
|
Limit_visible_bottom =Limit_top+Menu_Y-1;
|
||||||
Limit_visible_right=Limit_left+Main_separator_position-1;
|
Limit_visible_right=Limit_left+Main.separator_position-1;
|
||||||
|
|
||||||
if (Limit_visible_bottom>=Main_image_height)
|
if (Limit_visible_bottom>=Main.image_height)
|
||||||
Limit_bottom=Main_image_height-1;
|
Limit_bottom=Main.image_height-1;
|
||||||
else
|
else
|
||||||
Limit_bottom=Limit_visible_bottom;
|
Limit_bottom=Limit_visible_bottom;
|
||||||
|
|
||||||
if (Limit_visible_right>=Main_image_width)
|
if (Limit_visible_right>=Main.image_width)
|
||||||
Limit_right=Main_image_width-1;
|
Limit_right=Main.image_width-1;
|
||||||
else
|
else
|
||||||
Limit_right=Limit_visible_right;
|
Limit_right=Limit_visible_right;
|
||||||
|
|
||||||
// -- Calcul des limites de la partie zoomée de l'image --
|
// -- Calcul des limites de la partie zoomée de l'image --
|
||||||
Limit_top_zoom =Main_magnifier_offset_Y;
|
Limit_top_zoom =Main.magnifier_offset_Y;
|
||||||
Limit_left_zoom=Main_magnifier_offset_X;
|
Limit_left_zoom=Main.magnifier_offset_X;
|
||||||
Limit_visible_bottom_zoom =Limit_top_zoom+Main_magnifier_height-1;
|
Limit_visible_bottom_zoom =Limit_top_zoom+Main.magnifier_height-1;
|
||||||
Limit_visible_right_zoom=Limit_left_zoom+Main_magnifier_width-1;
|
Limit_visible_right_zoom=Limit_left_zoom+Main.magnifier_width-1;
|
||||||
|
|
||||||
if (Limit_visible_bottom_zoom>=Main_image_height)
|
if (Limit_visible_bottom_zoom>=Main.image_height)
|
||||||
Limit_bottom_zoom=Main_image_height-1;
|
Limit_bottom_zoom=Main.image_height-1;
|
||||||
else
|
else
|
||||||
Limit_bottom_zoom=Limit_visible_bottom_zoom;
|
Limit_bottom_zoom=Limit_visible_bottom_zoom;
|
||||||
|
|
||||||
if (Limit_visible_right_zoom>=Main_image_width)
|
if (Limit_visible_right_zoom>=Main.image_width)
|
||||||
Limit_right_zoom=Main_image_width-1;
|
Limit_right_zoom=Main.image_width-1;
|
||||||
else
|
else
|
||||||
Limit_right_zoom=Limit_visible_right_zoom;
|
Limit_right_zoom=Limit_visible_right_zoom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// -- Calcul des limites de la partie visible de l'image --
|
// -- Calcul des limites de la partie visible de l'image --
|
||||||
Limit_top =Main_offset_Y;
|
Limit_top =Main.offset_Y;
|
||||||
Limit_left=Main_offset_X;
|
Limit_left=Main.offset_X;
|
||||||
Limit_visible_bottom =Limit_top+(Menu_is_visible?Menu_Y:Screen_height)-1; // A REVOIR POUR SIMPLIFICATION
|
Limit_visible_bottom =Limit_top+(Menu_is_visible?Menu_Y:Screen_height)-1; // A REVOIR POUR SIMPLIFICATION
|
||||||
Limit_visible_right=Limit_left+Screen_width-1;
|
Limit_visible_right=Limit_left+Screen_width-1;
|
||||||
|
|
||||||
if (Limit_visible_bottom>=Main_image_height)
|
if (Limit_visible_bottom>=Main.image_height)
|
||||||
Limit_bottom=Main_image_height-1;
|
Limit_bottom=Main.image_height-1;
|
||||||
else
|
else
|
||||||
Limit_bottom=Limit_visible_bottom;
|
Limit_bottom=Limit_visible_bottom;
|
||||||
|
|
||||||
if (Limit_visible_right>=Main_image_width)
|
if (Limit_visible_right>=Main.image_width)
|
||||||
Limit_right=Main_image_width-1;
|
Limit_right=Main.image_width-1;
|
||||||
else
|
else
|
||||||
Limit_right=Limit_visible_right;
|
Limit_right=Limit_visible_right;
|
||||||
}
|
}
|
||||||
@ -1550,15 +1550,15 @@ void Compute_limits(void)
|
|||||||
// -- Calculer les coordonnées du pinceau en fonction du snap et de la loupe -
|
// -- Calculer les coordonnées du pinceau en fonction du snap et de la loupe -
|
||||||
void Compute_paintbrush_coordinates(void)
|
void Compute_paintbrush_coordinates(void)
|
||||||
{
|
{
|
||||||
if ((Main_magnifier_mode) && (Mouse_X>=Main_X_zoom))
|
if ((Main.magnifier_mode) && (Mouse_X>=Main.X_zoom))
|
||||||
{
|
{
|
||||||
Paintbrush_X=((Mouse_X-Main_X_zoom)/Main_magnifier_factor)+Main_magnifier_offset_X;
|
Paintbrush_X=((Mouse_X-Main.X_zoom)/Main.magnifier_factor)+Main.magnifier_offset_X;
|
||||||
Paintbrush_Y=(Mouse_Y/Main_magnifier_factor)+Main_magnifier_offset_Y;
|
Paintbrush_Y=(Mouse_Y/Main.magnifier_factor)+Main.magnifier_offset_Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Paintbrush_X=Mouse_X+Main_offset_X;
|
Paintbrush_X=Mouse_X+Main.offset_X;
|
||||||
Paintbrush_Y=Mouse_Y+Main_offset_Y;
|
Paintbrush_Y=Mouse_Y+Main.offset_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Snap_mode)
|
if (Snap_mode)
|
||||||
@ -1621,16 +1621,16 @@ void Display_image_limits(void)
|
|||||||
byte bottom_is_visible;
|
byte bottom_is_visible;
|
||||||
short old_zoom_limit;
|
short old_zoom_limit;
|
||||||
|
|
||||||
right_is_visible=Main_image_width<((Main_magnifier_mode)?Main_separator_position:Screen_width);
|
right_is_visible=Main.image_width<((Main.magnifier_mode)?Main.separator_position:Screen_width);
|
||||||
bottom_is_visible =Main_image_height<Menu_Y;
|
bottom_is_visible =Main.image_height<Menu_Y;
|
||||||
|
|
||||||
|
|
||||||
// On vérifie que la limite à droite est visible:
|
// On vérifie que la limite à droite est visible:
|
||||||
if (right_is_visible)
|
if (right_is_visible)
|
||||||
{
|
{
|
||||||
start=Limit_top;
|
start=Limit_top;
|
||||||
end=(Limit_bottom<Main_image_height)?
|
end=(Limit_bottom<Main.image_height)?
|
||||||
Limit_bottom:Main_image_height;
|
Limit_bottom:Main.image_height;
|
||||||
|
|
||||||
if (bottom_is_visible)
|
if (bottom_is_visible)
|
||||||
end++;
|
end++;
|
||||||
@ -1641,9 +1641,9 @@ void Display_image_limits(void)
|
|||||||
Limit_right_zoom=Limit_visible_right_zoom;
|
Limit_right_zoom=Limit_visible_right_zoom;
|
||||||
|
|
||||||
for (pos=start;pos<=end;pos++)
|
for (pos=start;pos<=end;pos++)
|
||||||
Pixel_preview(Main_image_width,pos,((pos+Main_image_height)&1)?MC_White:MC_Black);
|
Pixel_preview(Main.image_width,pos,((pos+Main.image_height)&1)?MC_White:MC_Black);
|
||||||
|
|
||||||
Update_rect(Main_image_width,start,1,end-start + 1);
|
Update_rect(Main.image_width,start,1,end-start + 1);
|
||||||
// On restaure la bonne valeur des limites
|
// On restaure la bonne valeur des limites
|
||||||
Limit_right_zoom=old_zoom_limit;
|
Limit_right_zoom=old_zoom_limit;
|
||||||
}
|
}
|
||||||
@ -1652,17 +1652,17 @@ void Display_image_limits(void)
|
|||||||
if (bottom_is_visible)
|
if (bottom_is_visible)
|
||||||
{
|
{
|
||||||
start=Limit_left;
|
start=Limit_left;
|
||||||
end=(Limit_right<Main_image_width)?
|
end=(Limit_right<Main.image_width)?
|
||||||
Limit_right:Main_image_width;
|
Limit_right:Main.image_width;
|
||||||
|
|
||||||
// On étend également les limites en bas (comme pour la limite droit)
|
// On étend également les limites en bas (comme pour la limite droit)
|
||||||
old_zoom_limit=Limit_bottom_zoom;
|
old_zoom_limit=Limit_bottom_zoom;
|
||||||
Limit_bottom_zoom=Limit_visible_bottom_zoom;
|
Limit_bottom_zoom=Limit_visible_bottom_zoom;
|
||||||
|
|
||||||
for (pos=start;pos<=end;pos++)
|
for (pos=start;pos<=end;pos++)
|
||||||
Pixel_preview(pos,Main_image_height,((pos+Main_image_height)&1)?MC_White:MC_Black);
|
Pixel_preview(pos,Main.image_height,((pos+Main.image_height)&1)?MC_White:MC_Black);
|
||||||
|
|
||||||
Update_rect(start,Main_image_height,end-start + 1,1);
|
Update_rect(start,Main.image_height,end-start + 1,1);
|
||||||
|
|
||||||
// On restaure la bonne valeur des limites
|
// On restaure la bonne valeur des limites
|
||||||
Limit_bottom_zoom=old_zoom_limit;
|
Limit_bottom_zoom=old_zoom_limit;
|
||||||
@ -1676,74 +1676,74 @@ void Display_image_limits(void)
|
|||||||
void Position_screen_according_to_zoom(void)
|
void Position_screen_according_to_zoom(void)
|
||||||
{
|
{
|
||||||
// Centrage en X
|
// Centrage en X
|
||||||
if (Main_image_width>Main_separator_position)
|
if (Main.image_width>Main.separator_position)
|
||||||
{
|
{
|
||||||
Main_offset_X=Main_magnifier_offset_X+(Main_magnifier_width>>1)
|
Main.offset_X=Main.magnifier_offset_X+(Main.magnifier_width>>1)
|
||||||
-(Main_separator_position>>1);
|
-(Main.separator_position>>1);
|
||||||
if (Main_offset_X<0)
|
if (Main.offset_X<0)
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
else if (Main_image_width<Main_offset_X+Main_separator_position)
|
else if (Main.image_width<Main.offset_X+Main.separator_position)
|
||||||
Main_offset_X=Main_image_width-Main_separator_position;
|
Main.offset_X=Main.image_width-Main.separator_position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
|
|
||||||
// Centrage en Y
|
// Centrage en Y
|
||||||
if (Main_image_height>Menu_Y)
|
if (Main.image_height>Menu_Y)
|
||||||
{
|
{
|
||||||
Main_offset_Y=Main_magnifier_offset_Y+(Main_magnifier_height>>1)
|
Main.offset_Y=Main.magnifier_offset_Y+(Main.magnifier_height>>1)
|
||||||
-(Menu_Y>>1);
|
-(Menu_Y>>1);
|
||||||
if (Main_offset_Y<0)
|
if (Main.offset_Y<0)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
else if (Main_image_height<Main_offset_Y+Menu_Y)
|
else if (Main.image_height<Main.offset_Y+Menu_Y)
|
||||||
Main_offset_Y=Main_image_height-Menu_Y;
|
Main.offset_Y=Main.image_height-Menu_Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Recenter the non-zoomed part of image around a precise pixel
|
// -- Recenter the non-zoomed part of image around a precise pixel
|
||||||
void Position_screen_according_to_position(int target_x, int target_y)
|
void Position_screen_according_to_position(int target_x, int target_y)
|
||||||
{
|
{
|
||||||
// Centrage en X
|
// Centrage en X
|
||||||
if (Main_image_width>Main_separator_position)
|
if (Main.image_width>Main.separator_position)
|
||||||
{
|
{
|
||||||
Main_offset_X=target_x-Mouse_X;
|
Main.offset_X=target_x-Mouse_X;
|
||||||
// Do not allow the zoomed part to show something that the
|
// Do not allow the zoomed part to show something that the
|
||||||
// non-zoomed part doesn't see. All clipping is computed according
|
// non-zoomed part doesn't see. All clipping is computed according
|
||||||
// to the non-zoomed part.
|
// to the non-zoomed part.
|
||||||
if (Main_magnifier_offset_X<Main_offset_X)
|
if (Main.magnifier_offset_X<Main.offset_X)
|
||||||
Main_offset_X=Main_magnifier_offset_X;
|
Main.offset_X=Main.magnifier_offset_X;
|
||||||
else if (Main_magnifier_offset_X+Main_magnifier_width > Main_offset_X+Main_separator_position)
|
else if (Main.magnifier_offset_X+Main.magnifier_width > Main.offset_X+Main.separator_position)
|
||||||
Main_offset_X = Main_magnifier_offset_X+Main_magnifier_width-Main_separator_position;
|
Main.offset_X = Main.magnifier_offset_X+Main.magnifier_width-Main.separator_position;
|
||||||
if (Main_offset_X<0)
|
if (Main.offset_X<0)
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
else if (Main_image_width<Main_offset_X+Main_separator_position)
|
else if (Main.image_width<Main.offset_X+Main.separator_position)
|
||||||
Main_offset_X=Main_image_width-Main_separator_position;
|
Main.offset_X=Main.image_width-Main.separator_position;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Main_offset_X=0;
|
Main.offset_X=0;
|
||||||
|
|
||||||
// Centrage en Y
|
// Centrage en Y
|
||||||
if (Main_image_height>Menu_Y)
|
if (Main.image_height>Menu_Y)
|
||||||
{
|
{
|
||||||
Main_offset_Y=target_y-Mouse_Y;
|
Main.offset_Y=target_y-Mouse_Y;
|
||||||
// Do not allow the zoomed part to show something that the
|
// Do not allow the zoomed part to show something that the
|
||||||
// non-zoomed part doesn't see. All clipping is computed according
|
// non-zoomed part doesn't see. All clipping is computed according
|
||||||
// to the non-zoomed part.
|
// to the non-zoomed part.
|
||||||
if (Main_magnifier_offset_Y<Main_offset_Y)
|
if (Main.magnifier_offset_Y<Main.offset_Y)
|
||||||
Main_offset_Y=Main_magnifier_offset_Y;
|
Main.offset_Y=Main.magnifier_offset_Y;
|
||||||
else if (Main_magnifier_offset_Y+Main_magnifier_height > Main_offset_Y)
|
else if (Main.magnifier_offset_Y+Main.magnifier_height > Main.offset_Y)
|
||||||
Main_offset_Y = Main_magnifier_offset_Y+Main_magnifier_height;
|
Main.offset_Y = Main.magnifier_offset_Y+Main.magnifier_height;
|
||||||
if (Main_offset_Y<0)
|
if (Main.offset_Y<0)
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
else if (Main_image_height<Main_offset_Y+Menu_Y)
|
else if (Main.image_height<Main.offset_Y+Menu_Y)
|
||||||
Main_offset_Y=Main_image_height-Menu_Y;
|
Main.offset_Y=Main.image_height-Menu_Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Main_offset_Y=0;
|
Main.offset_Y=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1751,23 +1751,23 @@ void Position_screen_according_to_position(int target_x, int target_y)
|
|||||||
void Compute_separator_data(void)
|
void Compute_separator_data(void)
|
||||||
{
|
{
|
||||||
//short temp;
|
//short temp;
|
||||||
short theoric_X=Round(Main_separator_proportion*Screen_width);
|
short theoric_X=Round(Main.separator_proportion*Screen_width);
|
||||||
|
|
||||||
Main_X_zoom=Screen_width-(((Screen_width+(Main_magnifier_factor>>1)-theoric_X)/Main_magnifier_factor)*Main_magnifier_factor);
|
Main.X_zoom=Screen_width-(((Screen_width+(Main.magnifier_factor>>1)-theoric_X)/Main.magnifier_factor)*Main.magnifier_factor);
|
||||||
Main_separator_position=Main_X_zoom-(Menu_factor_X*SEPARATOR_WIDTH);
|
Main.separator_position=Main.X_zoom-(Menu_factor_X*SEPARATOR_WIDTH);
|
||||||
|
|
||||||
// Correction en cas de débordement sur la gauche
|
// Correction en cas de débordement sur la gauche
|
||||||
while (Main_separator_position*(Main_magnifier_factor+1)<Screen_width-(Menu_factor_X*SEPARATOR_WIDTH))
|
while (Main.separator_position*(Main.magnifier_factor+1)<Screen_width-(Menu_factor_X*SEPARATOR_WIDTH))
|
||||||
{
|
{
|
||||||
Main_separator_position+=Main_magnifier_factor;
|
Main.separator_position+=Main.magnifier_factor;
|
||||||
Main_X_zoom+=Main_magnifier_factor;
|
Main.X_zoom+=Main.magnifier_factor;
|
||||||
}
|
}
|
||||||
// Correction en cas de débordement sur la droite
|
// Correction en cas de débordement sur la droite
|
||||||
theoric_X=Screen_width-((NB_ZOOMED_PIXELS_MIN-1)*Main_magnifier_factor);
|
theoric_X=Screen_width-((NB_ZOOMED_PIXELS_MIN-1)*Main.magnifier_factor);
|
||||||
while (Main_X_zoom>=theoric_X)
|
while (Main.X_zoom>=theoric_X)
|
||||||
{
|
{
|
||||||
Main_separator_position-=Main_magnifier_factor;
|
Main.separator_position-=Main.magnifier_factor;
|
||||||
Main_X_zoom-=Main_magnifier_factor;
|
Main.X_zoom-=Main.magnifier_factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1781,30 +1781,30 @@ void Compute_magnifier_data(void)
|
|||||||
{
|
{
|
||||||
Compute_separator_data();
|
Compute_separator_data();
|
||||||
|
|
||||||
Main_magnifier_width=(Screen_width-Main_X_zoom)/Main_magnifier_factor;
|
Main.magnifier_width=(Screen_width-Main.X_zoom)/Main.magnifier_factor;
|
||||||
|
|
||||||
Main_magnifier_height=Menu_Y/Main_magnifier_factor;
|
Main.magnifier_height=Menu_Y/Main.magnifier_factor;
|
||||||
if (Menu_Y%Main_magnifier_factor)
|
if (Menu_Y%Main.magnifier_factor)
|
||||||
Main_magnifier_height++;
|
Main.magnifier_height++;
|
||||||
|
|
||||||
Clip_magnifier_offsets(&Main_magnifier_offset_X, &Main_magnifier_offset_Y);
|
Clip_magnifier_offsets(&Main.magnifier_offset_X, &Main.magnifier_offset_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip_magnifier_offsets(short *x_offset, short *y_offset)
|
void Clip_magnifier_offsets(short *x_offset, short *y_offset)
|
||||||
{
|
{
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
if (*x_offset)
|
if (*x_offset)
|
||||||
{
|
{
|
||||||
if (Main_image_width<*x_offset+Main_magnifier_width)
|
if (Main.image_width<*x_offset+Main.magnifier_width)
|
||||||
*x_offset=Main_image_width-Main_magnifier_width;
|
*x_offset=Main.image_width-Main.magnifier_width;
|
||||||
if (*x_offset<0)
|
if (*x_offset<0)
|
||||||
*x_offset=0;
|
*x_offset=0;
|
||||||
}
|
}
|
||||||
if (*y_offset)
|
if (*y_offset)
|
||||||
{
|
{
|
||||||
if (Main_image_height<*y_offset+Main_magnifier_height)
|
if (Main.image_height<*y_offset+Main.magnifier_height)
|
||||||
*y_offset=Main_image_height-Main_magnifier_height+(Main_magnifier_height*Main_magnifier_factor-Menu_Y>=Main_magnifier_factor/2);
|
*y_offset=Main.image_height-Main.magnifier_height+(Main.magnifier_height*Main.magnifier_factor-Menu_Y>=Main.magnifier_factor/2);
|
||||||
if (*y_offset<0)
|
if (*y_offset<0)
|
||||||
*y_offset=0;
|
*y_offset=0;
|
||||||
}
|
}
|
||||||
@ -1818,49 +1818,49 @@ void Change_magnifier_factor(byte factor_index, byte point_at_mouse)
|
|||||||
byte magnified_view_leads=1;
|
byte magnified_view_leads=1;
|
||||||
|
|
||||||
// Values that need to be computed before switching to the new zoom factor
|
// Values that need to be computed before switching to the new zoom factor
|
||||||
if (!point_at_mouse || Cursor_in_menu || !Main_magnifier_mode)
|
if (!point_at_mouse || Cursor_in_menu || !Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// Locate the pixel in center of the magnified area
|
// Locate the pixel in center of the magnified area
|
||||||
target_x = Main_magnifier_offset_X + (Main_magnifier_width >> 1);
|
target_x = Main.magnifier_offset_X + (Main.magnifier_width >> 1);
|
||||||
target_y = Main_magnifier_offset_Y + (Main_magnifier_height >> 1);
|
target_y = Main.magnifier_offset_Y + (Main.magnifier_height >> 1);
|
||||||
point_at_mouse=0;
|
point_at_mouse=0;
|
||||||
}
|
}
|
||||||
else if (Mouse_X>=Main_X_zoom)
|
else if (Mouse_X>=Main.X_zoom)
|
||||||
{
|
{
|
||||||
// Locate the pixel under the cursor, in magnified area
|
// Locate the pixel under the cursor, in magnified area
|
||||||
target_x=((Mouse_X-Main_X_zoom)/Main_magnifier_factor)+Main_magnifier_offset_X;
|
target_x=((Mouse_X-Main.X_zoom)/Main.magnifier_factor)+Main.magnifier_offset_X;
|
||||||
target_y=(Mouse_Y/Main_magnifier_factor)+Main_magnifier_offset_Y;
|
target_y=(Mouse_Y/Main.magnifier_factor)+Main.magnifier_offset_Y;
|
||||||
point_at_mouse=1;
|
point_at_mouse=1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Locate the pixel under the cursor, in normal area
|
// Locate the pixel under the cursor, in normal area
|
||||||
target_x=Mouse_X+Main_offset_X;
|
target_x=Mouse_X+Main.offset_X;
|
||||||
target_y=Mouse_Y+Main_offset_Y;
|
target_y=Mouse_Y+Main.offset_Y;
|
||||||
magnified_view_leads=0;
|
magnified_view_leads=0;
|
||||||
point_at_mouse=0;
|
point_at_mouse=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Main_magnifier_factor=ZOOM_FACTOR[factor_index];
|
Main.magnifier_factor=ZOOM_FACTOR[factor_index];
|
||||||
Compute_magnifier_data();
|
Compute_magnifier_data();
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// Recompute the magnifier offset (center its view)
|
// Recompute the magnifier offset (center its view)
|
||||||
if (point_at_mouse)
|
if (point_at_mouse)
|
||||||
{
|
{
|
||||||
// Target pixel must be located under the mouse position.
|
// Target pixel must be located under the mouse position.
|
||||||
Main_magnifier_offset_X = target_x-((Mouse_X-Main_X_zoom)/Main_magnifier_factor);
|
Main.magnifier_offset_X = target_x-((Mouse_X-Main.X_zoom)/Main.magnifier_factor);
|
||||||
Main_magnifier_offset_Y = target_y-((Mouse_Y)/Main_magnifier_factor);
|
Main.magnifier_offset_Y = target_y-((Mouse_Y)/Main.magnifier_factor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Target pixel must be positioned at new center
|
// Target pixel must be positioned at new center
|
||||||
Main_magnifier_offset_X = target_x-(Main_magnifier_width>>1);
|
Main.magnifier_offset_X = target_x-(Main.magnifier_width>>1);
|
||||||
Main_magnifier_offset_Y = target_y-(Main_magnifier_height>>1);
|
Main.magnifier_offset_Y = target_y-(Main.magnifier_height>>1);
|
||||||
}
|
}
|
||||||
// Fix cases where the image would overflow on edges
|
// Fix cases where the image would overflow on edges
|
||||||
Clip_magnifier_offsets(&Main_magnifier_offset_X, &Main_magnifier_offset_Y);
|
Clip_magnifier_offsets(&Main.magnifier_offset_X, &Main.magnifier_offset_Y);
|
||||||
|
|
||||||
if (magnified_view_leads)
|
if (magnified_view_leads)
|
||||||
Position_screen_according_to_zoom();
|
Position_screen_according_to_zoom();
|
||||||
@ -1881,31 +1881,31 @@ void Copy_view_to_spare(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Don't do anything if the pictures have different dimensions
|
// Don't do anything if the pictures have different dimensions
|
||||||
if (Main_image_width!=Spare_image_width || Main_image_height!=Spare_image_height)
|
if (Main.image_width!=Spare.image_width || Main.image_height!=Spare.image_height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Copie des décalages de la fenêtre principale (non zoomée) de l'image
|
// Copie des décalages de la fenêtre principale (non zoomée) de l'image
|
||||||
Spare_offset_X=Main_offset_X;
|
Spare.offset_X=Main.offset_X;
|
||||||
Spare_offset_Y=Main_offset_Y;
|
Spare.offset_Y=Main.offset_Y;
|
||||||
|
|
||||||
// Copie du booléen "Mode loupe" de l'image
|
// Copie du booléen "Mode loupe" de l'image
|
||||||
Spare_magnifier_mode=Main_magnifier_mode;
|
Spare.magnifier_mode=Main.magnifier_mode;
|
||||||
|
|
||||||
// Copie du facteur de zoom du brouillon
|
// Copie du facteur de zoom du brouillon
|
||||||
Spare_magnifier_factor=Main_magnifier_factor;
|
Spare.magnifier_factor=Main.magnifier_factor;
|
||||||
|
|
||||||
// Copie des dimensions de la fenêtre de zoom
|
// Copie des dimensions de la fenêtre de zoom
|
||||||
Spare_magnifier_width=Main_magnifier_width;
|
Spare.magnifier_width=Main.magnifier_width;
|
||||||
Spare_magnifier_height=Main_magnifier_height;
|
Spare.magnifier_height=Main.magnifier_height;
|
||||||
|
|
||||||
// Copie des décalages de la fenêtre de zoom
|
// Copie des décalages de la fenêtre de zoom
|
||||||
Spare_magnifier_offset_X=Main_magnifier_offset_X;
|
Spare.magnifier_offset_X=Main.magnifier_offset_X;
|
||||||
Spare_magnifier_offset_Y=Main_magnifier_offset_Y;
|
Spare.magnifier_offset_Y=Main.magnifier_offset_Y;
|
||||||
|
|
||||||
// Copie des données du split du zoom
|
// Copie des données du split du zoom
|
||||||
Spare_separator_position=Main_separator_position;
|
Spare.separator_position=Main.separator_position;
|
||||||
Spare_X_zoom=Main_X_zoom;
|
Spare.X_zoom=Main.X_zoom;
|
||||||
Spare_separator_proportion=Main_separator_proportion;
|
Spare.separator_proportion=Main.separator_proportion;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Afficher la barre de séparation entre les parties zoomées ou non en
|
// -- Afficher la barre de séparation entre les parties zoomées ou non en
|
||||||
@ -1914,40 +1914,40 @@ void Copy_view_to_spare(void)
|
|||||||
void Display_separator(void)
|
void Display_separator(void)
|
||||||
{
|
{
|
||||||
// Partie grise du milieu
|
// Partie grise du milieu
|
||||||
Block(Main_separator_position+(Menu_factor_X<<1),Menu_factor_Y,
|
Block(Main.separator_position+(Menu_factor_X<<1),Menu_factor_Y,
|
||||||
(SEPARATOR_WIDTH-4)*Menu_factor_X,
|
(SEPARATOR_WIDTH-4)*Menu_factor_X,
|
||||||
Menu_Y-(Menu_factor_Y<<1),MC_Light);
|
Menu_Y-(Menu_factor_Y<<1),MC_Light);
|
||||||
|
|
||||||
// Barre noire de gauche
|
// Barre noire de gauche
|
||||||
Block(Main_separator_position,0,Menu_factor_X,Menu_Y,MC_Black);
|
Block(Main.separator_position,0,Menu_factor_X,Menu_Y,MC_Black);
|
||||||
|
|
||||||
// Barre noire de droite
|
// Barre noire de droite
|
||||||
Block(Main_X_zoom-Menu_factor_X,0,Menu_factor_X,Menu_Y,MC_Black);
|
Block(Main.X_zoom-Menu_factor_X,0,Menu_factor_X,Menu_Y,MC_Black);
|
||||||
|
|
||||||
// Bord haut (blanc)
|
// Bord haut (blanc)
|
||||||
Block(Main_separator_position+Menu_factor_X,0,
|
Block(Main.separator_position+Menu_factor_X,0,
|
||||||
(SEPARATOR_WIDTH-3)*Menu_factor_X,Menu_factor_Y,MC_White);
|
(SEPARATOR_WIDTH-3)*Menu_factor_X,Menu_factor_Y,MC_White);
|
||||||
|
|
||||||
// Bord gauche (blanc)
|
// Bord gauche (blanc)
|
||||||
Block(Main_separator_position+Menu_factor_X,Menu_factor_Y,
|
Block(Main.separator_position+Menu_factor_X,Menu_factor_Y,
|
||||||
Menu_factor_X,(Menu_Y-(Menu_factor_Y<<1)),MC_White);
|
Menu_factor_X,(Menu_Y-(Menu_factor_Y<<1)),MC_White);
|
||||||
|
|
||||||
// Bord droite (gris foncé)
|
// Bord droite (gris foncé)
|
||||||
Block(Main_X_zoom-(Menu_factor_X<<1),Menu_factor_Y,
|
Block(Main.X_zoom-(Menu_factor_X<<1),Menu_factor_Y,
|
||||||
Menu_factor_X,(Menu_Y-(Menu_factor_Y<<1)),MC_Dark);
|
Menu_factor_X,(Menu_Y-(Menu_factor_Y<<1)),MC_Dark);
|
||||||
|
|
||||||
// Bord bas (gris foncé)
|
// Bord bas (gris foncé)
|
||||||
Block(Main_separator_position+(Menu_factor_X<<1),Menu_Y-Menu_factor_Y,
|
Block(Main.separator_position+(Menu_factor_X<<1),Menu_Y-Menu_factor_Y,
|
||||||
(SEPARATOR_WIDTH-3)*Menu_factor_X,Menu_factor_Y,MC_Dark);
|
(SEPARATOR_WIDTH-3)*Menu_factor_X,Menu_factor_Y,MC_Dark);
|
||||||
|
|
||||||
// Coin bas gauche
|
// Coin bas gauche
|
||||||
Block(Main_separator_position+Menu_factor_X,Menu_Y-Menu_factor_Y,
|
Block(Main.separator_position+Menu_factor_X,Menu_Y-Menu_factor_Y,
|
||||||
Menu_factor_X,Menu_factor_Y,MC_Light);
|
Menu_factor_X,Menu_factor_Y,MC_Light);
|
||||||
// Coin haut droite
|
// Coin haut droite
|
||||||
Block(Main_X_zoom-(Menu_factor_X<<1),0,
|
Block(Main.X_zoom-(Menu_factor_X<<1),0,
|
||||||
Menu_factor_X,Menu_factor_Y,MC_Light);
|
Menu_factor_X,Menu_factor_Y,MC_Light);
|
||||||
|
|
||||||
Update_rect(Main_separator_position,0,SEPARATOR_WIDTH*Menu_factor_X,Menu_Y); // On réaffiche toute la partie à gauche du split, ce qui permet d'effacer son ancienne position
|
Update_rect(Main.separator_position,0,SEPARATOR_WIDTH*Menu_factor_X,Menu_Y); // On réaffiche toute la partie à gauche du split, ce qui permet d'effacer son ancienne position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1959,10 +1959,10 @@ void Display_separator(void)
|
|||||||
|
|
||||||
void Horizontal_XOR_line_zoom(short x_pos, short y_pos, short width)
|
void Horizontal_XOR_line_zoom(short x_pos, short y_pos, short width)
|
||||||
{
|
{
|
||||||
short real_x_pos=Main_X_zoom+(x_pos-Main_magnifier_offset_X)*Main_magnifier_factor;
|
short real_x_pos=Main.X_zoom+(x_pos-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
short real_y_pos=(y_pos-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
short real_y_pos=(y_pos-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
short real_width=width*Main_magnifier_factor;
|
short real_width=width*Main.magnifier_factor;
|
||||||
short end_y_pos=(real_y_pos+Main_magnifier_factor<Menu_Y)?real_y_pos+Main_magnifier_factor:Menu_Y;
|
short end_y_pos=(real_y_pos+Main.magnifier_factor<Menu_Y)?real_y_pos+Main.magnifier_factor:Menu_Y;
|
||||||
short index;
|
short index;
|
||||||
|
|
||||||
for (index=real_y_pos; index<end_y_pos; index++)
|
for (index=real_y_pos; index<end_y_pos; index++)
|
||||||
@ -1976,15 +1976,15 @@ void Horizontal_XOR_line_zoom(short x_pos, short y_pos, short width)
|
|||||||
|
|
||||||
void Vertical_XOR_line_zoom(short x_pos, short y_pos, short height)
|
void Vertical_XOR_line_zoom(short x_pos, short y_pos, short height)
|
||||||
{
|
{
|
||||||
short real_x_pos=Main_X_zoom+(x_pos-Main_magnifier_offset_X)*Main_magnifier_factor;
|
short real_x_pos=Main.X_zoom+(x_pos-Main.magnifier_offset_X)*Main.magnifier_factor;
|
||||||
short real_y_pos=(y_pos-Main_magnifier_offset_Y)*Main_magnifier_factor;
|
short real_y_pos=(y_pos-Main.magnifier_offset_Y)*Main.magnifier_factor;
|
||||||
short end_y_pos=(real_y_pos+height*Main_magnifier_factor<Menu_Y)?real_y_pos+(height*Main_magnifier_factor):Menu_Y;
|
short end_y_pos=(real_y_pos+height*Main.magnifier_factor<Menu_Y)?real_y_pos+(height*Main.magnifier_factor):Menu_Y;
|
||||||
short index;
|
short index;
|
||||||
|
|
||||||
for (index=real_y_pos; index<end_y_pos; index++)
|
for (index=real_y_pos; index<end_y_pos; index++)
|
||||||
Horizontal_XOR_line(real_x_pos,index,Main_magnifier_factor);
|
Horizontal_XOR_line(real_x_pos,index,Main.magnifier_factor);
|
||||||
|
|
||||||
Update_rect(real_x_pos,real_y_pos,Main_magnifier_factor,end_y_pos-real_y_pos);
|
Update_rect(real_x_pos,real_y_pos,Main.magnifier_factor,end_y_pos-real_y_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2008,7 +2008,7 @@ void Display_cursor(void)
|
|||||||
|
|
||||||
// Si le curseur est dans le menu ou sur la barre de split, on affiche toujours une flèche.
|
// Si le curseur est dans le menu ou sur la barre de split, on affiche toujours une flèche.
|
||||||
if ( ( (Mouse_Y<Menu_Y)
|
if ( ( (Mouse_Y<Menu_Y)
|
||||||
&& ( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
|
&& ( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position) || (Mouse_X>=Main.X_zoom) ) )
|
||||||
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||||
shape=Cursor_shape;
|
shape=Cursor_shape;
|
||||||
else
|
else
|
||||||
@ -2163,29 +2163,29 @@ void Display_cursor(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_SHAPE_XOR_TARGET :
|
case CURSOR_SHAPE_XOR_TARGET :
|
||||||
x_pos=Paintbrush_X-Main_offset_X;
|
x_pos=Paintbrush_X-Main.offset_X;
|
||||||
y_pos=Paintbrush_Y-Main_offset_Y;
|
y_pos=Paintbrush_Y-Main.offset_Y;
|
||||||
|
|
||||||
counter_x=(Main_magnifier_mode)?Main_separator_position:Screen_width; // width de la barre XOR
|
counter_x=(Main.magnifier_mode)?Main.separator_position:Screen_width; // width de la barre XOR
|
||||||
if ((y_pos<Menu_Y) && (Paintbrush_Y>=Limit_top))
|
if ((y_pos<Menu_Y) && (Paintbrush_Y>=Limit_top))
|
||||||
{
|
{
|
||||||
Horizontal_XOR_line(0,Paintbrush_Y-Main_offset_Y,counter_x);
|
Horizontal_XOR_line(0,Paintbrush_Y-Main.offset_Y,counter_x);
|
||||||
Update_rect(0,Paintbrush_Y-Main_offset_Y,counter_x,1);
|
Update_rect(0,Paintbrush_Y-Main.offset_Y,counter_x,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x_pos<counter_x) && (Paintbrush_X>=Limit_left))
|
if ((x_pos<counter_x) && (Paintbrush_X>=Limit_left))
|
||||||
{
|
{
|
||||||
Vertical_XOR_line(Paintbrush_X-Main_offset_X,0,Menu_Y);
|
Vertical_XOR_line(Paintbrush_X-Main.offset_X,0,Menu_Y);
|
||||||
Update_rect(Paintbrush_X-Main_offset_X,0,1,Menu_Y);
|
Update_rect(Paintbrush_X-Main.offset_X,0,1,Menu_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// UPDATERECT
|
// UPDATERECT
|
||||||
if ((Paintbrush_Y>=Limit_top_zoom) && (Paintbrush_Y<=Limit_visible_bottom_zoom))
|
if ((Paintbrush_Y>=Limit_top_zoom) && (Paintbrush_Y<=Limit_visible_bottom_zoom))
|
||||||
Horizontal_XOR_line_zoom(Limit_left_zoom,Paintbrush_Y,Main_magnifier_width);
|
Horizontal_XOR_line_zoom(Limit_left_zoom,Paintbrush_Y,Main.magnifier_width);
|
||||||
if ((Paintbrush_X>=Limit_left_zoom) && (Paintbrush_X<=Limit_visible_right_zoom))
|
if ((Paintbrush_X>=Limit_left_zoom) && (Paintbrush_X<=Limit_visible_right_zoom))
|
||||||
Vertical_XOR_line_zoom(Paintbrush_X,Limit_top_zoom,Main_magnifier_height);
|
Vertical_XOR_line_zoom(Paintbrush_X,Limit_top_zoom,Main.magnifier_height);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CURSOR_SHAPE_XOR_RECTANGLE :
|
case CURSOR_SHAPE_XOR_RECTANGLE :
|
||||||
@ -2209,23 +2209,23 @@ void Display_cursor(void)
|
|||||||
Vertical_XOR_line (Mouse_X,start_y,end_y-start_y);
|
Vertical_XOR_line (Mouse_X,start_y,end_y-start_y);
|
||||||
|
|
||||||
// Grand rectangle autour
|
// Grand rectangle autour
|
||||||
start_x=Mouse_X-(Main_magnifier_width>>1);
|
start_x=Mouse_X-(Main.magnifier_width>>1);
|
||||||
start_y=Mouse_Y-(Main_magnifier_height>>1);
|
start_y=Mouse_Y-(Main.magnifier_height>>1);
|
||||||
if (start_x+Main_magnifier_width>=Limit_right-Main_offset_X)
|
if (start_x+Main.magnifier_width>=Limit_right-Main.offset_X)
|
||||||
start_x=Limit_right-Main_magnifier_width-Main_offset_X+1;
|
start_x=Limit_right-Main.magnifier_width-Main.offset_X+1;
|
||||||
if (start_y+Main_magnifier_height>=Limit_bottom-Main_offset_Y)
|
if (start_y+Main.magnifier_height>=Limit_bottom-Main.offset_Y)
|
||||||
start_y=Limit_bottom-Main_magnifier_height-Main_offset_Y+1;
|
start_y=Limit_bottom-Main.magnifier_height-Main.offset_Y+1;
|
||||||
if (start_x<0)
|
if (start_x<0)
|
||||||
start_x=0;
|
start_x=0;
|
||||||
if (start_y<0)
|
if (start_y<0)
|
||||||
start_y=0;
|
start_y=0;
|
||||||
end_x=start_x+Main_magnifier_width-1;
|
end_x=start_x+Main.magnifier_width-1;
|
||||||
end_y=start_y+Main_magnifier_height-1;
|
end_y=start_y+Main.magnifier_height-1;
|
||||||
|
|
||||||
Horizontal_XOR_line(start_x,start_y,Main_magnifier_width);
|
Horizontal_XOR_line(start_x,start_y,Main.magnifier_width);
|
||||||
Vertical_XOR_line(start_x,start_y+1,Main_magnifier_height-2);
|
Vertical_XOR_line(start_x,start_y+1,Main.magnifier_height-2);
|
||||||
Vertical_XOR_line( end_x,start_y+1,Main_magnifier_height-2);
|
Vertical_XOR_line( end_x,start_y+1,Main.magnifier_height-2);
|
||||||
Horizontal_XOR_line(start_x, end_y,Main_magnifier_width);
|
Horizontal_XOR_line(start_x, end_y,Main.magnifier_width);
|
||||||
|
|
||||||
Update_rect(start_x,start_y,end_x+1-start_x,end_y+1-start_y);
|
Update_rect(start_x,start_y,end_x+1-start_x,end_y+1-start_y);
|
||||||
|
|
||||||
@ -2311,8 +2311,8 @@ void Hide_cursor(void)
|
|||||||
short x1,y1,x2,y2,x3,y3,x4,y4;
|
short x1,y1,x2,y2,x3,y3,x4,y4;
|
||||||
|
|
||||||
if ( ( (Mouse_Y<Menu_Y)
|
if ( ( (Mouse_Y<Menu_Y)
|
||||||
&& ( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position)
|
&& ( (!Main.magnifier_mode) || (Mouse_X<Main.separator_position)
|
||||||
|| (Mouse_X>=Main_X_zoom) ) )
|
|| (Mouse_X>=Main.X_zoom) ) )
|
||||||
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
|| (Windows_open) || (Cursor_shape==CURSOR_SHAPE_HOURGLASS) )
|
||||||
shape=Cursor_shape;
|
shape=Cursor_shape;
|
||||||
else
|
else
|
||||||
@ -2459,29 +2459,29 @@ void Hide_cursor(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_SHAPE_XOR_TARGET :
|
case CURSOR_SHAPE_XOR_TARGET :
|
||||||
x_pos=Paintbrush_X-Main_offset_X;
|
x_pos=Paintbrush_X-Main.offset_X;
|
||||||
y_pos=Paintbrush_Y-Main_offset_Y;
|
y_pos=Paintbrush_Y-Main.offset_Y;
|
||||||
|
|
||||||
counter_x=(Main_magnifier_mode)?Main_separator_position:Screen_width; // width de la barre XOR
|
counter_x=(Main.magnifier_mode)?Main.separator_position:Screen_width; // width de la barre XOR
|
||||||
if ((y_pos<Menu_Y) && (Paintbrush_Y>=Limit_top))
|
if ((y_pos<Menu_Y) && (Paintbrush_Y>=Limit_top))
|
||||||
{
|
{
|
||||||
Horizontal_XOR_line(0,Paintbrush_Y-Main_offset_Y,counter_x);
|
Horizontal_XOR_line(0,Paintbrush_Y-Main.offset_Y,counter_x);
|
||||||
Update_rect(0,Paintbrush_Y-Main_offset_Y,counter_x,1);
|
Update_rect(0,Paintbrush_Y-Main.offset_Y,counter_x,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x_pos<counter_x) && (Paintbrush_X>=Limit_left))
|
if ((x_pos<counter_x) && (Paintbrush_X>=Limit_left))
|
||||||
{
|
{
|
||||||
Vertical_XOR_line(Paintbrush_X-Main_offset_X,0,Menu_Y);
|
Vertical_XOR_line(Paintbrush_X-Main.offset_X,0,Menu_Y);
|
||||||
Update_rect(Paintbrush_X-Main_offset_X,0,1,Menu_Y);
|
Update_rect(Paintbrush_X-Main.offset_X,0,1,Menu_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// UPDATERECT
|
// UPDATERECT
|
||||||
if ((Paintbrush_Y>=Limit_top_zoom) && (Paintbrush_Y<=Limit_visible_bottom_zoom))
|
if ((Paintbrush_Y>=Limit_top_zoom) && (Paintbrush_Y<=Limit_visible_bottom_zoom))
|
||||||
Horizontal_XOR_line_zoom(Limit_left_zoom,Paintbrush_Y,Main_magnifier_width);
|
Horizontal_XOR_line_zoom(Limit_left_zoom,Paintbrush_Y,Main.magnifier_width);
|
||||||
if ((Paintbrush_X>=Limit_left_zoom) && (Paintbrush_X<=Limit_visible_right_zoom))
|
if ((Paintbrush_X>=Limit_left_zoom) && (Paintbrush_X<=Limit_visible_right_zoom))
|
||||||
Vertical_XOR_line_zoom(Paintbrush_X,Limit_top_zoom,Main_magnifier_height);
|
Vertical_XOR_line_zoom(Paintbrush_X,Limit_top_zoom,Main.magnifier_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2508,23 +2508,23 @@ void Hide_cursor(void)
|
|||||||
|
|
||||||
// Grand rectangle autour
|
// Grand rectangle autour
|
||||||
|
|
||||||
start_x=Mouse_X-(Main_magnifier_width>>1);
|
start_x=Mouse_X-(Main.magnifier_width>>1);
|
||||||
start_y=Mouse_Y-(Main_magnifier_height>>1);
|
start_y=Mouse_Y-(Main.magnifier_height>>1);
|
||||||
if (start_x+Main_magnifier_width>=Limit_right-Main_offset_X)
|
if (start_x+Main.magnifier_width>=Limit_right-Main.offset_X)
|
||||||
start_x=Limit_right-Main_magnifier_width-Main_offset_X+1;
|
start_x=Limit_right-Main.magnifier_width-Main.offset_X+1;
|
||||||
if (start_y+Main_magnifier_height>=Limit_bottom-Main_offset_Y)
|
if (start_y+Main.magnifier_height>=Limit_bottom-Main.offset_Y)
|
||||||
start_y=Limit_bottom-Main_magnifier_height-Main_offset_Y+1;
|
start_y=Limit_bottom-Main.magnifier_height-Main.offset_Y+1;
|
||||||
if (start_x<0)
|
if (start_x<0)
|
||||||
start_x=0;
|
start_x=0;
|
||||||
if (start_y<0)
|
if (start_y<0)
|
||||||
start_y=0;
|
start_y=0;
|
||||||
end_x=start_x+Main_magnifier_width-1;
|
end_x=start_x+Main.magnifier_width-1;
|
||||||
end_y=start_y+Main_magnifier_height-1;
|
end_y=start_y+Main.magnifier_height-1;
|
||||||
|
|
||||||
Horizontal_XOR_line(start_x,start_y,Main_magnifier_width);
|
Horizontal_XOR_line(start_x,start_y,Main.magnifier_width);
|
||||||
Vertical_XOR_line(start_x,start_y+1,Main_magnifier_height-2);
|
Vertical_XOR_line(start_x,start_y+1,Main.magnifier_height-2);
|
||||||
Vertical_XOR_line( end_x,start_y+1,Main_magnifier_height-2);
|
Vertical_XOR_line( end_x,start_y+1,Main.magnifier_height-2);
|
||||||
Horizontal_XOR_line(start_x, end_y,Main_magnifier_width);
|
Horizontal_XOR_line(start_x, end_y,Main.magnifier_width);
|
||||||
|
|
||||||
Update_rect(start_x,start_y,end_x+1-start_x,end_y+1-start_y);
|
Update_rect(start_x,start_y,end_x+1-start_x,end_y+1-start_y);
|
||||||
|
|
||||||
@ -2604,70 +2604,70 @@ void Display_all_screen(void)
|
|||||||
word height;
|
word height;
|
||||||
|
|
||||||
// ---/\/\/\ Partie non zoomée: /\/\/\---
|
// ---/\/\/\ Partie non zoomée: /\/\/\---
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
if (Main_image_width<Main_separator_position)
|
if (Main.image_width<Main.separator_position)
|
||||||
width=Main_image_width;
|
width=Main.image_width;
|
||||||
else
|
else
|
||||||
width=Main_separator_position;
|
width=Main.separator_position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Main_image_width<Screen_width)
|
if (Main.image_width<Screen_width)
|
||||||
width=Main_image_width;
|
width=Main.image_width;
|
||||||
else
|
else
|
||||||
width=Screen_width;
|
width=Screen_width;
|
||||||
}
|
}
|
||||||
if (Main_image_height<Menu_Y)
|
if (Main.image_height<Menu_Y)
|
||||||
height=Main_image_height;
|
height=Main.image_height;
|
||||||
else
|
else
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
Display_screen(width,height,Main_image_width);
|
Display_screen(width,height,Main.image_width);
|
||||||
|
|
||||||
// Effacement de la partie non-image dans la partie non zoomée:
|
// Effacement de la partie non-image dans la partie non zoomée:
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
if (Main_image_width<Main_separator_position && Main_image_width < Screen_width)
|
if (Main.image_width<Main.separator_position && Main.image_width < Screen_width)
|
||||||
Block(Main_image_width,0,(Main_separator_position-Main_image_width),Menu_Y,Main_backups->Pages->Transparent_color);
|
Block(Main.image_width,0,(Main.separator_position-Main.image_width),Menu_Y,Main_backups->Pages->Transparent_color);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Main_image_width<Screen_width)
|
if (Main.image_width<Screen_width)
|
||||||
Block(Main_image_width,0,(Screen_width-Main_image_width),Menu_Y,Main_backups->Pages->Transparent_color);
|
Block(Main.image_width,0,(Screen_width-Main.image_width),Menu_Y,Main_backups->Pages->Transparent_color);
|
||||||
}
|
}
|
||||||
if (Main_image_height<Menu_Y)
|
if (Main.image_height<Menu_Y)
|
||||||
Block(0,Main_image_height,width,(Menu_Y-height),Main_backups->Pages->Transparent_color);
|
Block(0,Main.image_height,width,(Menu_Y-height),Main_backups->Pages->Transparent_color);
|
||||||
|
|
||||||
// ---/\/\/\ Partie zoomée: /\/\/\---
|
// ---/\/\/\ Partie zoomée: /\/\/\---
|
||||||
if (Main_magnifier_mode)
|
if (Main.magnifier_mode)
|
||||||
{
|
{
|
||||||
// Affichage de la barre de split
|
// Affichage de la barre de split
|
||||||
Display_separator();
|
Display_separator();
|
||||||
|
|
||||||
// Calcul de la largeur visible
|
// Calcul de la largeur visible
|
||||||
if (Main_image_width<Main_magnifier_width)
|
if (Main.image_width<Main.magnifier_width)
|
||||||
width=Main_image_width;
|
width=Main.image_width;
|
||||||
else
|
else
|
||||||
width=Main_magnifier_width;
|
width=Main.magnifier_width;
|
||||||
|
|
||||||
// Calcul du nombre de lignes visibles de l'image zoomée
|
// Calcul du nombre de lignes visibles de l'image zoomée
|
||||||
if (Main_image_height<Main_magnifier_height)
|
if (Main.image_height<Main.magnifier_height)
|
||||||
height=Main_image_height*Main_magnifier_factor;
|
height=Main.image_height*Main.magnifier_factor;
|
||||||
else if (Main_image_height<Main_magnifier_offset_Y+Main_magnifier_height)
|
else if (Main.image_height<Main.magnifier_offset_Y+Main.magnifier_height)
|
||||||
// Omit "last line" if it's outside picture limits
|
// Omit "last line" if it's outside picture limits
|
||||||
height=Menu_Y/Main_magnifier_factor*Main_magnifier_factor;
|
height=Menu_Y/Main.magnifier_factor*Main.magnifier_factor;
|
||||||
else
|
else
|
||||||
height=Menu_Y;
|
height=Menu_Y;
|
||||||
|
|
||||||
Display_zoomed_screen(width,height,Main_image_width,Horizontal_line_buffer);
|
Display_zoomed_screen(width,height,Main.image_width,Horizontal_line_buffer);
|
||||||
|
|
||||||
// Effacement de la partie non-image dans la partie zoomée:
|
// Effacement de la partie non-image dans la partie zoomée:
|
||||||
if (Main_image_width<Main_magnifier_width)
|
if (Main.image_width<Main.magnifier_width)
|
||||||
Block(Main_X_zoom+(Main_image_width*Main_magnifier_factor),0,
|
Block(Main.X_zoom+(Main.image_width*Main.magnifier_factor),0,
|
||||||
(Main_magnifier_width-Main_image_width)*Main_magnifier_factor,
|
(Main.magnifier_width-Main.image_width)*Main.magnifier_factor,
|
||||||
Menu_Y,Main_backups->Pages->Transparent_color);
|
Menu_Y,Main_backups->Pages->Transparent_color);
|
||||||
if (height<Menu_Y)
|
if (height<Menu_Y)
|
||||||
Block(Main_X_zoom,height,width*Main_magnifier_factor,(Menu_Y-height),Main_backups->Pages->Transparent_color);
|
Block(Main.X_zoom,height,width*Main.magnifier_factor,(Menu_Y-height),Main_backups->Pages->Transparent_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---/\/\/\ Affichage des limites /\/\/\---
|
// ---/\/\/\ Affichage des limites /\/\/\---
|
||||||
@ -2691,11 +2691,11 @@ byte Best_color(byte r,byte g,byte b)
|
|||||||
{
|
{
|
||||||
if (!Exclude_color[col])
|
if (!Exclude_color[col])
|
||||||
{
|
{
|
||||||
delta_r=(int)Main_palette[col].R-r;
|
delta_r=(int)Main.palette[col].R-r;
|
||||||
delta_g=(int)Main_palette[col].G-g;
|
delta_g=(int)Main.palette[col].G-g;
|
||||||
delta_b=(int)Main_palette[col].B-b;
|
delta_b=(int)Main.palette[col].B-b;
|
||||||
|
|
||||||
rmean = ( Main_palette[col].R + r ) / 2;
|
rmean = ( Main.palette[col].R + r ) / 2;
|
||||||
|
|
||||||
if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8)))
|
if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8)))
|
||||||
//if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)))
|
//if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)))
|
||||||
@ -2723,13 +2723,13 @@ byte Best_color_nonexcluded(byte red,byte green,byte blue)
|
|||||||
|
|
||||||
for (col=0; col<256; col++)
|
for (col=0; col<256; col++)
|
||||||
{
|
{
|
||||||
delta_r=(int)Main_palette[col].R-red;
|
delta_r=(int)Main.palette[col].R-red;
|
||||||
delta_g=(int)Main_palette[col].G-green;
|
delta_g=(int)Main.palette[col].G-green;
|
||||||
delta_b=(int)Main_palette[col].B-blue;
|
delta_b=(int)Main.palette[col].B-blue;
|
||||||
|
|
||||||
if(delta_r == 0 && delta_g == 0 && delta_b == 0) return col;
|
if(delta_r == 0 && delta_g == 0 && delta_b == 0) return col;
|
||||||
|
|
||||||
rmean = ( Main_palette[col].R + red ) / 2;
|
rmean = ( Main.palette[col].R + red ) / 2;
|
||||||
|
|
||||||
dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8);
|
dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8);
|
||||||
//dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)
|
//dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)
|
||||||
@ -2762,17 +2762,17 @@ byte Best_color_range(byte r, byte g, byte b, byte max)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
diff_c = sqrt(
|
diff_c = sqrt(
|
||||||
(0.26*(Main_palette[col].R-r))*
|
(0.26*(Main.palette[col].R-r))*
|
||||||
(0.26*(Main_palette[col].R-r))+
|
(0.26*(Main.palette[col].R-r))+
|
||||||
(0.55*(Main_palette[col].G-g))*
|
(0.55*(Main.palette[col].G-g))*
|
||||||
(0.55*(Main_palette[col].G-g))+
|
(0.55*(Main.palette[col].G-g))+
|
||||||
(0.19*(Main_palette[col].B-b))*
|
(0.19*(Main.palette[col].B-b))*
|
||||||
(0.19*(Main_palette[col].B-b)));
|
(0.19*(Main.palette[col].B-b)));
|
||||||
// Exact match
|
// Exact match
|
||||||
if (diff_c==0)
|
if (diff_c==0)
|
||||||
return col;
|
return col;
|
||||||
|
|
||||||
bri = sqrt(0.26*Main_palette[col].R*0.26*Main_palette[col].R + 0.55*Main_palette[col].G*0.55*Main_palette[col].G + 0.19*Main_palette[col].B*0.19*Main_palette[col].B);
|
bri = sqrt(0.26*Main.palette[col].R*0.26*Main.palette[col].R + 0.55*Main.palette[col].G*0.55*Main.palette[col].G + 0.19*Main.palette[col].B*0.19*Main.palette[col].B);
|
||||||
diff_b = abs(target_bri-bri);
|
diff_b = abs(target_bri-bri);
|
||||||
|
|
||||||
diff=0.25*(diff_b-diff_c)+diff_c;
|
diff=0.25*(diff_b-diff_c)+diff_c;
|
||||||
@ -2805,17 +2805,17 @@ byte Best_color_perceptual(byte r,byte g,byte b)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
diff_c = sqrt(
|
diff_c = sqrt(
|
||||||
(0.26*(Main_palette[col].R-r))*
|
(0.26*(Main.palette[col].R-r))*
|
||||||
(0.26*(Main_palette[col].R-r))+
|
(0.26*(Main.palette[col].R-r))+
|
||||||
(0.55*(Main_palette[col].G-g))*
|
(0.55*(Main.palette[col].G-g))*
|
||||||
(0.55*(Main_palette[col].G-g))+
|
(0.55*(Main.palette[col].G-g))+
|
||||||
(0.19*(Main_palette[col].B-b))*
|
(0.19*(Main.palette[col].B-b))*
|
||||||
(0.19*(Main_palette[col].B-b)));
|
(0.19*(Main.palette[col].B-b)));
|
||||||
// Exact match
|
// Exact match
|
||||||
if (diff_c==0)
|
if (diff_c==0)
|
||||||
return col;
|
return col;
|
||||||
|
|
||||||
bri = sqrt(0.26*Main_palette[col].R*0.26*Main_palette[col].R + 0.55*Main_palette[col].G*0.55*Main_palette[col].G + 0.19*Main_palette[col].B*0.19*Main_palette[col].B);
|
bri = sqrt(0.26*Main.palette[col].R*0.26*Main.palette[col].R + 0.55*Main.palette[col].G*0.55*Main.palette[col].G + 0.19*Main.palette[col].B*0.19*Main.palette[col].B);
|
||||||
diff_b = abs(target_bri-bri);
|
diff_b = abs(target_bri-bri);
|
||||||
|
|
||||||
diff=0.25*(diff_b-diff_c)+diff_c;
|
diff=0.25*(diff_b-diff_c)+diff_c;
|
||||||
@ -2848,17 +2848,17 @@ byte Best_color_perceptual_except(byte r,byte g,byte b, byte except)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
diff_c = sqrt(
|
diff_c = sqrt(
|
||||||
(0.26*(Main_palette[col].R-r))*
|
(0.26*(Main.palette[col].R-r))*
|
||||||
(0.26*(Main_palette[col].R-r))+
|
(0.26*(Main.palette[col].R-r))+
|
||||||
(0.55*(Main_palette[col].G-g))*
|
(0.55*(Main.palette[col].G-g))*
|
||||||
(0.55*(Main_palette[col].G-g))+
|
(0.55*(Main.palette[col].G-g))+
|
||||||
(0.19*(Main_palette[col].B-b))*
|
(0.19*(Main.palette[col].B-b))*
|
||||||
(0.19*(Main_palette[col].B-b)));
|
(0.19*(Main.palette[col].B-b)));
|
||||||
// Exact match
|
// Exact match
|
||||||
if (diff_c==0)
|
if (diff_c==0)
|
||||||
return col;
|
return col;
|
||||||
|
|
||||||
bri = sqrt(0.26*Main_palette[col].R*0.26*Main_palette[col].R + 0.55*Main_palette[col].G*0.55*Main_palette[col].G + 0.19*Main_palette[col].B*0.19*Main_palette[col].B);
|
bri = sqrt(0.26*Main.palette[col].R*0.26*Main.palette[col].R + 0.55*Main.palette[col].G*0.55*Main.palette[col].G + 0.19*Main.palette[col].B*0.19*Main.palette[col].B);
|
||||||
diff_b = abs(target_bri-bri);
|
diff_b = abs(target_bri-bri);
|
||||||
|
|
||||||
diff=0.25*(diff_b-diff_c)+diff_c;
|
diff=0.25*(diff_b-diff_c)+diff_c;
|
||||||
@ -2955,9 +2955,9 @@ void Remap_screen_after_menu_colors_change(void)
|
|||||||
|
|
||||||
|
|
||||||
static int Diff(int i, int j) {
|
static int Diff(int i, int j) {
|
||||||
int dr = Main_palette[i].R - Main_palette[j].R;
|
int dr = Main.palette[i].R - Main.palette[j].R;
|
||||||
int dg = Main_palette[i].G - Main_palette[j].G;
|
int dg = Main.palette[i].G - Main.palette[j].G;
|
||||||
int db = Main_palette[i].B - Main_palette[j].B;
|
int db = Main.palette[i].B - Main.palette[j].B;
|
||||||
|
|
||||||
return dr*dr + dg*dg + db*db;
|
return dr*dr + dg*dg + db*db;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user