Add a "tall 3" drawing mode.
Pixels with 3:4 aspect ratio. Why not? Contributed by Nic Soudée (zoner/xylem). Thanks! git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2166 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									d3a4ced94c
								
							
						
					
					
						commit
						8808625851
					
				@ -436,7 +436,7 @@ endif
 | 
			
		||||
.PHONY : all debug release clean depend zip version force install uninstall
 | 
			
		||||
 | 
			
		||||
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
			
		||||
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(OBJDIR)/factory.o $(PLATFORMOBJ) $(OBJDIR)/fileformats.o $(OBJDIR)/miscfileformats.o $(OBJDIR)/libraw2crtc.o $(OBJDIR)/brush_ops.o $(OBJDIR)/buttons_effects.o $(OBJDIR)/layers.o $(OBJDIR)/oldies.o $(OBJDIR)/tiles.o $(OBJDIR)/colorred.o
 | 
			
		||||
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxtall3.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(OBJDIR)/factory.o $(PLATFORMOBJ) $(OBJDIR)/fileformats.o $(OBJDIR)/miscfileformats.o $(OBJDIR)/libraw2crtc.o $(OBJDIR)/brush_ops.o $(OBJDIR)/buttons_effects.o $(OBJDIR)/layers.o $(OBJDIR)/oldies.o $(OBJDIR)/tiles.o $(OBJDIR)/colorred.o
 | 
			
		||||
 | 
			
		||||
SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png ../share/grafx2/skins/skin_Aurora.png
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -30,8 +30,8 @@ $(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \
 | 
			
		||||
 help.h filesel.h
 | 
			
		||||
$(OBJDIR)/graph.o: graph.c global.h struct.h const.h engine.h buttons.h pages.h \
 | 
			
		||||
 errors.h sdlscreen.h graph.h misc.h pxsimple.h pxtall.h pxwide.h \
 | 
			
		||||
 pxdouble.h pxtriple.h pxwide2.h pxtall2.h pxquad.h windows.h input.h \
 | 
			
		||||
 brush.h tiles.h
 | 
			
		||||
 pxdouble.h pxtriple.h pxwide2.h pxtall2.h pxtall3.h pxquad.h windows.h \
 | 
			
		||||
 input.h brush.h tiles.h
 | 
			
		||||
$(OBJDIR)/help.o: help.c const.h struct.h global.h misc.h engine.h helpfile.h \
 | 
			
		||||
 help.h sdlscreen.h text.h keyboard.h windows.h input.h hotkeys.h \
 | 
			
		||||
 errors.h pages.h factory.h
 | 
			
		||||
@ -83,6 +83,8 @@ $(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h misc.h graph.
 | 
			
		||||
 pxtall.h pxsimple.h
 | 
			
		||||
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
 | 
			
		||||
 pxtall2.h
 | 
			
		||||
$(OBJDIR)/pxtall3.o: pxtall3.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
 | 
			
		||||
 pxtall3.h
 | 
			
		||||
$(OBJDIR)/pxtriple.o: pxtriple.c global.h struct.h const.h sdlscreen.h misc.h \
 | 
			
		||||
 graph.h pxtriple.h
 | 
			
		||||
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
 | 
			
		||||
 | 
			
		||||
@ -1957,6 +1957,7 @@ void Button_Resolution(void)
 | 
			
		||||
    "Triple    (3x3)",
 | 
			
		||||
    "Wide2     (4x2)",
 | 
			
		||||
    "Tall2     (2x4)",
 | 
			
		||||
    "Tall3     (3x4)",
 | 
			
		||||
    "Quadruple (4x4)"};
 | 
			
		||||
 | 
			
		||||
  Open_window(299,190,"Picture & screen sizes");
 | 
			
		||||
@ -3255,7 +3256,8 @@ void Load_picture(byte image)
 | 
			
		||||
          ((context.Ratio == PIXEL_WIDE &&
 | 
			
		||||
            Pixel_ratio != PIXEL_WIDE && Pixel_ratio != PIXEL_WIDE2) ||
 | 
			
		||||
            (context.Ratio == PIXEL_TALL &&
 | 
			
		||||
            Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2)))
 | 
			
		||||
            Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2 &&
 | 
			
		||||
            Pixel_ratio != PIXEL_TALL3)))
 | 
			
		||||
        {
 | 
			
		||||
          Init_mode_video(
 | 
			
		||||
            Video_mode[Current_resolution].Width,
 | 
			
		||||
@ -3357,7 +3359,8 @@ void Button_Reload(void)
 | 
			
		||||
        ((context.Ratio == PIXEL_WIDE &&
 | 
			
		||||
          Pixel_ratio != PIXEL_WIDE && Pixel_ratio != PIXEL_WIDE2) ||
 | 
			
		||||
          (context.Ratio == PIXEL_TALL &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2)))
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2 &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL3)))
 | 
			
		||||
      {
 | 
			
		||||
        Init_mode_video(
 | 
			
		||||
          Video_mode[Current_resolution].Width,
 | 
			
		||||
 | 
			
		||||
@ -173,6 +173,7 @@ enum PIXEL_RATIO
 | 
			
		||||
    PIXEL_TRIPLE,   ///< Use really big pixels (3x3)
 | 
			
		||||
    PIXEL_WIDE2,    ///< Use big wide pixels (4x2)
 | 
			
		||||
    PIXEL_TALL2,    ///< Use big tall pixels (2x4)
 | 
			
		||||
    PIXEL_TALL3,    ///< Use big tall pixels (3x4)
 | 
			
		||||
    PIXEL_QUAD,     ///< Use really giant pixels (4x4). You need to have a screen resolution at least 1280x800 to use this one
 | 
			
		||||
    PIXEL_MAX       ///< Number of elements in enum
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -4275,6 +4275,7 @@ void Save_PNG(T_IO_Context * context)
 | 
			
		||||
              break;
 | 
			
		||||
            case PIXEL_TALL:
 | 
			
		||||
            case PIXEL_TALL2:
 | 
			
		||||
            case PIXEL_TALL3:
 | 
			
		||||
              png_set_pHYs(png_ptr, info_ptr, 6000, 3000, PNG_RESOLUTION_METER);
 | 
			
		||||
              break;
 | 
			
		||||
            default:
 | 
			
		||||
 | 
			
		||||
@ -45,6 +45,7 @@
 | 
			
		||||
#include "pxtriple.h"
 | 
			
		||||
#include "pxwide2.h"
 | 
			
		||||
#include "pxtall2.h"
 | 
			
		||||
#include "pxtall3.h"
 | 
			
		||||
#include "pxquad.h"
 | 
			
		||||
#include "windows.h"
 | 
			
		||||
#include "input.h"
 | 
			
		||||
@ -261,6 +262,10 @@ try_again:
 | 
			
		||||
          pix_width=2;
 | 
			
		||||
          pix_height=4;
 | 
			
		||||
      break;
 | 
			
		||||
      case PIXEL_TALL3:
 | 
			
		||||
          pix_width=3;
 | 
			
		||||
          pix_height=4;
 | 
			
		||||
      break;
 | 
			
		||||
      case PIXEL_QUAD:
 | 
			
		||||
          pix_width=4;
 | 
			
		||||
          pix_height=4;
 | 
			
		||||
@ -378,6 +383,9 @@ try_again:
 | 
			
		||||
        case PIXEL_TALL2:
 | 
			
		||||
			SETPIXEL(tall2)
 | 
			
		||||
        break;
 | 
			
		||||
        case PIXEL_TALL3:
 | 
			
		||||
			SETPIXEL(tall3)
 | 
			
		||||
        break;
 | 
			
		||||
        case PIXEL_QUAD:
 | 
			
		||||
			SETPIXEL(quad)
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
@ -235,7 +235,8 @@ void Set_pixel(T_IO_Context *context, short x_pos, short y_pos, byte color)
 | 
			
		||||
        }
 | 
			
		||||
        else if (context->Ratio == PIXEL_TALL && 
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2)
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2 &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL3)
 | 
			
		||||
        {
 | 
			
		||||
          context->Preview_bitmap[x_pos/context->Preview_factor_X + (y_pos/context->Preview_factor_Y*2)*PREVIEW_WIDTH*Menu_factor_X]=color;
 | 
			
		||||
          context->Preview_bitmap[x_pos/context->Preview_factor_X + (y_pos/context->Preview_factor_Y*2+1)*PREVIEW_WIDTH*Menu_factor_X]=color;
 | 
			
		||||
@ -437,7 +438,8 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
 | 
			
		||||
        width*=2;
 | 
			
		||||
      else if (ratio == PIXEL_TALL && 
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2)
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2 &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL3)
 | 
			
		||||
        height*=2;
 | 
			
		||||
      
 | 
			
		||||
      context->Preview_factor_X=Round_div_max(width,120*Menu_factor_X);
 | 
			
		||||
