#ifndef FEMorphology_h
#define FEMorphology_h
#include "platform/graphics/filters/Filter.h"
#include "platform/graphics/filters/FilterEffect.h"
namespace WebCore {
enum MorphologyOperatorType {
FEMORPHOLOGY_OPERATOR_UNKNOWN = 0,
FEMORPHOLOGY_OPERATOR_ERODE = 1,
FEMORPHOLOGY_OPERATOR_DILATE = 2
};
class PLATFORM_EXPORT FEMorphology : public FilterEffect {
public:
static PassRefPtr<FEMorphology> create(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
MorphologyOperatorType morphologyOperator() const;
bool setMorphologyOperator(MorphologyOperatorType);
float radiusX() const;
bool setRadiusX(float);
float radiusY() const;
bool setRadiusY(float);
virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
virtual TextStream& externalRepresentation(TextStream&, int indention) const OVERRIDE;
struct PaintingData {
Uint8ClampedArray* srcPixelArray;
Uint8ClampedArray* dstPixelArray;
int width;
int height;
int radiusX;
int radiusY;
};
static const int s_minimalArea = (300 * 300);
struct PlatformApplyParameters {
FEMorphology* filter;
int startY;
int endY;
PaintingData* paintingData;
};
private:
FEMorphology(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
virtual void applySoftware() OVERRIDE;
MorphologyOperatorType m_type;
float m_radiusX;
float m_radiusY;
};
}
#endif