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