bef379ba62
This is an SkBlender type which represents a traditional Skia blend mode (from the SkBlendMode enum). Change-Id: I7c74395be70584e11a5f1445b7f6cacfff35c532 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420817 Commit-Queue: Mike Reed <reed@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Mike Reed <reed@google.com>
40 lines
963 B
C++
40 lines
963 B
C++
/*
|
|
* Copyright 2021 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkBlender_DEFINED
|
|
#define SkBlender_DEFINED
|
|
|
|
#include "include/core/SkBlendMode.h"
|
|
#include "include/core/SkFlattenable.h"
|
|
|
|
/**
|
|
* SkBlender represents a custom blend function in the Skia pipeline. When an SkBlender is
|
|
* present in a paint, the SkBlendMode is ignored. A blender combines a source color (the
|
|
* result of our paint) and destination color (from the canvas) into a final color.
|
|
*/
|
|
class SK_API SkBlender : public SkFlattenable {
|
|
private:
|
|
SkBlender() = default;
|
|
friend class SkBlenderBase;
|
|
|
|
using INHERITED = SkFlattenable;
|
|
};
|
|
|
|
/**
|
|
* Factory functions for synthesizing an SkBlender.
|
|
*/
|
|
class SK_API SkBlenders {
|
|
public:
|
|
/** Returns a SkBlender for the requested SkBlendMode. */
|
|
static sk_sp<SkBlender> Mode(SkBlendMode mode);
|
|
|
|
private:
|
|
SkBlenders() = delete;
|
|
};
|
|
|
|
#endif
|