changeset 7264:afe8885a6446

obsoleted
author pontscho
date Wed, 04 Sep 2002 09:32:53 +0000
parents fe7213b0baee
children 634d93c68912
files Gui/bitmap/bmp/bmp.c Gui/bitmap/bmp/bmp.h Gui/bitmap/tga/tga.c Gui/bitmap/tga/tga.h
diffstat 4 files changed, 0 insertions(+), 320 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/bitmap/bmp/bmp.c	Tue Sep 03 23:31:11 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-
-#ifndef __MY_BMP
-#define __MY_BMP
-
-/*
-    0.1  : BMP type.
-    2.5  : File size.
-    6.7  : Res.
-    8.9  : Res.
-   10.13 : Offset of bitmap.
-   14.17 : Header size.
-   18.21 : X size.
-   22.25 : Y size.
-   26.27 : Number of planes.
-   28.29 : Number of bits per pixel.
-   30.33 : Compression flag.
-   34.37 : Image data size in bytes.
-   38.41 : Res
-   42.45 : Res
-   46.49 : Res
-   50.53 : Res
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "bmp.h"
-#include "../bitmap.h"
-
-int bmpRead( unsigned char * fname,txSample * bF )
-{
- unsigned char   bmpHeader[54];
- FILE          * BMP;
- unsigned long   i;
- unsigned char * line;
- int             linesize;
-
-
- if ( (BMP=fopen( fname,"rt" )) == NULL )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] File not found ( %s ).\n",fname );
-   return 1;
-  }
- if ( (i=fread( bmpHeader,54,1,BMP )) != 1 )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Header read error ( %s ).\n",fname );
-   return 2;
-  }
-// memcpy( &bF->Size,&bmpHeader[2],4 );
- memcpy( &bF->Width,&bmpHeader[18],4 );
- memcpy( &bF->Height,&bmpHeader[22],4 );
- memcpy( &bF->BPP,&bmpHeader[28],2 );
-// memcpy( &bF->ImageSize,&bmpHeader[34],4 );
- bF->ImageSize=( bF->Width * bF->Height ) * ( bF->BPP / 8 );
-
- if ( bF->BPP < 24 )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" );
-   return 3;
-  }
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] filename: %s\n",fname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp]  size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp]  imagesize: %lu\n",bF->ImageSize );
-
- if ( ( bF->Image=malloc( bF->ImageSize ) ) == NULL )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp]  Not enough memory for image buffer.\n" );
-   return 4;
-  }
-
- if ( (i=fread( bF->Image,bF->ImageSize,1,BMP )) != 1 )
-   {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp]  Image read error.\n" );
-   return 5;
-  }
-
- fclose( BMP );
-
- linesize=bF->Width * ( bF->BPP / 8 );
- if ( (line=malloc( linesize )) == NULL )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Not enough memory for flipping.\n" );
-   return 6;
-  }
-
- for ( i=0;i < bF->Height / 2;i++ )
-  {
-   memcpy( line,&bF->Image[ i * linesize ],linesize );
-   memcpy( &bF->Image[ i * linesize ],&bF->Image[ ( bF->Height - i - 1 ) * linesize ],linesize );
-   memcpy( &bF->Image[ ( bF->Height - i - 1 ) * linesize ],line,linesize );
-  }
- free( line );
-
- return 0;
-}
-
-#endif
-
--- a/Gui/bitmap/bmp/bmp.h	Tue Sep 03 23:31:11 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-
-#ifndef __MY_BMP
-#define __MY_BMP
-
-#include "../bitmap.h"
-
-/*
-    0.1  : BMP type.
-    2.5  : File size.
-    6.7  : Res.
-    8.9  : Res.
-   10.13 : Offset of bitmap.
-   14.17 : Header size.
-   18.21 : X size.
-   22.25 : Y size.
-   26.27 : Number of planes.
-   28.29 : Number of bits per pixel.
-   30.33 : Compression flag.
-   34.37 : Image data size in bytes.
-   38.41 : Res
-   42.45 : Res
-   46.49 : Res
-   50.53 : Res
-*/
-
-extern int bmpRead( unsigned char * fname,txSample * bF );
-
-#endif
--- a/Gui/bitmap/tga/tga.c	Tue Sep 03 23:31:11 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "tga.h"
-
-int tgaRead( char * filename,txSample * bf )
-{
- FILE          * BMP;
- unsigned long   i;
- char            tmp[255];
- unsigned char * line;
- int             linesize;
- char          * comment;
- tgaHeadert      tgaHeader;
-
- strcpy( tmp,filename );
- if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" );
- if ( (BMP=fopen( tmp,"rb" )) == NULL )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] File not found ( %s ).\n",tmp );
-   return 1;
-  }
- if ( (i=fread( &tgaHeader,sizeof( tgaHeader ),1,BMP )) != 1 )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Header read error ( %s ).\n",tmp );
-   return 2;
-  }
- if ( tgaHeader.depth < 24 )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Sorry, this loader not supported 16 bit or less ...\n" );
-   return 3;
-  }
- bf->Width=tgaHeader.sx;
- bf->Height=tgaHeader.sy;
- bf->BPP=tgaHeader.depth;
- bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 );
-
- if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  Not enough memory for image buffer.\n" );
-   return 4;
-  }
-
- comment=NULL;
- if ( tgaHeader.tmp[0] != 0 )
-  {
-   if ( ( comment=malloc( tgaHeader.tmp[0] + 1 ) ) == NULL )
-    {
-     mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for comment string.\n" );
-     return 5;
-    }
-   memset( comment,0,tgaHeader.tmp[0] + 1 );
-   if ( fread( comment,tgaHeader.tmp[0],1,BMP ) != 1 )
-    {
-     mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Comment read error.\n" );
-     return 6;
-    }
-  }
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] filename ( read ): %s\n",tmp );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  imagesize: %lu\n",bf->ImageSize );
- #ifdef MP_DEBUG
-  if ( comment ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  comment: %s\n",comment );
- #endif
-
- if ( comment ) free( comment );
-
- if ( fread( bf->Image,bf->ImageSize,1,BMP ) != 1 )
-  {
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Image read error.\n" );
-   return 7;
-  }
-
- fclose( BMP );
-
- if ( tgaHeader.ctmp == 0 )
-  {
-   linesize=bf->Width * ( bf->BPP / 8 );
-   if ( (line=malloc( linesize )) == NULL )
-    {
-     mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for flipping.\n" );
-     return 8;
-    }
-
-   for ( i=0;i < bf->Height / 2;i++ )
-    {
-     memcpy( line,&bf->Image[ i * linesize ],linesize );
-     memcpy( &bf->Image[ i * linesize ],&bf->Image[ ( bf->Height - i - 1 ) * linesize ],linesize );
-     memcpy( &bf->Image[ ( bf->Height - i - 1 ) * linesize ],line,linesize );
-    }
-   free( line );
-  }
-
- return 0;
-}
-
-char comment[] = "fresh!mindworkz's TGA Filter. v0.1";
-
-void tgaWriteTexture( char * filename,txSample * bf )
-{
- FILE          * BMP;
- int             i;
- unsigned char * line;
- int             linesize;
- tgaHeadert      tgaHeader;
- char            tmp[255];
-
- strcpy( tmp,filename );
- if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" );
- if ( ( BMP=fopen( tmp,"wb+" ) ) == NULL )
-  {
-   mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] File not open ( %s ).\n",tmp );
-   exit( 0 );
-  }
- memset( &tgaHeader,0,sizeof( tgaHeader ) );
- tgaHeader.sx=bf->Width;
- tgaHeader.sy=bf->Height;
- tgaHeader.depth=bf->BPP;
- tgaHeader.ctmp=0;
- tgaHeader.tmp[0]=strlen( comment );
- if ( bf->BPP != 8 ) tgaHeader.tmp[2]=2;
-  else tgaHeader.tmp[2]=3;
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[tga] filename ( write ): %s\n",tmp );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  size: %dx%d\n",bf->Width,bf->Height );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  bits: %d\n",bf->BPP );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  imagesize: %lu\n",bf->ImageSize );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga]  comment: %s\n",comment );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n" );
-
- if ( tgaHeader.ctmp == 0 )
-  {
-   linesize=bf->Width * ( bf->BPP / 8 );
-   if ( (line=malloc( linesize )) == NULL )
-    {
-     mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] Not enough memory for flipping.\n" );
-     exit( 0 );
-    }
-
-   for ( i=0;i < bf->Height / 2;i++ )
-    {
-     memcpy( line,&bf->Image[ i * linesize ],linesize );
-     memcpy( &bf->Image[ i * linesize ],&bf->Image[ ( bf->Height - i - 1 ) * linesize ],linesize );
-     memcpy( &bf->Image[ ( bf->Height - i - 1 ) * linesize ],line,linesize );
-    }
-   free( line );
-  }
-
- fwrite( &tgaHeader,sizeof( tgaHeader ),1,BMP );
- fwrite( comment,strlen( comment ),1,BMP );
- fwrite( bf->Image,bf->ImageSize,1,BMP );
-
- fclose( BMP );
-}
-
-void tgaWriteBuffer( char * fname,unsigned char * Buffer,int sx,int sy,int BPP )
-{
- txSample tmp;
-
- memset( &tmp,0,sizeof( tmp ) );
- tmp.Width=sx;
- tmp.Height=sy;
- tmp.BPP=BPP;
- tmp.ImageSize=sx * sy * ( BPP / 8 );
- tmp.Image=Buffer;
- tgaWriteTexture( fname,&tmp );
-}
-
--- a/Gui/bitmap/tga/tga.h	Tue Sep 03 23:31:11 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-
-#ifndef _MYTGA
-#define _MYTGA
-
-#include "../bitmap.h"
-
-typedef struct
-{
- char             tmp[12];
- unsigned short   sx;
- unsigned short   sy;
- unsigned char    depth;
- unsigned char    ctmp;
-} tgaHeadert;
-
-extern int tgaRead( char * filename,txSample * bf );
-extern void tgaWriteBuffer( char * fname,unsigned char * Buffer,int sx,int sy,int BPP );
-extern void tgaWriteTexture( char * filename,txSample * bf );
-
-
-#endif