2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2013 Google Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef FEMorphology_h
24 #define FEMorphology_h
26 #include "platform/graphics/filters/Filter.h"
27 #include "platform/graphics/filters/FilterEffect.h"
31 enum MorphologyOperatorType {
32 FEMORPHOLOGY_OPERATOR_UNKNOWN = 0,
33 FEMORPHOLOGY_OPERATOR_ERODE = 1,
34 FEMORPHOLOGY_OPERATOR_DILATE = 2
37 class PLATFORM_EXPORT FEMorphology : public FilterEffect {
39 static PassRefPtr<FEMorphology> create(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
40 MorphologyOperatorType morphologyOperator() const;
41 bool setMorphologyOperator(MorphologyOperatorType);
43 float radiusX() const;
44 bool setRadiusX(float);
46 float radiusY() const;
47 bool setRadiusY(float);
49 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
51 virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
53 virtual TextStream& externalRepresentation(TextStream&, int indention) const OVERRIDE;
56 Uint8ClampedArray* srcPixelArray;
57 Uint8ClampedArray* dstPixelArray;
64 static const int s_minimalArea = (300 * 300); // Empirical data limit for parallel jobs
66 struct PlatformApplyParameters {
70 PaintingData* paintingData;
74 FEMorphology(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
76 virtual void applySoftware() OVERRIDE;
78 MorphologyOperatorType m_type;
85 #endif // FEMorphology_h