Skia
2D Graphics Library
SkShader.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkShader_DEFINED
9 #define SkShader_DEFINED
10 
11 #include "include/core/SkColor.h"
13 #include "include/core/SkRefCnt.h"
14 #include "include/private/base/SkAPI.h"
15 
16 class SkBlender;
17 class SkColorFilter;
18 class SkColorSpace;
19 class SkImage;
20 class SkMatrix;
21 enum class SkBlendMode;
22 enum class SkTileMode;
23 struct SkRect;
24 
35 class SK_API SkShader : public SkFlattenable {
36 public:
43  virtual bool isOpaque() const { return false; }
44 
49  SkImage* isAImage(SkMatrix* localMatrix, SkTileMode xy[2]) const;
50 
51  bool isAImage() const {
52  return this->isAImage(nullptr, (SkTileMode*)nullptr) != nullptr;
53  }
54 
56  // Methods to create combinations or variants of shaders
57 
63 
69 
78 
79 private:
80  SkShader() = default;
81  friend class SkShaderBase;
82 
83  using INHERITED = SkFlattenable;
84 };
85 
86 namespace SkShaders {
93 }
94 
95 #endif
SkBlendMode
Blends are operators that take in two colors (source, destination) and return a new color.
Definition: SkBlendMode.h:38
Types, consts, functions, and macros for colors.
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
SkTileMode
Definition: SkTileMode.h:13
SkBlender represents a custom blend function in the Skia pipeline.
Definition: SkBlender.h:19
ColorFilters are optional objects in the drawing pipeline.
Definition: SkColorFilter.h:35
Definition: SkColorSpace.h:107
SkFlattenable is the base class for objects that need to be flattened into a data stream for either t...
Definition: SkFlattenable.h:28
SkFlattenable()
Definition: SkFlattenable.h:43
SkImage describes a two dimensional array of pixels to draw.
Definition: SkImage.h:270
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Definition: SkRefCnt.h:119
Shaders specify the source color(s) for what is being drawn.
Definition: SkShader.h:35
sk_sp< SkShader > makeWithWorkingColorSpace(sk_sp< SkColorSpace >) const
Return a shader that will compute this shader in a specific color space.
bool isAImage() const
Definition: SkShader.h:51
SkImage * isAImage(SkMatrix *localMatrix, SkTileMode xy[2]) const
Iff this shader is backed by a single SkImage, return its ptr (the caller must ref this if they want ...
sk_sp< SkShader > makeWithColorFilter(sk_sp< SkColorFilter >) const
Create a new shader that produces the same colors as invoking this shader and then applying the color...
virtual bool isOpaque() const
Returns true if the shader is guaranteed to produce only opaque colors, subject to the SkPaint using ...
Definition: SkShader.h:43
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
Return a shader that will apply the specified localMatrix to this shader.
Definition: SkShader.h:86
SK_API sk_sp< SkShader > CoordClamp(sk_sp< SkShader >, const SkRect &subset)
SK_API sk_sp< SkShader > Color(SkColor)
SK_API sk_sp< SkShader > Blend(SkBlendMode mode, sk_sp< SkShader > dst, sk_sp< SkShader > src)
SK_API sk_sp< SkShader > Empty()
RGBA color value, holding four floating point components.
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582