Is there a way use GCFunction ?
linuxenko opened this issue · 5 comments
linuxenko commented
It seems like GCFunction
is supported, but how i can provide an option to handle GXinvert
or something like this?
linuxenko commented
santigimeno commented
I haven't tested it but, something like this?:
var gc = X.AllocID();
X.CreateGC(gc, wid, { function: 0xa, foreground: black, background: white } );
linuxenko commented
Exactly ! It is awesome , thank you !
sidorares commented
@linuxenko take a look at Render extension Composite - it supports much richer range of blending modes:
8. Compositing Operators
For each pixel, the four channels of the image are computed with:
C = Ca * Fa + Cb * Fb
where C, Ca, Cb are the values of the respective channels and Fa and Fb
come from the following table:
PictOp Fa Fb
--------------------------------------------------
Clear 0 0
Src 1 0
Dst 0 1
Over 1 1-Aa
OverReverse 1-Ab 1
In Ab 0
InReverse 0 Aa
Out 1-Ab 0
OutReverse 0 1-Aa
Atop Ab 1-Aa
AtopReverse 1-Ab Aa
Xor 1-Ab 1-Aa
Add 1 1
Saturate min(1,(1-Ab)/Aa) 1
DisjointClear 0 0
DisjointSrc 1 0
DisjointDst 0 1
DisjointOver 1 min(1,(1-Aa)/Ab)
DisjointOverReverse min(1,(1-Ab)/Aa) 1
DisjointIn max(1-(1-Ab)/Aa,0) 0
DisjointInReverse 0 max(1-(1-Aa)/Ab,0)
DisjointOut min(1,(1-Ab)/Aa) 0
DisjointOutReverse 0 min(1,(1-Aa)/Ab)
DisjointAtop max(1-(1-Ab)/Aa,0) min(1,(1-Aa)/Ab)
DisjointAtopReverse min(1,(1-Ab)/Aa) max(1-(1-Aa)/Ab,0)
DisjointXor min(1,(1-Ab)/Aa) min(1,(1-Aa)/Ab)
ConjointClear 0 0
ConjointSrc 1 0
ConjointDst 0 1
ConjointOver 1 max(1-Aa/Ab,0)
ConjointOverReverse max(1-Ab/Aa,0) 1
ConjointIn min(1,Ab/Aa) 0
ConjointInReverse 0 min(Aa/Ab,1)
ConjointOut max(1-Ab/Aa,0) 0
ConjointOutReverse 0 max(1-Aa/Ab,0)
ConjointAtop min(1,Ab/Aa) max(1-Aa/Ab,0)
ConjointAtopReverse max(1-Ab/Aa,0) min(1,Aa/Ab)
ConjointXor max(1-Ab/Aa,0) max(1-Aa/Ab,0)
linuxenko commented
@sidorares
wow, it is wonderful extension with lots of interesting things to play with. Thank you !