1 /* 2 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Copyright 2012, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 #ifndef ICNS_TRANSLATOR_H 8 #define ICNS_TRANSLATOR_H 9 10 11 #include "BaseTranslator.h" 12 13 #include <Translator.h> 14 #include <TranslatorFormats.h> 15 #include <TranslationDefs.h> 16 #include <GraphicsDefs.h> 17 #include <InterfaceDefs.h> 18 #include <DataIO.h> 19 #include <File.h> 20 #include <ByteOrder.h> 21 22 #define DOCUMENT_COUNT "/documentCount" 23 #define DOCUMENT_INDEX "/documentIndex" 24 25 #define ICNS_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(1, 0, 0) 26 #define ICNS_IMAGE_FORMAT 'ICNS' 27 28 #define ICNS_IN_QUALITY 0.5 29 #define ICNS_IN_CAPABILITY 0.5 30 #define BITS_IN_QUALITY 1 31 #define BITS_IN_CAPABILITY 1 32 33 #define ICNS_OUT_QUALITY 0.8 34 #define ICNS_OUT_CAPABILITY 0.8 35 #define BITS_OUT_QUALITY 1 36 #define BITS_OUT_CAPABILITY 0.9 37 38 39 class ICNSTranslator : public BaseTranslator { 40 public: 41 ICNSTranslator(); 42 43 virtual status_t DerivedIdentify(BPositionIO *inSource, 44 const translation_format *inFormat, BMessage *ioExtension, 45 translator_info *outInfo, uint32 outType); 46 47 virtual status_t DerivedTranslate(BPositionIO *inSource, 48 const translator_info *inInfo, BMessage *ioExtension, 49 uint32 outType, BPositionIO *outDestination, int32 baseType); 50 51 virtual status_t DerivedCanHandleImageSize(float width, 52 float height) const; 53 54 virtual BView *NewConfigView(TranslatorSettings *settings); 55 56 protected: 57 virtual ~ICNSTranslator(); 58 }; 59 60 // Extensions that ShowImage supports 61 extern const char *kDocumentCount; 62 extern const char *kDocumentIndex; 63 64 #endif /* ICNS_TRANSLATOR_H */ 65