2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 //TODO find a replacement on WIN32
39 //a reader to be implemented by the caller
42 //init reading the file
43 //return <=0 if error or size of image
44 virtual ULONG initRead(const char *filename)=0;
45 //read the next chunk of jpeg data
46 //offset - from start of file
47 //len I buf len (max bytes to read)
48 //return read len, 0 on EOF, -1 on error, *buf set to buffer
49 //will be released with free(!!!) after decoding
50 virtual ULONG readChunk(ULONG offset,ULONG len,char **buf)=0;
51 virtual ~JpegReader(){};
54 class WJpeg : public Widget
59 int init(char* fileName, bool useImage=true, JpegReader *rdr=NULL);
60 //rotate (with next draw!) by 90/180/270
61 void setRotate(int amount);
62 static const int ROT_0=0;
63 static const int ROT_90=1;
64 static const int ROT_180=2;
65 static const int ROT_270=3;
69 * get an integer info from the current picture
71 ULONG getJpegInfo(ULONG tag);
73 static const ULONG JPEG_WIDTH=1; //picture width
74 static const ULONG JPEG_HEIGHT=2; //picture height
75 static const ULONG JPEG_SIZE=3; //picture (compressed) size
76 static const ULONG JPEG_ROTATE=4; //rotate setting
77 static const ULONG JPEG_SCALE=5; //scale setting (1/n)
79 * get a string info from the picture
80 * the user must provide a buffer of
83 int getJpegInfo(ULONG tag, char * buffer);
84 static const int INFO_BUFFER=200;
86 static const ULONG JPEG_FILENAME=100; //abbreviated filename
90 //our drawPixel with considers rotation
91 void drawPixel(int x, int y,int w,int h,int xpos, int ypos,Colour c);
94 bool useImageDimensions;