Graphics Reference
In-Depth Information
2.
Next, we retrieve the current size of the SwapChainPanel element taking into
consideration the scale composition (that is, zoom).
public override int Width
{ get
{
return (int)(panel.RenderSize.Width *
panel.CompositionScaleX);
}
}
public override int Height
{ get
{
return (int)(panel.RenderSize.Height *
panel.CompositionScaleY);
}
}
public override SharpDX.Rectangle CurrentBounds
{
get
{
return new SharpDX.Rectangle(0, 0,
(int)panel.RenderSize.Width,
(int)panel.RenderSize.Height);
}
}
3.
Within Windows 8.1, a composition swap chain's visuals are exposed to touch scaling
and translation scenarios via a touch UI. The following code snippet shows how we
can apply this transformation:
protected void ScaleChanged()
{
// Resize the SwapChain appropriately
base.CreateSizeDependentResources(this);
// Retrieve SwapChain2 reference and apply 2D scaling
using ( var swapChain2 = this.SwapChain.
QueryInterface<SwapChain2>() )
{
// 2D affine transform matrix (inverse of scale)
Matrix3x2 inverseScale = new Matrix3x2();
 
Search WWH ::




Custom Search