/* This file is part of SGI Format, a File Format plugin for Adobe Photoshop Copyright (C) 2003-2010 Toby Thain, toby@telegraphics.com.au This program 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; either version 2 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "world.h" #include "PIFormat.h" #include "PIDefines.h" // samplecode/common #include "entry.h" // must come after Photoshop includes #include "file_io.h" #include "str.h" #include "bufio.h" #include "sgi.h" #define F (FILEREF)pb->dataFork //#define dbg(s) struct revertinfo{ /* fetched at Open and kept with the document (revertInfo handle) */ Boolean rle; }; extern FormatRecordPtr gpb; enum{ CHUNK_ROWS = 64 }; void putrevertinfo(FormatRecordPtr pb, struct revertinfo *p); int getrevertinfo(FormatRecordPtr pb, struct revertinfo *p); Boolean is_sgi(FILEREF r,struct sgi_header *h); OSErr read_sgi_header(FILEREF f,struct sgi_header *h); OSErr write_sgi_header(FILEREF f,struct sgi_header *h); void expandrow(unsigned char *optr,unsigned char *iptr,long n); void expandrow2(unsigned short *optr,unsigned short *iptr,long n); void swapbytes(unsigned char *p,int n); OSErr checkpoint(FormatRecordPtr pb,unsigned i); OSErr readchannel(FormatRecordPtr pb); OSErr read_prepare(FormatRecordPtr pb); OSErr read_start(FormatRecordPtr pb); OSErr read_continue(FormatRecordPtr pb); OSErr read_finish(FormatRecordPtr pb); OSErr options_start(FormatRecordPtr pb); Boolean ReadScriptParamsOnWrite(FormatRecordPtr pb); OSErr WriteScriptParamsOnWrite(FormatRecordPtr pb); long compressrow(unsigned char *src,unsigned char *dst,long n); long compressrow2(unsigned short *src,unsigned short *dst,long n); void getchannel(FormatRecordPtr pb); OSErr write_start(FormatRecordPtr pb); OSErr write_continue(FormatRecordPtr pb); OSErr write_finish(FormatRecordPtr pb); #define PS_NEWHANDLE (pb->hostNewHdl) #define PS_DISPOSEHANDLE (pb->hostDisposeHdl) #define PS_LOCKHANDLE (pb->handleProcs->lockProc) #define PS_UNLOCKHANDLE (pb->handleProcs->unlockProc)