Merge trunk to the cpcmode5 branch. This gets us a more recent grafx2 with the cpcmode5 drawing. Now to make this mode optional so users can still work in regular mode :)
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/cpcmode5@1719 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
58
src/misc.c
58
src/misc.c
@@ -2,6 +2,7 @@
|
||||
*/
|
||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||
|
||||
Copyright 2011 Pawel Góralski
|
||||
Copyright 2008 Yves Rizoud
|
||||
Copyright 2008 Franck Charlet
|
||||
Copyright 2007 Adrien Destugues
|
||||
@@ -177,7 +178,8 @@ void Wait_end_of_click(void)
|
||||
{
|
||||
// On désactive tous les raccourcis clavier
|
||||
|
||||
while(Mouse_K) if(!Get_input()) SDL_Delay(20);
|
||||
while(Mouse_K)
|
||||
Get_input(20);
|
||||
}
|
||||
|
||||
void Clear_current_image_with_stencil(byte color, byte * stencil)
|
||||
@@ -339,7 +341,7 @@ void Rotate_270_deg_lowlevel(byte * source, byte * dest, short width, short heig
|
||||
|
||||
// Replace une couleur par une autre dans un buffer
|
||||
|
||||
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width)
|
||||
void Remap_general_lowlevel(byte * conversion_table,byte * in_buffer, byte *out_buffer,short width,short height,short buffer_width)
|
||||
{
|
||||
int dx,cx;
|
||||
|
||||
@@ -349,17 +351,19 @@ void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,sh
|
||||
// Pour chaque pixel
|
||||
for(cx=width;cx>0;cx--)
|
||||
{
|
||||
*buffer = conversion_table[*buffer];
|
||||
buffer++;
|
||||
*out_buffer = conversion_table[*in_buffer];
|
||||
in_buffer++;
|
||||
out_buffer++;
|
||||
}
|
||||
buffer += buffer_width-width;
|
||||
in_buffer += buffer_width-width;
|
||||
out_buffer += buffer_width-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]; //Adr départ image (ESI)
|
||||
byte* dest=Brush; //Adr dest brosse (EDI)
|
||||
byte* dest=Brush_original_pixels; //Adr dest brosse (EDI)
|
||||
int dx;
|
||||
|
||||
for (dx=Brush_height;dx!=0;dx--)
|
||||
@@ -499,6 +503,22 @@ byte Effect_substractive_colorize(word x,word y,byte color)
|
||||
blue<blue_under?blue:blue_under);
|
||||
}
|
||||
|
||||
byte Effect_alpha_colorize (word x,word y,byte color)
|
||||
{
|
||||
byte color_under = Read_pixel_from_feedback_screen(x,y);
|
||||
byte blue_under=Main_palette[color_under].B;
|
||||
byte green_under=Main_palette[color_under].G;
|
||||
byte red_under=Main_palette[color_under].R;
|
||||
int factor=(Main_palette[color].R*76 +
|
||||
Main_palette[color].G*151 +
|
||||
Main_palette[color].B*28)/255;
|
||||
|
||||
return Best_color(
|
||||
(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].B*factor + blue_under*(255-factor))/255);
|
||||
}
|
||||
|
||||
void Check_timer(void)
|
||||
{
|
||||
if((SDL_GetTicks()/55)-Timer_delay>Timer_start) Timer_state=1;
|
||||
@@ -659,17 +679,6 @@ void Rescale(byte *src_buffer, short src_width, short src_height, byte *dst_buff
|
||||
}
|
||||
}
|
||||
|
||||
void Slider_timer(byte speed)
|
||||
//Boucle d'attente pour faire bouger les scrollbars à une vitesse correcte
|
||||
{
|
||||
Uint32 end;
|
||||
byte original_mouse_k = Mouse_K;
|
||||
end = SDL_GetTicks() + speed*10;
|
||||
do
|
||||
{
|
||||
if (!Get_input()) SDL_Delay(20);
|
||||
} while (Mouse_K == original_mouse_k && SDL_GetTicks()<end);
|
||||
}
|
||||
|
||||
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset)
|
||||
{
|
||||
@@ -732,13 +741,26 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
|
||||
// sysinfo not implemented
|
||||
#elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__)
|
||||
#include <proto/exec.h>
|
||||
#elif defined(__MINT__)
|
||||
#include <mint/osbind.h>
|
||||
#include <mint/sysbind.h>
|
||||
#elif defined(__SKYOS__)
|
||||
#include <skyos/sysinfo.h>
|
||||
#else
|
||||
#include <sys/sysinfo.h> // sysinfo() for free RAM
|
||||
#endif
|
||||
|
||||
#if defined (__MINT__)
|
||||
// atari have two kinds of memory
|
||||
// standard and fast ram
|
||||
void Atari_Memory_free(unsigned long *stRam,unsigned long *ttRam){
|
||||
//TODO: return STRAM/TT-RAM
|
||||
unsigned long mem=0;
|
||||
*stRam=Mxalloc(-1L,0);
|
||||
*ttRam = Mxalloc(-1L,1);
|
||||
|
||||
}
|
||||
#else
|
||||
// Indique quelle est la mémoire disponible
|
||||
unsigned long Memory_free(void)
|
||||
{
|
||||
@@ -778,6 +800,8 @@ unsigned long Memory_free(void)
|
||||
return info.freeram*info.mem_unit;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Arrondir un nombre réel à la valeur entière la plus proche
|
||||
|
||||
Reference in New Issue
Block a user