1/*
2
3Mask Cache Item.
4
5Copyright (c) 2003 OpenBeOS.
6
7Author:
8	Michael Pfeiffer
9
10Permission is hereby granted, free of charge, to any person obtaining a copy of
11this software and associated documentation files (the "Software"), to deal in
12the Software without restriction, including without limitation the rights to
13use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14of the Software, and to permit persons to whom the Software is furnished to do
15so, subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26THE SOFTWARE.
27
28*/
29
30#ifndef _MASK_CACHE_ITEM_H
31#define _MASK_CACHE_ITEM_H
32
33#include <String.h>
34
35#include "pdflib.h"
36#include "Cache.h"
37
38class MaskDescription : public CIDescription {
39public:
40	MaskDescription(PDF* pdf, const char* mask, int length, int width, int height, int bpc);
41
42	CacheItem* NewItem(int id);
43
44	const char* Mask() const { return fMask; }
45	int Length() const { return fLength; }
46	int Width() const { return fWidth; }
47	int Height() const { return fHeight; }
48	int BPC() const { return fBPC; }
49
50private:
51	bool StoreMask(const char* name);
52	int MakePDFMask();
53
54	PDF* fPDF;
55	const char* fMask;
56	int fLength;
57	int fWidth;
58	int fHeight;
59	int fBPC;
60};
61
62class Mask : public CacheItem {
63public:
64	Mask(PDF* pdf, int imageID, const char* fileName, int length, int width, int height, int bpc);
65	~Mask();
66
67	int ImageID() const { return fImageID; };
68	const char* FileName() const  { return fFileName.String(); };
69	int Length() const { return fLength; };
70	int Width() const { return fWidth; }
71	int Height() const { return fHeight; }
72	int BPC() const { return fBPC; }
73	bool Equals(CIDescription* desc) const;
74
75private:
76	PDF* fPDF;
77	int fImageID;
78	BString fFileName;
79	int fLength;
80	int fWidth;
81	int fHeight;
82	int fBPC;
83};
84
85#endif
86