Flutter Engine
flutter::ColorFilter Class Reference

#include <color_filter.h>

Inheritance diagram for flutter::ColorFilter:
flutter::RefCountedDartWrappable< ColorFilter > fml::RefCountedThreadSafe< ColorFilter > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

void initMode (int color, int blend_mode)
 
void initMatrix (const tonic::Float32List &color_matrix)
 
void initSrgbToLinearGamma ()
 
void initLinearToSrgbGamma ()
 
 ~ColorFilter () override
 
sk_sp< SkColorFilter > filter () const
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< ColorFilter >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< ColorFilter >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual size_t GetAllocationSize () const
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static fml::RefPtr< ColorFilterCreate ()
 
static sk_sp< SkColorFilter > MakeColorMatrixFilter255 (const float array[20])
 
static void RegisterNatives (tonic::DartLibraryNatives *natives)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kWrapperInfoIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< ColorFilter >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 23 of file color_filter.h.

Constructor & Destructor Documentation

◆ ~ColorFilter()

flutter::ColorFilter::~ColorFilter ( )
overridedefault

Referenced by initSrgbToLinearGamma().

Member Function Documentation

◆ Create()

fml::RefPtr< ColorFilter > flutter::ColorFilter::Create ( )
static

Definition at line 38 of file color_filter.cc.

Referenced by flutter::ColorFilter_constructor().

38  {
39  return fml::MakeRefCounted<ColorFilter>();
40 }

◆ filter()

sk_sp<SkColorFilter> flutter::ColorFilter::filter ( ) const
inline

Definition at line 42 of file color_filter.h.

Referenced by flutter::Paint::Paint(), and flutter::SceneBuilder::pushColorFilter().

42 { return filter_; }

◆ initLinearToSrgbGamma()

void flutter::ColorFilter::initLinearToSrgbGamma ( )

Definition at line 64 of file color_filter.cc.

64  {
65  filter_ = SkColorFilters::LinearToSRGBGamma();
66 }

◆ initMatrix()

void flutter::ColorFilter::initMatrix ( const tonic::Float32List &  color_matrix)

Definition at line 58 of file color_filter.cc.

References FML_CHECK, and MakeColorMatrixFilter255().

58  {
59  FML_CHECK(color_matrix.num_elements() == 20);
60 
61  filter_ = MakeColorMatrixFilter255(color_matrix.data());
62 }
static sk_sp< SkColorFilter > MakeColorMatrixFilter255(const float array[20])
Definition: color_filter.cc:47
#define FML_CHECK(condition)
Definition: logging.h:68

◆ initMode()

void flutter::ColorFilter::initMode ( int  color,
int  blend_mode 
)

Definition at line 42 of file color_filter.cc.

42  {
43  filter_ = SkColorFilters::Blend(static_cast<SkColor>(color),
44  static_cast<SkBlendMode>(blend_mode));
45 }

◆ initSrgbToLinearGamma()

void flutter::ColorFilter::initSrgbToLinearGamma ( )

Definition at line 68 of file color_filter.cc.

References ~ColorFilter().

68  {
69  filter_ = SkColorFilters::SRGBToLinearGamma();
70 }

◆ MakeColorMatrixFilter255()

sk_sp< SkColorFilter > flutter::ColorFilter::MakeColorMatrixFilter255 ( const float  array[20])
static

Definition at line 47 of file color_filter.cc.

Referenced by initMatrix(), and flutter::Paint::Paint().

48  {
49  float tmp[20];
50  memcpy(tmp, array, sizeof(tmp));
51  tmp[4] *= 1.0f / 255;
52  tmp[9] *= 1.0f / 255;
53  tmp[14] *= 1.0f / 255;
54  tmp[19] *= 1.0f / 255;
55  return SkColorFilters::Matrix(tmp);
56 }

◆ RegisterNatives()

void flutter::ColorFilter::RegisterNatives ( tonic::DartLibraryNatives natives)
static

Definition at line 32 of file color_filter.cc.

References flutter::ColorFilter_constructor(), DART_REGISTER_NATIVE, and FOR_EACH_BINDING.

Referenced by flutter::DartUI::InitForGlobal().

32  {
33  natives->Register(
34  {{"ColorFilter_constructor", ColorFilter_constructor, 1, true},
36 }
static void ColorFilter_constructor(Dart_NativeArguments args)
Definition: color_filter.cc:17
void Register(std::initializer_list< Entry > entries)
#define DART_REGISTER_NATIVE(CLASS, METHOD)
#define FOR_EACH_BINDING(V)
Definition: color_filter.cc:24

The documentation for this class was generated from the following files: