skia2/include/effects/SkDisplacementMapEffect.h
Michael Ludwig 06eacf44d5 Add new SkImageFilters factory API
In preparation for moving the filter-specific headers from include/effects and into src/effects/imagefilters, this exposes a more convenient API where all filters provided by Skia are accessible from the same factory.

It also only exposes the factories that take the shared enums (SkColorChannel, SkTileMode), so the per-filter enums can be phased out (SkBlurImageFilter::TileMode, etc.). It also accepts an SkIRect* instead of an SkImageFilter::CropRect* since all uses seem to be for integer rectangles and flags are either always on or always off. This will allow us to later remove the CropRect type.

Bug: skia:9280
Change-Id: I71f77ff44b573f87b837d6523b9eb565521f0f36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230876
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-08-02 13:33:35 +00:00

50 lines
1.6 KiB
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkDisplacementMapEffect_DEFINED
#define SkDisplacementMapEffect_DEFINED
#include "include/core/SkImageFilter.h"
enum class SkColorChannel;
// DEPRECATED: Use include/effects/SkImageFilters::DisplacementMap
class SK_API SkDisplacementMapEffect {
public:
// DEPRECATED - Use SkColorChannel instead.
enum ChannelSelectorType {
kUnknown_ChannelSelectorType,
kR_ChannelSelectorType,
kG_ChannelSelectorType,
kB_ChannelSelectorType,
kA_ChannelSelectorType,
kLast_ChannelSelectorType = kA_ChannelSelectorType
};
static sk_sp<SkImageFilter> Make(ChannelSelectorType xChannelSelector,
ChannelSelectorType yChannelSelector,
SkScalar scale,
sk_sp<SkImageFilter> displacement,
sk_sp<SkImageFilter> color,
const SkImageFilter::CropRect* cropRect = nullptr);
static sk_sp<SkImageFilter> Make(SkColorChannel xChannelSelector,
SkColorChannel yChannelSelector,
SkScalar scale,
sk_sp<SkImageFilter> displacement,
sk_sp<SkImageFilter> color,
const SkImageFilter::CropRect* cropRect = nullptr);
static void RegisterFlattenables();
private:
SkDisplacementMapEffect() = delete;
};
#endif