@ -920,7 +922,8 @@ void Load_image(T_IO_Context *context)
 | 
			
		||||
        width*=2;
 | 
			
		||||
      else if (context->Ratio == PIXEL_TALL && 
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2)
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL2 &&
 | 
			
		||||
          Pixel_ratio != PIXEL_TALL3)
 | 
			
		||||
        height*=2;
 | 
			
		||||
      
 | 
			
		||||
      for (y_pos=0; y_pos<height;y_pos++)
 | 
			
		||||
@ -1279,7 +1282,7 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
 | 
			
		||||
  context->Background_transparent=Main_backups->Pages->Background_transparent;
 | 
			
		||||
  if (Pixel_ratio == PIXEL_WIDE || Pixel_ratio == PIXEL_WIDE2)
 | 
			
		||||
    context->Ratio=PIXEL_WIDE;
 | 
			
		||||
  else if (Pixel_ratio == PIXEL_TALL || Pixel_ratio == PIXEL_TALL2)
 | 
			
		||||
  else if (Pixel_ratio == PIXEL_TALL || Pixel_ratio == PIXEL_TALL2 || Pixel_ratio == PIXEL_TALL3)
 | 
			
		||||
    context->Ratio=PIXEL_TALL;
 | 
			
		||||
  else
 | 
			
		||||
    context->Ratio=PIXEL_SIMPLE;
 | 
			
		||||
 | 
			
		||||
@ -205,6 +205,7 @@ enum CMD_PARAMS
 | 
			
		||||
    CMDPARAM_PIXELRATIO_TRIPLE,
 | 
			
		||||
    CMDPARAM_PIXELRATIO_QUAD,
 | 
			
		||||
    CMDPARAM_PIXELRATIO_TALL2,
 | 
			
		||||
    CMDPARAM_PIXELRATIO_TALL3,
 | 
			
		||||
    CMDPARAM_PIXELRATIO_WIDE2,
 | 
			
		||||
    CMDPARAM_RGB,
 | 
			
		||||
    CMDPARAM_SKIN
 | 
			
		||||
