Base.parse
— Methodparse(t::Type{BlendMode}, keyword)
parse(t::Type{CompositeOperation}, keyword)
Parse a keyword string as a BlendMode
or CompositeOperation
. Keywords are case-insensitive, but hyphens cannot be omitted.
Examples
julia> parse(BlendMode, "color-burn")
BlendMode{Symbol("color-burn")}()
julia> parse(BlendMode, "soft-light") === BlendSoftLight
true
julia> parse(CompositeOperation, "source-over")
CompositeOperation{Symbol("source-over")}()
julia> parse(CompositeOperation, "source-over") === CompositeSourceOver
true
julia> parse(CompositeOperation, "SourceOver")
ERROR: ArgumentError: invalid keyword: SourceOver
ColorBlendModes.blend
— Methodblend(c1, c2; mode=BlendNormal, opacity=1, op=CompositeSourceOver)
Create the mixed color of two colors c1
and c2
. The c1
means the backdrop color and the c2
means the source color.
mode
specifies the blend mode, e.g. BlendMultiply
.
opacity
modifies the source (i.e. c2
-side) alpha by multiplication.
op
specifies the composite operations, e.g. CompositeSourceAtop
.
The return type is the same as c1
.
Examples
julia> blend(RGB(1, 0.5, 0), RGB(0, 0.5, 1), mode=BlendLighten)
RGB{Float64}(1.0,0.5,1.0)
ColorBlendModes.keyword
— Methodkeyword(mode::BlendMode)
keyword(op::CompositeOperation)
Return the keyword of mode
or op
as a string.
Example
julia> keyword(BlendColorDodge)
"color-dodge"
julia> keyword(CompositeSourceOver)
"source-over"