HTML5 canvas blend mode
Is there a way using the C++ API to set similar HTML5 canvas blend modes:
http://www.w3.org/TR/2dcontext/#dom-con ... eoperation
http://www.w3.org/TR/2dcontext/#dom-con ... eoperation
Re: HTML5 canvas blend mode
Hi Don,
As WPF only supports SrcOver, that is the only blend mode implemented in noesisGUI. Although in our internal renderer everything is structured to allow new blend modes. I imagine that if this becomes vital for your project we could implement an extension to XAML supporting this.
As WPF only supports SrcOver, that is the only blend mode implemented in noesisGUI. Although in our internal renderer everything is structured to allow new blend modes. I imagine that if this becomes vital for your project we could implement an extension to XAML supporting this.
Re: HTML5 canvas blend mode
The main important one is to support "clear" of alphas.
(e.g. in canvas, clearRect)
So basically I want to draw a shape. The fragment shader(/fixed function Blend) should multiply the destination alpha with the invert of the source alpha (rgb values don't need to be changed)
Is that possible to do now in some other way?
Thanks
Don
(e.g. in canvas, clearRect)
So basically I want to draw a shape. The fragment shader(/fixed function Blend) should multiply the destination alpha with the invert of the source alpha (rgb values don't need to be changed)
Is that possible to do now in some other way?
Thanks
Don
Re: HTML5 canvas blend mode
Not sure to understand. Do you want to draw a shape that clear the alpha? or do you want to clear all the alpha values of the framebuffer?
Re: HTML5 canvas blend mode
I want to draw a shape that clears the alpha
Re: HTML5 canvas blend mode
Yes, I see. Although for now, it cannot be done. Why do you need it? Can you explain the high level effect you want to achieve? May be it can be done using masking.
Re: HTML5 canvas blend mode
The feature I want to implement is the canvas clearRect
http://www.w3schools.com/TAGs/canvas_clearrect.asp
http://www.w3schools.com/TAGs/canvas_clearrect.asp
-
-
sfernandez
Site Admin
- Posts: 3203
- Joined:
Re: HTML5 canvas blend mode
This same effect can be achieved by setting a Clip geometry:
That xaml code can be directly translated to C++ code:
Code: Select all
<Canvas
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock Text="I'm here" FontSize="20" Margin="30"/>
<Rectangle Fill="Red" Width="300" Height="150"
Clip="M0,0 L300,0 300,150 0,150 z M20,20 L120,20 120,70 20,70 z"
/>
</Canvas>
Code: Select all
Ptr<Canvas> canvas = *new Canvas();
UIElementCollection* children = canvas->GetChildren();
Ptr<TextBlock> tb = *new TextBlock("I'm here");
tb->SetMargin(Thickness(30.0f));
children->Add(tb.GetPtr());
Ptr<Rectangle> rect = *new Rectangle();
rect->SetWidth(300.0f);
rect->SetHeight(150.0f);
Ptr<StreamGeometry> clip = *new StreamGeometry(
"M0,0 L300,0 300,150 0,150 z M20,20 L120,20 120,70 20,70 z"
);
rect->SetClip(clip.GetPtr());
children->Add(rect.GetPtr());
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 9 guests