1/*****************************************************************************/ 2// SGITranslator 3// Written by Stephan A��mus 4// based on TIFFTranslator written mostly by 5// Michael Wilber, Haiku Translation Kit Team 6// 7// SGITranslator.h 8// 9// This BTranslator based object is for opening and writing 10// SGI images. 11// 12// 13// Copyright (c) 2003 Haiku Project 14// 15// Permission is hereby granted, free of charge, to any person obtaining a 16// copy of this software and associated documentation files (the "Software"), 17// to deal in the Software without restriction, including without limitation 18// the rights to use, copy, modify, merge, publish, distribute, sublicense, 19// and/or sell copies of the Software, and to permit persons to whom the 20// Software is furnished to do so, subject to the following conditions: 21// 22// The above copyright notice and this permission notice shall be included 23// in all copies or substantial portions of the Software. 24// 25// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 26// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 30// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 31// DEALINGS IN THE SOFTWARE. 32/*****************************************************************************/ 33 34#ifndef SGI_TRANSLATOR_H 35#define SGI_TRANSLATOR_H 36 37#include <Translator.h> 38#include <TranslatorFormats.h> 39#include <TranslationDefs.h> 40#include <GraphicsDefs.h> 41#include <InterfaceDefs.h> 42#include <DataIO.h> 43#include <File.h> 44#include <ByteOrder.h> 45#include <fs_attr.h> 46#include "BaseTranslator.h" 47 48#define SGI_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(1,0,0) 49 50#define SGI_IN_QUALITY 0.5 51#define SGI_IN_CAPABILITY 0.6 52#define SGI_OUT_QUALITY 1.0 53 // high out quality because this code outputs fully standard SGIs 54#define SGI_OUT_CAPABILITY 0.4 55 // medium out capability because not many SGI features are supported (?) 56 57#define BBT_IN_QUALITY 0.4 58#define BBT_IN_CAPABILITY 0.6 59#define BBT_OUT_QUALITY 0.4 60#define BBT_OUT_CAPABILITY 0.6 61 62// SGI Translator Settings 63#define SGI_SETTING_COMPRESSION "sgi /compression" 64 65enum { 66 SGI_FORMAT = 'SGI ', 67}; 68 69class SGITranslator : public BaseTranslator { 70public: 71 SGITranslator(); 72 73 virtual status_t DerivedIdentify(BPositionIO *inSource, 74 const translation_format *inFormat, BMessage *ioExtension, 75 translator_info *outInfo, uint32 outType); 76 77 virtual status_t DerivedTranslate(BPositionIO *inSource, 78 const translator_info *inInfo, BMessage *ioExtension, 79 uint32 outType, BPositionIO *outDestination, int32 baseType); 80 81 virtual BView *NewConfigView(TranslatorSettings *settings); 82 83protected: 84 virtual ~SGITranslator(); 85 // this is protected because the object is deleted by the 86 // Release() function instead of being deleted directly by 87 // the user 88 89private: 90 91 status_t translate_from_bits(BPositionIO *inSource, uint32 outType, 92 BPositionIO *outDestination); 93 94 status_t translate_from_sgi(BPositionIO *inSource, uint32 outType, 95 BPositionIO *outDestination); 96}; 97 98#endif // #ifndef SGI_TRANSLATOR_H 99