pi1 and paletized pcx loading works. Saving untested, truecolor pcx still broken (but does not crash and preview seems ok ?!)
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@109 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									bf0127e306
								
							
						
					
					
						commit
						216ea8c9c2
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
			
		||||
CC = gcc
 | 
			
		||||
COPT = -Wall -O3 -c -g 
 | 
			
		||||
COPT = -Wall -c -g 
 | 
			
		||||
LOPT = -lSDL -o grafx2 
 | 
			
		||||
SCREEN = -D WINDOWED
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3476,7 +3476,7 @@ void Load_PCX(void)
 | 
			
		||||
  long  Position;
 | 
			
		||||
  long  Taille_image;
 | 
			
		||||
  byte * Buffer;
 | 
			
		||||
  struct stat* Informations_Fichier =NULL;
 | 
			
		||||
  struct stat Informations_Fichier;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  Nom_fichier_complet(Nom_du_fichier,0);
 | 
			
		||||
@ -3485,8 +3485,8 @@ void Load_PCX(void)
 | 
			
		||||
 | 
			
		||||
  if ((Fichier=open(Nom_du_fichier,O_RDONLY))!=-1)
 | 
			
		||||
  {
 | 
			
		||||
      stat(Nom_du_fichier,Informations_Fichier);
 | 
			
		||||
    Taille_du_fichier=Informations_Fichier->st_size;
 | 
			
		||||
      stat(Nom_du_fichier,&Informations_Fichier);
 | 
			
		||||
    Taille_du_fichier=Informations_Fichier.st_size;
 | 
			
		||||
 | 
			
		||||
    if (read(Fichier,&Header,sizeof(struct PCX_Header))==sizeof(struct PCX_Header))
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										102
									
								
								op_asm.c
									
									
									
									
									
								
							
							
						
						
									
										102
									
								
								op_asm.c
									
									
									
									
									
								
							@ -1,6 +1,23 @@
 | 
			
		||||
#include "op_c.h"
 | 
			
		||||
#include "stdio.h"
 | 
			
		||||
 | 
			
		||||
#include "graph.h"
 | 
			
		||||
 | 
			
		||||
/*************************************************************************************
 | 
			
		||||
 * Diffusion d'erreur avec l'algorithme de Floyd-Steinberg pour conversion 24b > 256c
 | 
			
		||||
 * Pour chaque pixel de la source :
 | 
			
		||||
 *  1) On fait une recherche dans la palette pour trouver la couleurs plus proche
 | 
			
		||||
 *  2) On calcule la différence avec la vraie couleur
 | 
			
		||||
 *  3) On répartit cette différence entre les pixels autours avec les coefs:
 | 
			
		||||
 *  	- 7/16 pour le pixel de droite
 | 
			
		||||
 *  	- 3/16 pour le pixel en bas à gauche
 | 
			
		||||
 *  	- 5/16 pour le pixel en dessous
 | 
			
		||||
 *  	- 1/16 pour le pixel en bas à droite
 | 
			
		||||
 *  Cette différence est appliquée directement à la source, et sera prise en compte
 | 
			
		||||
 *  lors du traitement des pixels suivants (on ne touche pas aux pixels qui sont au
 | 
			
		||||
 *  dessus ou à gauche de celui en cours !)
 | 
			
		||||
 ************************************************************************************/
 | 
			
		||||
 | 
			
		||||
void OPASM_DitherFS_6123(
 | 
			
		||||
  Bitmap256            Destination,  // Pointeur sur le 1er pixel de la ligne
 | 
			
		||||
  Bitmap24B            Source,       // Idem mais sur la source
 | 
			
		||||
@ -13,7 +30,70 @@ void OPASM_DitherFS_6123(
 | 
			
		||||
  byte                 NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte                 NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS_6123 non implémenté!\n");
 | 
			
		||||
	byte DSFRouge,DSFVert,DSFBleu=0,DSFRougeAD,DSFVertAD,DSFBleuAD;
 | 
			
		||||
	int VarA;
 | 
			
		||||
	Bitmap24B PixelCourant, Cible;
 | 
			
		||||
 | 
			
		||||
	// Pour chaque pixel sur la largeur
 | 
			
		||||
	for(VarA=0;VarA<Largeur;VarA++)
 | 
			
		||||
	{
 | 
			
		||||
		PixelCourant = Source + VarA;
 | 
			
		||||
		// On regarde la meilleure couleur d'après la table de conversion 24b>8b
 | 
			
		||||
		DSFRougeAD = PixelCourant->R - ReducR;
 | 
			
		||||
		DSFVertAD = PixelCourant->V - ReducV;
 | 
			
		||||
		DSFBleuAD = PixelCourant->B - ReducB;
 | 
			
		||||
 | 
			
		||||
		*Destination = *(TableC  + DSFRougeAD*256*256 + DSFVertAD*256 + DSFBleu);
 | 
			
		||||
 | 
			
		||||
		// On calcule l'erreur
 | 
			
		||||
		DSFRouge = PixelCourant->R - Palette[*Destination].R;
 | 
			
		||||
		DSFVert = PixelCourant->V - Palette[*Destination].V;
 | 
			
		||||
		DSFBleu = PixelCourant->B - Palette[*Destination].B;
 | 
			
		||||
 | 
			
		||||
		// On diffuse l'erreur sur le pixel de droite (6)
 | 
			
		||||
		DSFRougeAD = (DSFRouge*7)/16;
 | 
			
		||||
		DSFVertAD = (DSFVert*7)/16;
 | 
			
		||||
		DSFBleuAD = (DSFBleu*7)/16;
 | 
			
		||||
 | 
			
		||||
		// Diffusion de l'erreur dans la source
 | 
			
		||||
		Cible = PixelCourant + 1; // "Pixel à droite"
 | 
			
		||||
		Cible->R = Max(Cible->R + DSFRougeAD,255);
 | 
			
		||||
		Cible->V = Max(Cible->V + DSFVertAD,255);
 | 
			
		||||
		Cible->B = Max(Cible->B + DSFBleuAD,255);
 | 
			
		||||
 | 
			
		||||
		// On diffuse sur le pixel en bas à gauche (1)
 | 
			
		||||
		DSFRougeAD = (DSFRouge*3)/16;
 | 
			
		||||
		DSFVertAD = (DSFVert*3)/16;
 | 
			
		||||
		DSFBleuAD = (DSFBleu*3)/16;
 | 
			
		||||
 | 
			
		||||
		Cible = PixelCourant + Largeur; // "Pixel en bas à gauche"
 | 
			
		||||
		Cible->R = Max(Cible->R + DSFRougeAD,255);
 | 
			
		||||
		Cible->V = Max(Cible->V + DSFVertAD,255);
 | 
			
		||||
		Cible->B = Max(Cible->B + DSFBleuAD,255);
 | 
			
		||||
 | 
			
		||||
		// On diffuse sur le pixel en dessous (2)
 | 
			
		||||
		DSFRougeAD = (DSFRouge*5)/16;
 | 
			
		||||
		DSFVertAD = (DSFVert*5)/16;
 | 
			
		||||
		DSFBleuAD = (DSFBleu*5)/16;
 | 
			
		||||
 | 
			
		||||
		Cible ++; // "Pixel en dessous"
 | 
			
		||||
		Cible->R = Max(Cible->R + DSFRougeAD,255);
 | 
			
		||||
		Cible->V = Max(Cible->V + DSFVertAD,255);
 | 
			
		||||
		Cible->B = Max(Cible->B + DSFBleuAD,255);
 | 
			
		||||
 | 
			
		||||
		// On diffuse sur le pixel en dessous (2)
 | 
			
		||||
		DSFRougeAD = (DSFRouge*1)/16;
 | 
			
		||||
		DSFVertAD = (DSFVert*1)/16;
 | 
			
		||||
		DSFBleuAD = (DSFBleu*1)/16;
 | 
			
		||||
 | 
			
		||||
		Cible ++; // "Pixel en bas à droite"
 | 
			
		||||
		Cible->R = Max(Cible->R + DSFRougeAD,255);
 | 
			
		||||
		Cible->V = Max(Cible->V + DSFVertAD,255);
 | 
			
		||||
		Cible->B = Max(Cible->B + DSFBleuAD,255);
 | 
			
		||||
 | 
			
		||||
		Destination++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
void OPASM_DitherFS_623(
 | 
			
		||||
@ -28,7 +108,7 @@ void OPASM_DitherFS_623(
 | 
			
		||||
  byte                 NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte                 NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS_623 non implémenté!\n");
 | 
			
		||||
	puts("OPASM_DitherFS_623 non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_DitherFS_12(
 | 
			
		||||
@ -43,7 +123,7 @@ void OPASM_DitherFS_12(
 | 
			
		||||
  byte                 NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte                 NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS_12 non implémenté!\n");
 | 
			
		||||
	puts("OPASM_DitherFS_12 non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_DitherFS_6(
 | 
			
		||||
@ -58,7 +138,7 @@ void OPASM_DitherFS_6(
 | 
			
		||||
  byte                 NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte                 NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS_6 non implémenté!\n");
 | 
			
		||||
	puts("OPASM_DitherFS_6 non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  void OPASM_DitherFS(
 | 
			
		||||
@ -71,7 +151,7 @@ void OPASM_DitherFS_6(
 | 
			
		||||
  byte      NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte      NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS non implémenté!\n");
 | 
			
		||||
	puts("OPASM_DitherFS non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_DitherFS_2(
 | 
			
		||||
@ -86,7 +166,7 @@ void OPASM_DitherFS_2(
 | 
			
		||||
  byte                 NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte                 NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_DitherFS_2 non implémenté!\n");
 | 
			
		||||
	puts("OPASM_DitherFS_2 non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  void OPASM_Split_cluster_Rouge(
 | 
			
		||||
@ -104,7 +184,7 @@ void OPASM_DitherFS_2(
 | 
			
		||||
  int   rdec,   // rdec
 | 
			
		||||
  int * rouge)  // Valeur du rouge atteignant la limite
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_Split_cluster_Rouge non implémenté!\n");
 | 
			
		||||
	puts("OPASM_Split_cluster_Rouge non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_Split_cluster_Vert(
 | 
			
		||||
@ -122,7 +202,7 @@ void OPASM_Split_cluster_Vert(
 | 
			
		||||
  int   vdec,   // vdec
 | 
			
		||||
  int * vert)   // Valeur du vert atteignant la limite
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_Split_cluster_Vert non implémenté!\n");
 | 
			
		||||
	puts("OPASM_Split_cluster_Vert non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_Split_cluster_Bleu(
 | 
			
		||||
@ -140,7 +220,7 @@ void OPASM_Split_cluster_Bleu(
 | 
			
		||||
  int   bdec,   // bdec
 | 
			
		||||
  int * bleu)   // Valeur du bleu atteignant la limite
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_Split_cluster_Bleu non implémenté!\n");
 | 
			
		||||
	puts("OPASM_Split_cluster_Bleu non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  void OPASM_Compter_occurences(
 | 
			
		||||
@ -153,7 +233,7 @@ void OPASM_Split_cluster_Bleu(
 | 
			
		||||
  byte      NbbV,         // Nb_bits_verts
 | 
			
		||||
  byte      NbbB)         // Nb_bits_bleus
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_Compter_occurences non implémenté!\n");
 | 
			
		||||
	puts("OPASM_Compter_occurences non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OPASM_Analyser_cluster(
 | 
			
		||||
@ -172,5 +252,5 @@ void OPASM_Analyser_cluster(
 | 
			
		||||
  int   binc,   // Incrémentation sur les bleus  1 << bdec
 | 
			
		||||
  int * Nbocc)  // Nombre d'occurences
 | 
			
		||||
{
 | 
			
		||||
	puts("OPASM_Analyser_cluster non implémenté!\n");
 | 
			
		||||
	puts("OPASM_Analyser_cluster non implémenté!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								op_c.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								op_c.c
									
									
									
									
									
								
							@ -7,7 +7,7 @@
 | 
			
		||||
#include "op_c.h"
 | 
			
		||||
#include "op_asm.h"
 | 
			
		||||
 | 
			
		||||
#define OPTIMISATIONS_ASSEMBLEUR
 | 
			
		||||
#undef OPTIMISATIONS_ASSEMBLEUR
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -305,6 +305,8 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
  int nbocc;
 | 
			
		||||
 | 
			
		||||
  rmin=c->rmax; rmax=c->rmin;
 | 
			
		||||
  vmin=c->vmax; vmax=c->vmin;
 | 
			
		||||
  bmin=c->bmax; bmax=c->bmin;
 | 
			
		||||
@ -547,7 +549,7 @@ void Cluster_Calculer_teinte(Cluster * c,Table_occurence * to)
 | 
			
		||||
          cumulB+=b*nbocc;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  c->r=(cumulR<<to->red_r)/c->occurences;
 | 
			
		||||
  c->v=(cumulV<<to->red_v)/c->occurences;
 | 
			
		||||
  c->b=(cumulB<<to->red_b)/c->occurences;
 | 
			
		||||
@ -759,9 +761,9 @@ void CS_Generer_TC_et_Palette(ClusterSet * cs,Table_occurence * to,Table_convers
 | 
			
		||||
    palette[indice].V=cs->clusters[indice].v;
 | 
			
		||||
    palette[indice].B=cs->clusters[indice].b;
 | 
			
		||||
 | 
			
		||||
    for (r=cs->clusters[indice].Rmin;r<=cs->clusters[indice].Rmax;r++)
 | 
			
		||||
      for (v=cs->clusters[indice].Vmin;v<=cs->clusters[indice].Vmax;v++)
 | 
			
		||||
        for (b=cs->clusters[indice].Bmin;b<=cs->clusters[indice].Bmax;b++)
 | 
			
		||||
    for (r=cs->clusters[indice].Rmin;r</*=*/cs->clusters[indice].Rmax;r++)
 | 
			
		||||
      for (v=cs->clusters[indice].Vmin;v</*=*/cs->clusters[indice].Vmax;v++)
 | 
			
		||||
        for (b=cs->clusters[indice].Bmin;b</*=*/cs->clusters[indice].Bmax;b++)
 | 
			
		||||
          TC_Set(tc,r,v,b,indice);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,4 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
rm grafx2-beta-svn*.zip
 | 
			
		||||
wine ide grafx2.wpj
 | 
			
		||||
zip -j grafx2-beta-svn`svnversion`.zip grafx2.exe ../gfx2.dat ../gfx2.cfg ../gfx2.ini ~/.wine/drive_c/WATCOM/binnt/mt7r17.dll ~/.wine/drive_c/WATCOM/binnt/clbr17.dll ~/.wine/drive_c/windows/system32/SDL.dll
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user