@ -225,6 +226,7 @@ struct {
 | 
			
		||||
    {"triple", CMDPARAM_PIXELRATIO_TRIPLE},
 | 
			
		||||
    {"quadruple", CMDPARAM_PIXELRATIO_QUAD},
 | 
			
		||||
    {"tall2", CMDPARAM_PIXELRATIO_TALL2},
 | 
			
		||||
    {"tall3", CMDPARAM_PIXELRATIO_TALL3},
 | 
			
		||||
    {"wide2", CMDPARAM_PIXELRATIO_WIDE2},
 | 
			
		||||
    {"rgb", CMDPARAM_RGB},
 | 
			
		||||
    {"skin", CMDPARAM_SKIN}
 | 
			
		||||
@ -328,6 +330,9 @@ int Analyze_command_line(int argc, char * argv[], char *main_filename, char *mai
 | 
			
		||||
      case CMDPARAM_PIXELRATIO_TALL2:
 | 
			
		||||
        Pixel_ratio = PIXEL_TALL2;
 | 
			
		||||
        break;
 | 
			
		||||
      case CMDPARAM_PIXELRATIO_TALL3:
 | 
			
		||||
        Pixel_ratio = PIXEL_TALL3;
 | 
			
		||||
        break;
 | 
			
		||||
      case CMDPARAM_PIXELRATIO_WIDE2:
 | 
			
		||||
        Pixel_ratio = PIXEL_WIDE2;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
@ -3261,6 +3261,7 @@ void Save_SCR(T_IO_Context * context)
 | 
			
		||||
            break;
 | 
			
		||||
        case PIXEL_TALL:
 | 
			
		||||
        case PIXEL_TALL2:
 | 
			
		||||
        case PIXEL_TALL3:
 | 
			
		||||
            cpc_mode = 2;
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										542
									
								
								src/pxtall3.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										542
									
								
								src/pxtall3.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,542 @@
 | 
			
		||||
/* vim:expandtab:ts=2 sw=2:
 | 
			
		||||
*/
 | 
			
		||||
/*  Grafx2 - The Ultimate 256-color bitmap paint program
 | 
			
		||||
 | 
			
		||||
    Copyright 2008 Yves Rizoud
 | 
			
		||||
    Copyright 2008 Franck Charlet
 | 
			
		||||
    Copyright 2007 Adrien Destugues
 | 
			
		||||
    Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
 | 
			
		||||
 | 
			
		||||
    Grafx2 is free software; you can redistribute it and/or
 | 
			
		||||
    modify it under the terms of the GNU General Public License
 | 
			
		||||
    as published by the Free Software Foundation; version 2
 | 
			
		||||
    of the License.
 | 
			
		||||
 | 
			
		||||
    Grafx2 is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
    GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU General Public License
 | 
			
		||||
    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <SDL.h>
 | 
			
		||||
#include "global.h"
 | 
			
		||||
#include "sdlscreen.h"
 | 
			
		||||
#include "misc.h"
 | 
			
		||||
#include "graph.h"
 | 
			
		||||
#include "pxtall3.h"
 | 
			
		||||
 | 
			
		||||
#define ZOOMX 3
 | 
			
		||||
#define ZOOMY 4
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void Pixel_tall3 (word x,word y,byte color)
 | 
			
		||||
/* Affiche un pixel de la color aux coords x;y à l'écran */
 | 
			
		||||
{
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + y*ZOOMY * VIDEO_LINE_WIDTH)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + y*ZOOMY * VIDEO_LINE_WIDTH + 1)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + y*ZOOMY * VIDEO_LINE_WIDTH + 2)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+1) * VIDEO_LINE_WIDTH)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+1) * VIDEO_LINE_WIDTH + 1)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+1) * VIDEO_LINE_WIDTH + 2)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+2) * VIDEO_LINE_WIDTH)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+2) * VIDEO_LINE_WIDTH + 1)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+2) * VIDEO_LINE_WIDTH + 2)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+3) * VIDEO_LINE_WIDTH)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+3) * VIDEO_LINE_WIDTH + 1)=color;
 | 
			
		||||
  *(Screen_pixels + x * ZOOMX + (y*ZOOMY+3) * VIDEO_LINE_WIDTH + 2)=color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
byte Read_pixel_tall3 (word x,word y)
 | 
			
		||||
