forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.h
65 lines (50 loc) · 1.86 KB
/
filter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef FILTERS_FILTER_H_INCLUDED
#define FILTERS_FILTER_H_INCLUDED
#pragma once
namespace doc {
class PalettePicks;
}
namespace filters {
class FilterManager;
// Interface which applies a filter to a sprite given a FilterManager
// which indicates where we have to apply the filter.
class Filter {
public:
virtual ~Filter() { }
// Returns a proper name for the filter. It is used to show a label
// with the Undo action.
virtual const char* getName() = 0;
// Applies the filter to one RGBA row. You must use
// FilterManager::getSourceAddress() and advance 32 bits to modify
// each pixel.
virtual void applyToRgba(FilterManager* filterMgr) = 0;
// Applies the filter to one grayscale row. You must use
// FilterManager::getSourceAddress() and advance 16 bits to modify
// each pixel.
virtual void applyToGrayscale(FilterManager* filterMgr) = 0;
// Applies the filter to one indexed row. You must use
// FilterManager::getSourceAddress() and advance 8 bits to modify
// each pixel.
virtual void applyToIndexed(FilterManager* filterMgr) = 0;
// Applies the filter to the color palette.
virtual void applyToPalette(FilterManager* filterMgr) { }
};
// Filter that support applying it only to palette colors.
class FilterWithPalette : public Filter {
public:
FilterWithPalette();
void applyToPalette(FilterManager* filterMgr) override;
protected:
virtual void onApplyToPalette(FilterManager* filterMgr,
const doc::PalettePicks& picks) = 0;
// Use the palette to replace colors in RGB images
bool m_usePaletteOnRGB;
};
} // namespace filters
#endif