kimikage / colorblendmodes.jl Goto Github PK
View Code? Open in Web Editor NEWblend modes such as multiply, screen, overlay and so on.
License: MIT License
blend modes such as multiply, screen, overlay and so on.
License: MIT License
If both CompositeOperation
and BlendMode
(i.e., mode
and op
keyword arguments) are specified, (in-place) blending is performed first and then compositing is applied.
https://drafts.fxtf.org/compositing-1/#generalformula
However, the most conbinations ignore the necessary blending.
At present, the compositing operations have been verified only with the PNG images for the documents. Strictly speaking, the images contain numerical errors, so additional tests are needed.
Hello,
I haven't dug too much into internals, but I'm wondering how hard it would be to write a 3-arg inplace blend!
function that the allocating blend
uses. I'm mainly looking to blend videos, so reusing the memory from one frame to the next is my goal.
This example might demonstrate what I'm thinking of (where v and v2 are equal lengths, of something like Vector{Matrix{RGB{N0f8}}}
):
"allocates only a single frame"
function blendem(v, v2, mode=BlendHardLight)
img = similar(v[1])
for i in eachindex(v)
blend!.(img, v[i], v2[i], mode=mode) # reuses `img`
save("$i.jpeg", img)
end
end
"allocates length(v) number of frames"
function blendem2(v, v2, mode=BlendHardLight)
for i in eachindex(v)
img = blend.(v[i], v2[i], mode=mode)
save("$i.jpeg", img)
end
end
There might be a way to do this without having to change this package, I'm not sure. Does this make any sense (ie will it cut down on allocations?)
The hue values of grays in HSV etc. is meaningless. The gray hues should be ignored.
julia> blend(HSV(0,0,0), HSV(100,1,0), opacity=0.5)
HSV{Float32}(50.0f0,0.5f0,0.0f0) # actual
HSV{Float32}(100.0f0,0.5f0,0.0f0) # expected
It's not a big deal that this package is in a personal repository, but I'm a little concerned about its lack of popularity. ๐ญ
I still have some plans for changing this package, but I don't think we have a problem committing them under the organization. Rather, I think the problem is the dependency chain in the JuliaImages ecosystem. For now, this package is "isolated", though.
Although the transferring to organization is not an urgent issue, I think it's one to consider if we want to reorganize the repositories of ColorTypes, Colors and ColorVectorSpace.
cc: @timholy, @johnnychen94
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Currently, only opaque Color
s are supported for the backdrop color.
The alpha composition is a type of operations on transparent colors. Especially if the backdrop is an opaque color, it cannot represent the transparent result. However, I do not want to promote the backdrop from Color
to TransparentColor
for the sake of consistency.
However, for some operations, if the backdrop is opaque, the result will always be opaque as well. Currently, only the default CompositeSourceOver
supports the opaque backsdrop.
julia> CompositeSourceOver(RGB(0), RGB(0)) # the default op
RGB{N0f8}(0.0,0.0,0.0)
julia> CompositeDestination(RGB(0), RGB(0))
ERROR: MethodError: no method matching
julia> CompositeDestinationOver(RGB(0), RGB(0))
ERROR: MethodError: no method matching
julia> CompositeSourceAtop(RGB(0), RGB(0))
ERROR: MethodError: no method matching
julia> CompositeLighter(RGB(0), RGB(0)) # The spec. of "Lighter" is unclear, though.
ERROR: MethodError: no method matching
While opaque backdrop support is not so useful for the two-color compositing, they can be useful in the future when supporting the compositing of three or more colors .
One approach is to add PMAColor
and PMColorA
types.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.