/* On retourne la couleur du pixel aux coords données */
 | 
			
		||||
{
 | 
			
		||||
  return *( Screen_pixels + y * ZOOMY * VIDEO_LINE_WIDTH + x * ZOOMX);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Block_tall3 (word start_x,word start_y,word width,word height,byte color)
 | 
			
		||||
/* On affiche un rectangle de la couleur donnée */
 | 
			
		||||
{
 | 
			
		||||
  SDL_Rect rectangle;
 | 
			
		||||
  rectangle.x=start_x*ZOOMX;
 | 
			
		||||
  rectangle.y=start_y*ZOOMY;
 | 
			
		||||
  rectangle.w=width*ZOOMX;
 | 
			
		||||
  rectangle.h=height*ZOOMY;
 | 
			
		||||
  SDL_FillRect(Screen_SDL,&rectangle,color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_part_of_screen_tall3 (word width,word height,word image_width)
 | 
			
		||||
/* 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* src=Main_offset_Y*image_width+Main_offset_X+Main_screen; //Coords de départ ds la source (src)
 | 
			
		||||
  int y;
 | 
			
		||||
  int dy;
 | 
			
		||||
 | 
			
		||||
  for(y=height;y!=0;y--)
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  {
 | 
			
		||||
    // On fait une copie de la ligne
 | 
			
		||||
    for (dy=width;dy>0;dy--)
 | 
			
		||||
    {
 | 
			
		||||
      *(dest+2)=*(dest+1)=*dest=*src;
 | 
			
		||||
      src++;
 | 
			
		||||
      dest+=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
    // On double la ligne qu'on vient de copier
 | 
			
		||||
    memcpy(dest-width*ZOOMX+VIDEO_LINE_WIDTH,dest-width*ZOOMX,width*ZOOMX);
 | 
			
		||||
    // On la triple
 | 
			
		||||
    memcpy(dest-width*ZOOMX+2*VIDEO_LINE_WIDTH,dest-width*ZOOMX,width*ZOOMX);
 | 
			
		||||
    // On la quadruple
 | 
			
		||||
    memcpy(dest-width*ZOOMX+3*VIDEO_LINE_WIDTH,dest-width*ZOOMX,width*ZOOMX);
 | 
			
		||||
 | 
			
		||||
    // On passe à la ligne suivante
 | 
			
		||||
    src+=image_width-width;
 | 
			
		||||
    dest+=VIDEO_LINE_WIDTH*ZOOMY - width*ZOOMX;
 | 
			
		||||
  }
 | 
			
		||||
  //Update_rect(0,0,width,height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pixel_preview_normal_tall3 (word x,word y,byte color)
 | 
			
		||||
/* Affichage d'un pixel dans l'écran, par rapport au décalage de l'image 
 | 
			
		||||
 * dans l'écran, en mode normal (pas en mode loupe)
 | 
			
		||||
 * Note: si on modifie cette procédure, il faudra penser à faire également 
 | 
			
		||||
 * la modif dans la procédure Pixel_Preview_Loupe_SDL. */
 | 
			
		||||
{
 | 
			
		||||
//  if(x-Main_offset_X >= 0 && y - Main_offset_Y >= 0)
 | 
			
		||||
  Pixel_tall3(x-Main_offset_X,y-Main_offset_Y,color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pixel_preview_magnifier_tall3  (word x,word y,byte color)
 | 
			
		||||
{
 | 
			
		||||
  // Affiche le pixel dans la partie non zoomée
 | 
			
		||||
  Pixel_tall3(x-Main_offset_X,y-Main_offset_Y,color);
 | 
			
		||||
  
 | 
			
		||||
  // Regarde si on doit aussi l'afficher dans la partie zoomée
 | 
			
		||||
  if (y >= Limit_top_zoom && y <= Limit_visible_bottom_zoom
 | 
			
		||||
          && x >= Limit_left_zoom && x <= Limit_visible_right_zoom)
 | 
			
		||||
  {
 | 
			
		||||
    // On est dedans
 | 
			
		||||
    int height;
 | 
			
		||||
    int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
 | 
			
		||||
 | 
			
		||||
    if (Menu_Y - y_zoom < Main_magnifier_factor)
 | 
			
		||||
      // On ne doit dessiner qu'un morceau du pixel
 | 
			
		||||
      // sinon on dépasse sur le menu
 | 
			
		||||
      height = Menu_Y - y_zoom;
 | 
			
		||||
    else
 | 
			
		||||
      height = Main_magnifier_factor;
 | 
			
		||||
 | 
			
		||||
    Block_tall3(
 | 
			
		||||
      Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom, 
 | 
			
		||||
      y_zoom, Main_magnifier_factor, height, color
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Horizontal_XOR_line_tall3(word x_pos,word y_pos,word width)
 | 
			
		||||
{
 | 
			
		||||
  //On calcule la valeur initiale de dest:
 | 
			
		||||
  byte* dest=y_pos*ZOOMY*VIDEO_LINE_WIDTH+x_pos*ZOOMX+Screen_pixels;
 | 
			
		||||
 | 
			
		||||
  int x;
 | 
			
		||||
 | 
			
		||||
  for (x=0;x<width*ZOOMX;x+=ZOOMX)
 | 
			
		||||
    *(dest+x+3*VIDEO_LINE_WIDTH+2)=*(dest+x+3*VIDEO_LINE_WIDTH+1)=*(dest+x+3*VIDEO_LINE_WIDTH)=*(dest+x+2*VIDEO_LINE_WIDTH+2)=*(dest+x+2*VIDEO_LINE_WIDTH+1)=*(dest+x+2*VIDEO_LINE_WIDTH)=*(dest+x+VIDEO_LINE_WIDTH+2)=*(dest+x+VIDEO_LINE_WIDTH+1)=*(dest+x+VIDEO_LINE_WIDTH)=*(dest+x+1)=*(dest+x)=xor_lut[*(dest+x)];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Vertical_XOR_line_tall3(word x_pos,word y_pos,word height)
 | 
			
		||||
{
 | 
			
		||||
  int i;
 | 
			
		||||
  byte *dest=Screen_pixels+x_pos*ZOOMX+y_pos*VIDEO_LINE_WIDTH*ZOOMY;
 | 
			
		||||
  for (i=height;i>0;i--)
 | 
			
		||||
  {
 | 
			
		||||
    *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=xor_lut[*(dest)];
 | 
			
		||||
    dest+=VIDEO_LINE_WIDTH*ZOOMY;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_brush_color_tall3(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
 | 
			
		||||
{
 | 
			
		||||
  // dest = Position à l'écran
 | 
			
		||||
  byte* dest = Screen_pixels + y_pos * ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
 | 
			
		||||
  // src = Position dans la brosse
 | 
			
		||||
  byte* src = Brush + y_offset * brush_width + x_offset;
 | 
			
		||||
 | 
			
		||||
  word x,y;
 | 
			
		||||
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  for(y = height;y > 0; y--)
 | 
			
		||||
  {
 | 
			
		||||
    // Pour chaque pixel
 | 
			
		||||
    for(x = width;x > 0; x--)
 | 
			
		||||
    {
 | 
			
		||||
      // On vérifie que ce n'est pas la transparence
 | 
			
		||||
      if(*src != transp_color)
 | 
			
		||||
      {
 | 
			
		||||
        *(dest+3*VIDEO_LINE_WIDTH+2) =*(dest+3*VIDEO_LINE_WIDTH+1) = *(dest+3*VIDEO_LINE_WIDTH) = *(dest+2*VIDEO_LINE_WIDTH+2) =*(dest+2*VIDEO_LINE_WIDTH+1) = *(dest+2*VIDEO_LINE_WIDTH) = *(dest+VIDEO_LINE_WIDTH+2) =*(dest+VIDEO_LINE_WIDTH+1) = *(dest+VIDEO_LINE_WIDTH) = *(dest+2) =*(dest+1) = *dest = *src;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Pixel suivant
 | 
			
		||||
      src++;
 | 
			
		||||
      dest+=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // On passe à la ligne suivante
 | 
			
		||||
    dest = dest + VIDEO_LINE_WIDTH*ZOOMY - width*ZOOMX;
 | 
			
		||||
    src = src + brush_width - width;
 | 
			
		||||
  }
 | 
			
		||||
  Update_rect(x_pos,y_pos,width,height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_brush_mono_tall3(word x_pos, word y_pos,
 | 
			
		||||
        word x_offset, word y_offset, word width, word height,
 | 
			
		||||
        byte transp_color, byte color, word brush_width)
 | 
			
		||||
/* On affiche la brosse en monochrome */
 | 
			
		||||
{
 | 
			
		||||
  byte* dest=y_pos*ZOOMY*VIDEO_LINE_WIDTH+x_pos*ZOOMX+Screen_pixels; // dest = adr destination à 
 | 
			
		||||
      // l'écran
 | 
			
		||||
  byte* src=brush_width*y_offset+x_offset+Brush; // src = adr ds 
 | 
			
		||||
      // la brosse
 | 
			
		||||
  int x,y;
 | 
			
		||||
 | 
			
		||||
  for(y=height;y!=0;y--)
 | 
			
		||||
  //Pour chaque ligne
 | 
			
		||||
  {
 | 
			
		||||
    for(x=width;x!=0;x--)
 | 
			
		||||
    //Pour chaque pixel
 | 
			
		||||
    {
 | 
			
		||||
      if (*src!=transp_color)
 | 
			
		||||
        *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=color;
 | 
			
		||||
 | 
			
		||||
      // On passe au pixel suivant
 | 
			
		||||
      src++;
 | 
			
		||||
      dest+=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // On passe à la ligne suivante
 | 
			
		||||
    src+=brush_width-width;
 | 
			
		||||
    dest+=VIDEO_LINE_WIDTH*ZOOMY-width*ZOOMX;
 | 
			
		||||
  }
 | 
			
		||||
  Update_rect(x_pos,y_pos,width,height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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* 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 x;
 | 
			
		||||
  (void)x_offset; // unused
 | 
			
		||||
  (void)y_offset; // unused
 | 
			
		||||
  (void)transp_color; // unused
 | 
			
		||||
 | 
			
		||||
  for(y=height;y!=0;y--)
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  {
 | 
			
		||||
    for(x=width;x!=0;x--)
 | 
			
		||||
    //Pour chaque pixel
 | 
			
		||||
    {
 | 
			
		||||
      *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=*src;
 | 
			
		||||
 | 
			
		||||
      // On passe au pixel suivant
 | 
			
		||||
      src++;
 | 
			
		||||
      dest+=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // On passe à la ligne suivante
 | 
			
		||||
    src+=image_width-width;
 | 
			
		||||
    dest+=VIDEO_LINE_WIDTH*ZOOMY-width*ZOOMX;
 | 
			
		||||
  }
 | 
			
		||||
  Update_rect(x_pos,y_pos,width,height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Affiche une brosse (arbitraire) à l'écran
 | 
			
		||||
void Display_brush_tall3(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width)
 | 
			
		||||
{
 | 
			
		||||
  // dest = Position à l'écran
 | 
			
		||||
  byte* dest = Screen_pixels + y_pos * ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
 | 
			
		||||
  // src = Position dans la brosse
 | 
			
		||||
  byte* src = brush + y_offset * brush_width + x_offset;
 | 
			
		||||
  
 | 
			
		||||
  word x,y;
 | 
			
		||||
  
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  for(y = height;y > 0; y--)
 | 
			
		||||
  {
 | 
			
		||||
    // Pour chaque pixel
 | 
			
		||||
    for(x = width;x > 0; x--)
 | 
			
		||||
    {
 | 
			
		||||
      // On vérifie que ce n'est pas la transparence
 | 
			
		||||
      if(*src != transp_color)
 | 
			
		||||
      {
 | 
			
		||||
        *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=*src;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Pixel suivant
 | 
			
		||||
      src++; dest+=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // On passe à la ligne suivante
 | 
			
		||||
    dest = dest + VIDEO_LINE_WIDTH*ZOOMY - width*ZOOMX;
 | 
			
		||||
    src = src + brush_width - width;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Remap_screen_tall3(word x_pos,word y_pos,word width,word height,byte * conversion_table)
 | 
			
		||||
{
 | 
			
		||||
  // dest = coords a l'écran
 | 
			
		||||
  byte* dest = Screen_pixels + y_pos * ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
 | 
			
		||||
  int x,y;
 | 
			
		||||
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  for(y=height;y>0;y--)
 | 
			
		||||
  {
 | 
			
		||||
    // Pour chaque pixel
 | 
			
		||||
    for(x=width;x>0;x--)
 | 
			
		||||
    {
 | 
			
		||||
        *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=
 | 
			
		||||
        conversion_table[*dest];
 | 
			
		||||
      dest +=ZOOMX;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dest = dest + VIDEO_LINE_WIDTH*ZOOMY - width*ZOOMX;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Update_rect(x_pos,y_pos,width,height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_line_on_screen_fast_tall3(word x_pos,word y_pos,word width,byte * line)
 | 
			
		||||
/* On affiche toute une ligne de pixels telle quelle. */
 | 
			
		||||
/* Utilisée si le buffer contient déja des pixel doublés. */
 | 
			
		||||
{
 | 
			
		||||
  memcpy(Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH,line,width*ZOOMX);
 | 
			
		||||
  memcpy(Screen_pixels+x_pos*ZOOMX+(y_pos*ZOOMY+1)*VIDEO_LINE_WIDTH,line,width*ZOOMX);
 | 
			
		||||
  memcpy(Screen_pixels+x_pos*ZOOMX+(y_pos*ZOOMY+2)*VIDEO_LINE_WIDTH,line,width*ZOOMX);
 | 
			
		||||
  memcpy(Screen_pixels+x_pos*ZOOMX+(y_pos*ZOOMY+3)*VIDEO_LINE_WIDTH,line,width*ZOOMX);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_line_on_screen_tall3(word x_pos,word y_pos,word width,byte * line)
 | 
			
		||||
/* On affiche une ligne de pixels en les doublant. */
 | 
			
		||||
{
 | 
			
		||||
  int x;
 | 
			
		||||
  byte *dest;
 | 
			
		||||
  dest=Screen_pixels+x_pos*ZOOMX+y_pos*ZOOMY*VIDEO_LINE_WIDTH;
 | 
			
		||||
  for(x=width;x>0;x--)
 | 
			
		||||
  {
 | 
			
		||||
    *(dest+3*VIDEO_LINE_WIDTH+2)=*(dest+3*VIDEO_LINE_WIDTH+1)=*(dest+3*VIDEO_LINE_WIDTH)=*(dest+2*VIDEO_LINE_WIDTH+2)=*(dest+2*VIDEO_LINE_WIDTH+1)=*(dest+2*VIDEO_LINE_WIDTH)=*(dest+VIDEO_LINE_WIDTH+2)=*(dest+VIDEO_LINE_WIDTH+1)=*(dest+VIDEO_LINE_WIDTH)=*(dest+2)=*(dest+1)=*(dest)=*line;
 | 
			
		||||
    dest+=ZOOMX;
 | 
			
		||||
    line++;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
void Display_transparent_mono_line_on_screen_tall3(
 | 
			
		||||
        word x_pos, word y_pos, word width, byte* line, 
 | 
			
		||||
        byte transp_color, byte color)
 | 
			
		||||
// Affiche une ligne à l'écran avec une couleur + transparence.
 | 
			
		||||
// Utilisé par les brosses en mode zoom
 | 
			
		||||
{
 | 
			
		||||
  byte* dest = Screen_pixels+ y_pos*VIDEO_LINE_WIDTH + x_pos*ZOOMX;
 | 
			
		||||
  int x;
 | 
			
		||||
  // Pour chaque pixel
 | 
			
		||||
  for(x=0;x<width;x++)
 | 
			
		||||
  {
 | 
			
		||||
    if (transp_color!=*line)
 | 
			
		||||
    {
 | 
			
		||||
      *(dest+2)=*(dest+1)=*dest=color;
 | 
			
		||||
    }
 | 
			
		||||
    line ++; // Pixel suivant
 | 
			
		||||
    dest+=ZOOMX;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Read_line_screen_tall3(word x_pos,word y_pos,word width,byte * line)
 | 
			
		||||
{
 | 
			
		||||
  memcpy(line,VIDEO_LINE_WIDTH*ZOOMY * y_pos + x_pos * ZOOMX + Screen_pixels,width*ZOOMX);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_part_of_screen_scaled_tall3(
 | 
			
		||||
        word width, // width non zoomée
 | 
			
		||||
        word height, // height zoomée
 | 
			
		||||
        word image_width,byte * buffer)
 | 
			
		||||
{
 | 
			
		||||
  byte* src = Main_screen + Main_magnifier_offset_Y * image_width 
 | 
			
		||||
                      + Main_magnifier_offset_X;
 | 
			
		||||
  int y = 0; // Ligne en cours de traitement
 | 
			
		||||
 | 
			
		||||
  // Pour chaque ligne à zoomer
 | 
			
		||||
  while(1)
 | 
			
		||||
  {
 | 
			
		||||
    int x;
 | 
			
		||||
    
 | 
			
		||||
    // On éclate la ligne
 | 
			
		||||
    Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
 | 
			
		||||
    // On l'affiche Facteur fois, sur des lignes consécutives
 | 
			
		||||
    x = Main_magnifier_factor/**ZOOMY*/;
 | 
			
		||||
    // Pour chaque ligne
 | 
			
		||||
    do{
 | 
			
		||||
      // On affiche la ligne zoomée
 | 
			
		||||
      Display_line_on_screen_fast_tall3(
 | 
			
		||||
        Main_X_zoom, y, width*Main_magnifier_factor,
 | 
			
		||||
        buffer
 | 
			
		||||
      );
 | 
			
		||||
      // On passe à la suivante
 | 
			
		||||
      y++;
 | 
			
		||||
      if(y==height/**ZOOMY*/)
 | 
			
		||||
      {
 | 
			
		||||
        Redraw_grid(Main_X_zoom,0,
 | 
			
		||||
          width*Main_magnifier_factor,height);
 | 
			
		||||
        Update_rect(Main_X_zoom,0,
 | 
			
		||||
          width*Main_magnifier_factor,height);
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      x--;
 | 
			
		||||
    }while (x > 0);
 | 
			
		||||
    src += image_width;
 | 
			
		||||
  }
 | 
			
		||||
// ATTENTION on n'arrive jamais ici !
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Affiche une partie de la brosse couleur zoomée
 | 
			
		||||
void Display_brush_color_zoom_tall3(word x_pos,word y_pos,
 | 
			
		||||
        word x_offset,word y_offset,
 | 
			
		||||
        word width, // width non zoomée
 | 
			
		||||
        word end_y_pos,byte transp_color,
 | 
			
		||||
        word brush_width, // width réelle de la brosse
 | 
			
		||||
        byte * buffer)
 | 
			
		||||
{
 | 
			
		||||
  byte* src = Brush+y_offset*brush_width + x_offset;
 | 
			
		||||
  word y = y_pos;
 | 
			
		||||
  byte bx;
 | 
			
		||||
 | 
			
		||||
  // Pour chaque ligne
 | 
			
		||||
  while(1)
 | 
			
		||||
  {
 | 
			
		||||
    Zoom_a_line(src,buffer,Main_magnifier_factor,width);
 | 
			
		||||
    // On affiche facteur fois la ligne zoomée
 | 
			
		||||
    for(bx=Main_magnifier_factor;bx>0;bx--)
 | 
			
		||||
    {
 | 
			
		||||
      byte* line_src = buffer;
 | 
			
		||||
      byte* dest = Screen_pixels + y*ZOOMY * VIDEO_LINE_WIDTH + x_pos * ZOOMX;
 | 
			
		||||
      word x;
 | 
			
		||||
      // Pour chaque pixel de la ligne
 | 
			
		||||
      for(x = width*Main_magnifier_factor;x > 0;x--)
 | 
			
		||||
      {
 | 
			
		||||
        if(*line_src!=transp_color)
 | 
			
		||||
        {
 | 
			
		||||
          *(dest+2)=*(dest+1)=*dest = *line_src;
 | 
			
		||||
        }
 | 
			
		||||
        line_src++;
 | 
			
		||||
        dest+=ZOOMX;
 | 
			
		||||
      }
 | 
			
		||||
      // 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);
 | 
			
		||||
      // 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);
 | 
			
		||||
      // 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);
 | 
			
		||||
      y++;
 | 
			
		||||
      if(y==end_y_pos)
 | 
			
		||||
      {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    src += brush_width;
 | 
			
		||||
  }
 | 
			
		||||
  // ATTENTION zone jamais atteinte
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Display_brush_mono_zoom_tall3(word x_pos, word y_pos,
 | 
			
		||||
        word x_offset, word y_offset, 
 | 
			
		||||
        word width, // width non zoomée 
 | 
			
		||||
        word end_y_pos,
 | 
			
		||||
        byte transp_color, byte color, 
 | 
			
		||||
        word brush_width, // width réelle de la brosse
 | 
			
		||||
        byte * buffer
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  byte* src = Brush + y_offset * brush_width + x_offset;
 | 
			
		||||
  int y=y_pos*ZOOMY;
 | 
			
		||||
 | 
			
		||||
  //Pour chaque ligne à zoomer :
 | 
			
		||||
  while(1)
 | 
			
		||||
  {
 | 
			
		||||
    int bx;
 | 
			
		||||
    // src = Ligne originale
 | 
			
		||||
    // On éclate la ligne
 | 
			
		||||
    Zoom_a_line(src,buffer,Main_magnifier_factor,width);
 | 
			
		||||
 | 
			
		||||
    // On affiche la ligne Facteur fois à l'écran (sur des
 | 
			
		||||
    // lignes consécutives)
 | 
			
		||||
    bx = Main_magnifier_factor*ZOOMY;
 | 
			
		||||
 | 
			
		||||
    // Pour chaque ligne écran
 | 
			
		||||
    do
 | 
			
		||||
    {
 | 
			
		||||
      // On affiche la ligne zoomée
 | 
			
		||||
      Display_transparent_mono_line_on_screen_tall3(
 | 
			
		||||
        x_pos, y, width * Main_magnifier_factor, 
 | 
			
		||||
        buffer, transp_color, color
 | 
			
		||||
      );
 | 
			
		||||
      // On passe à la ligne suivante
 | 
			
		||||
      y++;
 | 
			
		||||
      // On vérifie qu'on est pas à la ligne finale
 | 
			
		||||
      if(y == end_y_pos*ZOOMY)
 | 
			
		||||
      {
 | 
			
		||||
        Redraw_grid( x_pos, y_pos,
 | 
			
		||||
          width * Main_magnifier_factor, end_y_pos - y_pos );
 | 
			
		||||
        Update_rect( x_pos, y_pos,
 | 
			
		||||
          width * Main_magnifier_factor, end_y_pos - y_pos );
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      bx --;
 | 
			
		||||
    }
 | 
			
		||||
    while (bx > 0);
 | 
			
		||||
    
 | 
			
		||||
    // Passage à la ligne suivante dans la brosse aussi
 | 
			
		||||
    src+=brush_width;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Clear_brush_scaled_tall3(word x_pos,word y_pos,word x_offset,word y_offset,word width,word end_y_pos,byte transp_color,word image_width,byte * buffer)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  // En fait on va recopier l'image non zoomée dans la partie zoomée !
 | 
			
		||||
  byte* src = Main_screen + y_offset * image_width + x_offset;
 | 
			
		||||
  int y = y_pos;
 | 
			
		||||
  int bx;
 | 
			
		||||
  (void)transp_color; // unused
 | 
			
		||||
 | 
			
		||||
  // Pour chaque ligne à zoomer
 | 
			
		||||
  while(1){
 | 
			
		||||
    Zoom_a_line(src,buffer,Main_magnifier_factor*ZOOMX,width);
 | 
			
		||||
 | 
			
		||||
    bx=Main_magnifier_factor;
 | 
			
		||||
 | 
			
		||||
    // Pour chaque ligne
 | 
			
		||||
    do{
 | 
			
		||||
      // TODO a verifier
 | 
			
		||||
      Display_line_on_screen_fast_tall3(x_pos,y,
 | 
			
		||||
        width * Main_magnifier_factor,buffer);
 | 
			
		||||
 | 
			
		||||
      // Ligne suivante
 | 
			
		||||
      y++;
 | 
			
		||||
      if(y==end_y_pos)
 | 
			
		||||
      {
 | 
			
		||||
        Redraw_grid(x_pos,y_pos,
 | 
			
		||||
          width*Main_magnifier_factor,end_y_pos-y_pos);
 | 
			
		||||
        Update_rect(x_pos,y_pos,
 | 
			
		||||
          width*Main_magnifier_factor,end_y_pos-y_pos);
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      bx--;
 | 
			
		||||
    }while(bx!=0);
 | 
			
		||||
 | 
			
		||||
    src+= image_width;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										50
									
								
								src/pxtall3.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/pxtall3.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,50 @@
 | 
			
		||||
/* vim:expandtab:ts=2 sw=2:
 | 
			
		||||
*/
 | 
			
		||||
/*  Grafx2 - The Ultimate 256-color bitmap paint program
 | 
			
		||||
 | 
			
		||||
    Copyright 2008 Yves Rizoud
 | 
			
		||||
    Copyright 2007 Adrien Destugues
 | 
			
		||||
    Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
 | 
			
		||||
 | 
			
		||||
    Grafx2 is free software; you can redistribute it and/or
 | 
			
		||||
    modify it under the terms of the GNU General Public License
 | 
			
		||||
    as published by the Free Software Foundation; version 2
 | 
			
		||||
    of the License.
 | 
			
		||||
 | 
			
		||||
    Grafx2 is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
    GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU General Public License
 | 
			
		||||
    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
///@file pxtall3.h
 | 
			
		||||
/// Renderer for 3/4 tall pixels (3x4).
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#include "struct.h"
 | 
			
		||||
 | 
			
		||||
  void Pixel_tall3                      (word x,word y,byte color);
 | 
			
		||||
  byte Read_pixel_tall3                  (word x,word y);
 | 
			
		||||
  void Block_tall3                      (word start_x,word start_y,word width,word height,byte color);
 | 
			
		||||
  void Pixel_preview_normal_tall3       (word x,word y,byte color);
 | 
			
		||||
  void Pixel_preview_magnifier_tall3        (word x,word y,byte color);
 | 
			
		||||
  void Horizontal_XOR_line_tall3      (word x_pos,word y_pos,word width);
 | 
			
		||||
  void Vertical_XOR_line_tall3        (word x_pos,word y_pos,word height);
 | 
			
		||||
  void Display_brush_color_tall3        (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width);
 | 
			
		||||
  void Display_brush_mono_tall3         (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,byte color,word brush_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);
 | 
			
		||||
  void Remap_screen_tall3               (word x_pos,word y_pos,word width,word height,byte * conversion_table);
 | 
			
		||||
  void Display_part_of_screen_tall3 (word width,word height,word image_width);
 | 
			
		||||
  void Display_line_on_screen_tall3   (word x_pos,word y_pos,word width,byte * line);
 | 
			
		||||
  void Read_line_screen_tall3       (word x_pos,word y_pos,word width,byte * line);
 | 
			
		||||
  void Display_part_of_screen_scaled_tall3(word width,word height,word image_width,byte * buffer);
 | 
			
		||||
  void Display_brush_color_zoom_tall3   (word x_pos,word y_pos,word x_offset,word y_offset,word width,word end_y_pos,byte transp_color,word brush_width,byte * buffer);
 | 
			
		||||
  void Display_brush_mono_zoom_tall3    (word x_pos,word y_pos,word x_offset,word y_offset,word width,word end_y_pos,byte transp_color,byte color,word brush_width,byte * buffer);
 | 
			
		||||
  void Clear_brush_scaled_tall3           (word x_pos,word y_pos,word x_offset,word y_offset,word width,word end_y_pos,byte transp_color,word image_width,byte * buffer);
 | 
			
		||||
  void Display_brush_tall3             (byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte transp_color,word brush_width);
 | 
			
		||||
 | 
			
		||||
  void Display_line_on_screen_fast_tall3   (word x_pos,word y_pos,word width,byte * line);
 | 
			
		||||
@ -878,6 +878,10 @@ int Load_INI(T_Config * conf)
 | 
			
		||||
        if(Video_mode[0].Width < 2*320 || Video_mode[0].Height < 4*200)
 | 
			
		||||
          Pixel_ratio = PIXEL_SIMPLE;
 | 
			
		||||
        break;
 | 
			
		||||
      case PIXEL_TALL3:
 | 
			
		||||
        if(Video_mode[0].Width < 3*320 || Video_mode[0].Height < 4*200)
 | 
			
		||||
          Pixel_ratio = PIXEL_SIMPLE;
 | 
			
		||||
        break;
 | 
			
		||||
      case PIXEL_QUAD:
 | 
			
		||||
        if(Video_mode[0].Width < 4*320 || Video_mode[0].Height < 4*200)
 | 
			
		||||
          Pixel_ratio = PIXEL_SIMPLE;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user