xref: /haiku/src/add-ons/translators/webp/WebPTranslator.h (revision a906d0a031e721e2f2ec9d95274103e74a3a774f)
1 /*
2  * Copyright 2010, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Philippe Houdoin
7  */
8 #ifndef WEBP_TRANSLATOR_H
9 #define WEBP_TRANSLATOR_H
10 
11 
12 #include <ByteOrder.h>
13 #include <DataIO.h>
14 #include <File.h>
15 #include <fs_attr.h>
16 #include <GraphicsDefs.h>
17 #include <InterfaceDefs.h>
18 #include <TranslationDefs.h>
19 #include <Translator.h>
20 #include <TranslatorFormats.h>
21 
22 #include "BaseTranslator.h"
23 
24 #define WEBP_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(0,1,0)
25 #define WEBP_IMAGE_FORMAT	'WebP'
26 
27 #define WEBP_IN_QUALITY 0.90
28 #define WEBP_IN_CAPABILITY 0.90
29 
30 #define BITS_OUT_QUALITY 1
31 #define BITS_OUT_CAPABILITY 0.9
32 
33 
34 class WebPTranslator : public BaseTranslator {
35 public:
36 							WebPTranslator();
37 
38 	virtual status_t 		DerivedIdentify(BPositionIO* stream,
39 								const translation_format* format,
40 								BMessage* settings, translator_info* info,
41 								uint32 outType);
42 
43 	virtual status_t 		DerivedTranslate(BPositionIO* stream,
44 								const translator_info* info,
45 								BMessage* settings, uint32 outType,
46 								BPositionIO* target, int32 baseType);
47 
48 	virtual BView*			NewConfigView(TranslatorSettings* settings);
49 
50 protected:
51 	virtual 				~WebPTranslator();
52 		// this is protected because the object is deleted by the
53 		// Release() function instead of being deleted directly by
54 		// the user
55 };
56 
57 
58 #endif // #ifndef WEBP_TRANSLATOR_H
59