Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
GrCustomXfermode Namespace Reference

Functions

bool IsSupportedMode (SkBlendMode mode)
 
const GrXPFactoryGet (SkBlendMode mode)
 

Detailed Description

Custom Xfer modes are used for blending when the blend mode cannot be represented using blend coefficients.

Function Documentation

◆ Get()

const GrXPFactory * GrCustomXfermode::Get ( SkBlendMode  mode)

Definition at line 379 of file GrCustomXfermode.cpp.

379 {
380 static constexpr const CustomXPFactory gOverlay(SkBlendMode::kOverlay);
381 static constexpr const CustomXPFactory gDarken(SkBlendMode::kDarken);
382 static constexpr const CustomXPFactory gLighten(SkBlendMode::kLighten);
383 static constexpr const CustomXPFactory gColorDodge(SkBlendMode::kColorDodge);
384 static constexpr const CustomXPFactory gColorBurn(SkBlendMode::kColorBurn);
385 static constexpr const CustomXPFactory gHardLight(SkBlendMode::kHardLight);
386 static constexpr const CustomXPFactory gSoftLight(SkBlendMode::kSoftLight);
387 static constexpr const CustomXPFactory gDifference(SkBlendMode::kDifference);
388 static constexpr const CustomXPFactory gExclusion(SkBlendMode::kExclusion);
389 static constexpr const CustomXPFactory gMultiply(SkBlendMode::kMultiply);
390 static constexpr const CustomXPFactory gHue(SkBlendMode::kHue);
391 static constexpr const CustomXPFactory gSaturation(SkBlendMode::kSaturation);
392 static constexpr const CustomXPFactory gColor(SkBlendMode::kColor);
393 static constexpr const CustomXPFactory gLuminosity(SkBlendMode::kLuminosity);
394 switch (mode) {
396 return &gOverlay;
398 return &gDarken;
400 return &gLighten;
402 return &gColorDodge;
404 return &gColorBurn;
406 return &gHardLight;
408 return &gSoftLight;
410 return &gDifference;
412 return &gExclusion;
414 return &gMultiply;
416 return &gHue;
418 return &gSaturation;
420 return &gColor;
422 return &gLuminosity;
423 default:
425 return nullptr;
426 }
427}
#define SkASSERT(cond)
Definition SkAssert.h:116
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
bool IsSupportedMode(SkBlendMode mode)

◆ IsSupportedMode()

bool GrCustomXfermode::IsSupportedMode ( SkBlendMode  mode)

Definition at line 31 of file GrCustomXfermode.cpp.

31 {
32 return (int)mode > (int)SkBlendMode::kLastCoeffMode &&
33 (int)mode <= (int)SkBlendMode::kLastMode;
34}
@ kLastCoeffMode
last porter duff blend mode
@ kLastMode
last valid value
Type::kYUV Type::kRGBA() int(0.7 *637)