Draw function convenience overloads

Implementation mostly by Damyan. Finishing up, resolving of todos, tests, and docs by Shawn.

API surface changes:
- Many new draw function overloads
- Remove CanvasEllipse and CanvasRoundedRectangle structs

Additional behavioral changes:

- Fixed bug where DrawText(emptyString) would throw (WinRT doesn't
  differentiate between null and empty strings, so this accidentally
  triggered our null check)

- Calling one of the DrawText overloads that takes a text format but passing
  null format used to throw. Now it uses default format options, the same as if
  you call the simple overloads that take no format argument at all. I think
  this is a good general principle: where we have both simple and complex
  versions of an API, it's good if passing null for the extra parameters of the
  complex version can give the same behavior as the simple form.

- Reduced the default font size when no format is specified from 96 to 32. This
  simple overload will mostly be for debug text, so the output should be
  readable but not huge.
This commit is contained in:
Shawn Hargreaves 2014-09-03 15:35:40 -07:00
Родитель 7dd7cf10d1
Коммит faf80a08d8
26 изменённых файлов: 11147 добавлений и 21444 удалений

Просмотреть файл

@ -31,7 +31,9 @@ canvasControl.Draw += canvasControl_Draw;
```cs
void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
args.DrawingSession.Clear(Colors.BlueViolet);
args.DrawingSession.Clear(Colors.CornflowerBlue);
args.DrawingSession.DrawEllipse(190, 125, 140, 40, Colors.Black, 6);
args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}
```

Просмотреть файл

@ -21,9 +21,10 @@ under the License.
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:canvas="using:Microsoft.Graphics.Canvas"
mc:Ignorable="d">
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<canvas:CanvasControl x:Name="canvasControl" />
</Grid>
</Page>

Просмотреть файл

@ -31,7 +31,9 @@ namespace SimpleSample
void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
args.DrawingSession.Clear(Colors.BlanchedAlmond);
args.DrawingSession.Clear(Colors.CornflowerBlue);
args.DrawingSession.DrawEllipse(190, 125, 140, 40, Colors.Black, 6);
args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}
}
}

Просмотреть файл

@ -34,7 +34,9 @@ namespace SimpleSample
void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
args.DrawingSession.Clear(Colors.BlanchedAlmond);
args.DrawingSession.Clear(Colors.CornflowerBlue);
args.DrawingSession.DrawEllipse(190, 125, 140, 40, Colors.Black, 6);
args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -25,7 +25,6 @@ namespace CsConsumer
public sealed partial class MainPage : Page
{
Random m_random = new Random();
CanvasSolidColorBrush m_brush;
CanvasBitmap m_bitmap_tiger;
enum DrawnContentType
@ -82,7 +81,6 @@ namespace CsConsumer
void m_canvasControl_CreateResources(CanvasControl sender, object args)
{
UpdateCanvasControlSize();
m_brush = new CanvasSolidColorBrush(sender, Colors.White);
}
private void OnRedrawClicked(object sender, RoutedEventArgs e)
@ -115,7 +113,7 @@ namespace CsConsumer
}
void DrawDashedLines(
CanvasDrawingSession ds,
CanvasSolidColorBrush canvasSolidColorBrush,
Color color,
int horizontalLimit,
int verticalLimit)
{
@ -126,7 +124,8 @@ namespace CsConsumer
{
ds.DrawLine(
NextRandomPoint(horizontalLimit, verticalLimit),
NextRandomPoint(horizontalLimit, verticalLimit), canvasSolidColorBrush,
NextRandomPoint(horizontalLimit, verticalLimit),
color,
5.0f,
strokeStyle);
}
@ -142,8 +141,11 @@ namespace CsConsumer
ds.Clear(NextRandomColor());
m_brush.Color = NextRandomColor();
Rect rect;
Point point;
float radiusX;
float radiusY;
switch (drawnContentType)
{
case DrawnContentType.Clear_Only:
@ -176,89 +178,95 @@ namespace CsConsumer
ds.DrawLine(
NextRandomPoint(horizontalLimit, verticalLimit),
NextRandomPoint(horizontalLimit, verticalLimit),
m_brush);
NextRandomColor());
break;
case DrawnContentType.Line_Thick:
ds.DrawLine(
NextRandomPoint(horizontalLimit, verticalLimit),
NextRandomPoint(horizontalLimit, verticalLimit),
m_brush,
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Rectangle_Thin:
ds.DrawRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
m_brush);
NextRandomColor());
break;
case DrawnContentType.Rectangle_Thick:
ds.DrawRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
m_brush,
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Rectangle_Filled:
ds.FillRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
m_brush);
NextRandomColor());
break;
case DrawnContentType.RoundedRectangle_Thin:
NextRandomRoundedRect(horizontalLimit, verticalLimit, out rect, out radiusX, out radiusY);
ds.DrawRoundedRectangle(
NextRandomRoundedRect(horizontalLimit, verticalLimit),
m_brush);
rect, radiusX, radiusY,
NextRandomColor());
break;
case DrawnContentType.RoundedRectangle_Thick:
NextRandomRoundedRect(horizontalLimit, verticalLimit, out rect, out radiusX, out radiusY);
ds.DrawRoundedRectangle(
NextRandomRoundedRect(horizontalLimit, verticalLimit),
m_brush,
rect, radiusX, radiusY,
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Ellipse_Thin:
NextRandomEllipse(horizontalLimit, verticalLimit, out point, out radiusX, out radiusY);
ds.DrawEllipse(
NextRandomEllipse(horizontalLimit, verticalLimit),
m_brush);
point, radiusX, radiusY,
NextRandomColor());
break;
case DrawnContentType.Ellipse_Thick:
NextRandomEllipse(horizontalLimit, verticalLimit, out point, out radiusX, out radiusY);
ds.DrawEllipse(
NextRandomEllipse(horizontalLimit, verticalLimit),
m_brush,
point, radiusX, radiusY,
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Ellipse_Fill:
NextRandomEllipse(horizontalLimit, verticalLimit, out point, out radiusX, out radiusY);
ds.FillEllipse(
NextRandomEllipse(horizontalLimit, verticalLimit),
m_brush);
point, radiusX, radiusY,
NextRandomColor());
break;
case DrawnContentType.Circle_Fill:
ds.FillCircle(
NextRandomPoint(horizontalLimit, verticalLimit),
100,
m_brush);
NextRandomColor());
break;
case DrawnContentType.Dashed_Lines:
DrawDashedLines(ds, m_brush, horizontalLimit, verticalLimit);
DrawDashedLines(ds, NextRandomColor(), horizontalLimit, verticalLimit);
break;
case DrawnContentType.Text:
var p = NextRandomPoint(horizontalLimit, verticalLimit);
var x = p.X;
var y = p.Y;
ds.DrawLine(new Point(x, 0), new Point(x, verticalLimit), m_brush);
ds.DrawLine(new Point(0, y), new Point(horizontalLimit, y), m_brush);
var color = NextRandomColor();
ds.DrawLine(new Point(x, 0), new Point(x, verticalLimit), color);
ds.DrawLine(new Point(0, y), new Point(horizontalLimit, y), color);
ds.DrawText(
"Centered",
p,
m_brush,
color,
new CanvasTextFormat()
{
FontSize = 18,
@ -267,11 +275,11 @@ namespace CsConsumer
});
var r = NextRandomRect(horizontalLimit, verticalLimit);
ds.DrawRectangle(r, m_brush);
ds.DrawRectangle(r, color);
ds.DrawText(
m_quiteLongText,
r,
m_brush,
NextRandomColor(),
new CanvasTextFormat()
{
FontFamily = "Comic Sans MS",
@ -282,23 +290,23 @@ namespace CsConsumer
break;
case DrawnContentType.Test_Scene0_Default:
GeometryTestScene0.DrawGeometryTestScene(ds, m_brush, TestSceneRenderingType.Default);
GeometryTestScene0.DrawGeometryTestScene(ds, TestSceneRenderingType.Default);
break;
case DrawnContentType.Test_Scene0_Wireframe:
GeometryTestScene0.DrawGeometryTestScene(ds, m_brush, TestSceneRenderingType.Wireframe);
GeometryTestScene0.DrawGeometryTestScene(ds, TestSceneRenderingType.Wireframe);
break;
case DrawnContentType.Test_Scene1_Default:
GeometryTestScene1.DrawGeometryTestScene(ds, m_brush, TestSceneRenderingType.Default);
GeometryTestScene1.DrawGeometryTestScene(ds, TestSceneRenderingType.Default);
break;
case DrawnContentType.Test_Scene1_Randomized:
GeometryTestScene1.DrawGeometryTestScene(ds, m_brush, TestSceneRenderingType.Randomized);
GeometryTestScene1.DrawGeometryTestScene(ds, TestSceneRenderingType.Randomized);
break;
case DrawnContentType.Test_Scene1_Wireframe:
GeometryTestScene1.DrawGeometryTestScene(ds, m_brush, TestSceneRenderingType.Wireframe);
GeometryTestScene1.DrawGeometryTestScene(ds, TestSceneRenderingType.Wireframe);
break;
default:
@ -307,22 +315,18 @@ namespace CsConsumer
}
}
private CanvasEllipse NextRandomEllipse(int horizontalLimit, int verticalLimit)
private void NextRandomEllipse(int horizontalLimit, int verticalLimit, out Point point, out float radiusX, out float radiusY)
{
CanvasEllipse ellipse = new CanvasEllipse();
ellipse.Point = NextRandomPoint(horizontalLimit, verticalLimit);
ellipse.RadiusX = m_random.Next(horizontalLimit / 2);
ellipse.RadiusY = m_random.Next(verticalLimit / 2);
return ellipse;
point = NextRandomPoint(horizontalLimit, verticalLimit);
radiusX = m_random.Next(horizontalLimit / 2);
radiusY = m_random.Next(verticalLimit / 2);
}
private CanvasRoundedRectangle NextRandomRoundedRect(int horizontalLimit, int verticalLimit)
private void NextRandomRoundedRect(int horizontalLimit, int verticalLimit, out Rect rectangle, out float radiusX, out float radiusY)
{
CanvasRoundedRectangle roundedRectangle = new CanvasRoundedRectangle();
roundedRectangle.Rect = NextRandomRect(horizontalLimit, verticalLimit);
roundedRectangle.RadiusX = m_random.Next((int)(roundedRectangle.Rect.Width) / 2);
roundedRectangle.RadiusY = m_random.Next((int)(roundedRectangle.Rect.Height) / 2);
return roundedRectangle;
rectangle = NextRandomRect(horizontalLimit, verticalLimit);
radiusX = m_random.Next((int)(rectangle.Width) / 2);
radiusY = m_random.Next((int)(rectangle.Height) / 2);
}
private Rect NextRandomRect(int horizontalLimit, int verticalLimit)
@ -351,7 +355,7 @@ namespace CsConsumer
ds.DrawText(
"Please load bitmap before drawing it",
new Point(x, y),
m_brush,
Colors.Red,
new CanvasTextFormat()
{
FontSize = 24,

Просмотреть файл

@ -44,120 +44,111 @@ namespace CsConsumer
}
}
public void FillRectangle(Rect rect, CanvasSolidColorBrush brush)
public void FillRectangle(Rect rect, Color color)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.FillRectangle(rect, brush);
m_drawingSession.FillRectangle(rect, color);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawRectangle(rect, brush);
m_drawingSession.DrawRectangle(rect, Colors.Black);
}
}
public void DrawLine(Point p1, Point p2, CanvasSolidColorBrush brush, float strokeWidth)
public void DrawLine(Point p1, Point p2, Color color, float strokeWidth)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawLine(p1, p2, brush, strokeWidth);
m_drawingSession.DrawLine(p1, p2, color, strokeWidth);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawLine(p1, p2, brush);
m_drawingSession.DrawLine(p1, p2, Colors.Black);
}
}
public void DrawLine(Point p1, Point p2, CanvasSolidColorBrush brush, float strokeWidth, CanvasStrokeStyle strokeStyle)
public void DrawLine(Point p1, Point p2, Color color, float strokeWidth, CanvasStrokeStyle strokeStyle)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawLine(p1, p2, brush, strokeWidth, strokeStyle);
m_drawingSession.DrawLine(p1, p2, color, strokeWidth, strokeStyle);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawLine(p1, p2, brush);
m_drawingSession.DrawLine(p1, p2, Colors.Black);
}
}
public void FillEllipse(CanvasEllipse ellipse, CanvasSolidColorBrush brush)
public void FillEllipse(Point center, float radiusX, float radiusY, Color color)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.FillEllipse(ellipse, brush);
m_drawingSession.FillEllipse(center, radiusX, radiusY, color);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawEllipse(ellipse, brush);
m_drawingSession.DrawEllipse(center, radiusX, radiusY, Colors.Black);
}
}
public void DrawEllipse(CanvasEllipse ellipse, CanvasSolidColorBrush brush, float strokeWidth)
public void DrawEllipse(Point center, float radiusX, float radiusY, Color color, float strokeWidth)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawEllipse(ellipse, brush, strokeWidth);
m_drawingSession.DrawEllipse(center, radiusX, radiusY, color, strokeWidth);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawEllipse(ellipse, brush);
m_drawingSession.DrawEllipse(center, radiusX, radiusY, Colors.Black);
}
}
public void DrawEllipse(CanvasEllipse ellipse, CanvasSolidColorBrush brush, float strokeWidth, CanvasStrokeStyle strokeStyle)
public void DrawEllipse(Point center, float radiusX, float radiusY, Color color, float strokeWidth, CanvasStrokeStyle strokeStyle)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawEllipse(ellipse, brush, strokeWidth, strokeStyle);
m_drawingSession.DrawEllipse(center, radiusX, radiusY, color, strokeWidth, strokeStyle);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawEllipse(ellipse, brush);
m_drawingSession.DrawEllipse(center, radiusX, radiusY, Colors.Black);
}
}
public void FillCircle(Point centerPoint, float radius, CanvasSolidColorBrush brush)
public void FillCircle(Point centerPoint, float radius, Color color)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.FillCircle(centerPoint, radius, brush);
m_drawingSession.FillCircle(centerPoint, radius, color);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawCircle(centerPoint, radius, brush);
m_drawingSession.DrawCircle(centerPoint, radius, Colors.Black);
}
}
public void DrawCircle(Point centerPoint, float radius, CanvasSolidColorBrush brush, float strokeWidth)
public void DrawCircle(Point centerPoint, float radius, Color color, float strokeWidth)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawCircle(centerPoint, radius, brush, strokeWidth);
m_drawingSession.DrawCircle(centerPoint, radius, color, strokeWidth);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawCircle(centerPoint, radius, brush);
m_drawingSession.DrawCircle(centerPoint, radius, Colors.Black);
}
}
public void DrawCircle(Point centerPoint, float radius, CanvasSolidColorBrush brush, float strokeWidth, CanvasStrokeStyle strokeStyle)
public void DrawCircle(Point centerPoint, float radius, Color color, float strokeWidth, CanvasStrokeStyle strokeStyle)
{
if (m_renderingType == TestSceneRenderingType.Default)
{
m_drawingSession.DrawCircle(centerPoint, radius, brush, strokeWidth, strokeStyle);
m_drawingSession.DrawCircle(centerPoint, radius, color, strokeWidth, strokeStyle);
}
else
{
brush.Color = Colors.Black;
m_drawingSession.DrawCircle(centerPoint, radius, brush);
m_drawingSession.DrawCircle(centerPoint, radius, Colors.Black);
}
}

Просмотреть файл

@ -38,7 +38,6 @@ under the License.
</ListBox.Items>
</ListBox>
<canvas:CanvasControl x:Name="canvas" Grid.Column="1" Margin="5"
Draw="Canvas_Draw"
CreateResources="Canvas_CreateResources"/>
Draw="Canvas_Draw"/>
</Grid>
</UserControl>

Просмотреть файл

@ -11,6 +11,7 @@
// under the License.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Numerics;
using System;
using System.Collections.Generic;
using Windows.Foundation;
@ -57,13 +58,6 @@ namespace ExampleGallery
this.canvas.Invalidate();
}
CanvasSolidColorBrush brush;
void Canvas_CreateResources(CanvasControl sender, object args)
{
this.brush = new CanvasSolidColorBrush(sender, Colors.AntiqueWhite);
}
void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
var ds = args.DrawingSession;
@ -82,8 +76,8 @@ namespace ExampleGallery
private void DrawLine(CanvasControl sender, CanvasDrawingSession ds)
{
var width = sender.ActualWidth;
var height = sender.ActualHeight;
var width = (float)sender.ActualWidth;
var height = (float)sender.ActualHeight;
var middle = height / 2;
@ -91,86 +85,80 @@ namespace ExampleGallery
for (int i = 0; i < steps; ++i)
{
var mu = (double)i / steps;
var a = mu * Math.PI * 2;
var mu = (float)i / steps;
var a = (float)(mu * Math.PI * 2);
byte c = (byte)((Math.Sin(a) + 1) * 127.5);
this.brush.Color = Color.FromArgb(255, 128, 128, c);
var color = GradientColor(mu);
var x = width * mu;
var y = middle + Math.Sin(a) * (middle * 0.3);
var y = (float)(middle + Math.Sin(a) * (middle * 0.3));
var strokeWidth = (float)(Math.Cos(a) + 1) * 5;
ds.DrawLine(new Point(x, 0), new Point(x, y), this.brush, strokeWidth);
ds.DrawLine(new Point(x, height), new Point(x, y), this.brush, 10 - strokeWidth);
ds.DrawLine(x, 0, x, y, color, strokeWidth);
ds.DrawLine(x, height, x, y, color, 10 - strokeWidth);
}
}
private void DrawRectangle(CanvasControl sender, CanvasDrawingSession ds)
{
var width = sender.ActualWidth;
var height = sender.ActualHeight;
var width = (float)sender.ActualWidth;
var height = (float)sender.ActualHeight;
int steps = Math.Min((int)(width / 10), 20);
for (int i = 0; i < steps; ++i)
{
var mu = (double)i / steps;
var a = mu * Math.PI * 2;
var mu = (float)i / steps;
mu *= 0.5;
var color = GradientColor(mu);
mu *= 0.5f;
var x = mu * width;
var y = mu * height;
var xx = (1 - mu) * width;
var yy = (1 - mu) * height;
byte c = (byte)((Math.Sin(a) + 1) * 127.5);
this.brush.Color = Color.FromArgb(255, 90, 128, c);
ds.DrawRectangle(new Rect(new Point(x, y), new Point(xx, yy)), this.brush, 2.0f);
ds.DrawRectangle(x, y, xx - x, yy - y, color, 2.0f);
}
}
private void DrawRoundedRectangle(CanvasControl sender, CanvasDrawingSession ds)
{
var width = sender.ActualWidth;
var height = sender.ActualHeight;
var width = (float)sender.ActualWidth;
var height = (float)sender.ActualHeight;
int steps = Math.Min((int)(width / 30), 10);
for (int i = 0; i < steps; ++i)
{
var mu = (double)i / steps;
var a = mu * Math.PI * 2;
var mu = (float)i / steps;
mu *= 0.5;
var color = GradientColor(mu);
mu *= 0.5f;
var x = mu * width;
var y = mu * height;
var xx = (1 - mu) * width;
var yy = (1 - mu) * height;
byte c = (byte)((Math.Sin(a) + 1) * 127.5);
this.brush.Color = Color.FromArgb(255, 90, 128, c);
var radius = mu * 50.0f;
ds.DrawRoundedRectangle(
new CanvasRoundedRectangle()
{
RadiusX=(float)(mu * 50),
RadiusY = (float)(mu * 50),
Rect=new Rect(new Point(x,y), new Point(xx,yy))
},
this.brush,
x, y,
xx-x, yy-y,
radius, radius,
color,
2.0f);
}
}
private void DrawCircles(CanvasControl sender, CanvasDrawingSession ds)
{
var width = sender.ActualWidth;
var height = sender.ActualHeight;
float width = (float)sender.ActualWidth;
float height = (float)sender.ActualHeight;
float endpointMargin = 100;
float controlMarginX = endpointMargin * 4;
@ -178,7 +166,7 @@ namespace ExampleGallery
for (int i = 0; i < 25; i++)
{
Point[] bez = new Point[4];
Vector2[] bez = new Vector2[4];
int n = (i * 24) + 9 - (i / 2);
for (int k = 0; k < 3; k++)
@ -195,25 +183,27 @@ namespace ExampleGallery
float t = 0;
for (int step = 0; step < nSteps; step++)
{
double s = 1 - t;
double ss = s * s;
double sss = ss * s;
double tt = t * t;
double ttt = tt * t;
double x = (sss * bez[0].X) + (3 * ss * t * bez[1].X) + (3 * s * tt * bez[2].X) + (ttt * bez[3].X);
double y = (sss * bez[0].Y) + (3 * ss * t * bez[1].Y) + (3 * s * tt * bez[2].Y) + (ttt * bez[3].Y);
float radius = (float)(ttt * 100);
float strokeWidth = (float)((0.5 - Math.Abs(ss - 0.5)) * 10);
float s = 1 - t;
float ss = s * s;
float sss = ss * s;
float tt = t * t;
float ttt = tt * t;
float x = (sss * bez[0].X) + (3 * ss * t * bez[1].X) + (3 * s * tt * bez[2].X) + (ttt * bez[3].X);
float y = (sss * bez[0].Y) + (3 * ss * t * bez[1].Y) + (3 * s * tt * bez[2].Y) + (ttt * bez[3].Y);
float radius = ttt * 100;
float strokeWidth = (0.5f - Math.Abs(ss - 0.5f)) * 10;
var a = t * Math.PI * 2;
byte c = (byte)((Math.Sin(a) + 1) * 127.5);
this.brush.Color = Color.FromArgb(255, 90, 128, c);
ds.DrawCircle(new Point(x, y), radius, this.brush, strokeWidth);
ds.DrawCircle(x, y, radius, GradientColor(t), strokeWidth);
t += tStep;
}
}
}
private static Color GradientColor(float mu)
{
byte c = (byte)((Math.Sin(mu * Math.PI * 2) + 1) * 127.5);
return Color.FromArgb(255, 90, 128, c);
}
}
}

Просмотреть файл

@ -119,25 +119,18 @@ namespace ExampleGallery
this.strokeStyle);
ds.DrawRoundedRectangle(
new CanvasRoundedRectangle()
{
Rect = bottomLeftRect,
RadiusX = (float)(width * 0.1),
RadiusY = (float)(height * 0.1)
},
bottomLeftRect,
(float)(width * 0.1),
(float)(height * 0.1),
this.brush,
strokeWidth,
this.strokeStyle);
ds.DrawEllipse(
new CanvasEllipse()
{
Point = new Point(
bottomRightRect.Left + bottomRightRect.Width * 0.5,
bottomRightRect.Top + bottomRightRect.Height * 0.5),
RadiusX = (float)(bottomRightRect.Width * 0.5),
RadiusY = (float)(bottomRightRect.Height * 0.5)
},
(float)(bottomRightRect.Left + bottomRightRect.Width * 0.5),
(float)(bottomRightRect.Top + bottomRightRect.Height * 0.5),
(float)(bottomRightRect.Width * 0.5),
(float)(bottomRightRect.Height * 0.5),
this.brush,
strokeWidth,
this.strokeStyle);

Просмотреть файл

@ -49,8 +49,5 @@ under the License.
<Field Name="CLEARTYPE" ProjectedNameOverride="ClearType"/>
</Enum>
<Enum Name="UNIT_MODE" ShouldProject="true" ProjectedNameOverride="Units"/>
<Struct Name="ROUNDED_RECT" ShouldProject="true" ProjectedNameOverride="RoundedRectangle"/>
<Struct Name="ELLIPSE" ShouldProject="true"/>
</Namespace>
</Settings>

Просмотреть файл

@ -115,20 +115,6 @@ under the License.
</member>
<member name="T:Microsoft.Graphics.Canvas.CanvasEllipse">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasEllipse.Point">
<summary>The center point of the ellipse.</summary>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasEllipse.RadiusX">
<summary>The X axis (horizontal) radius of the ellipse.</summary>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasEllipse.RadiusY">
<summary>The Y axis (vertical) radius of the ellipse.</summary>
</member>
<member name="T:Microsoft.Graphics.Canvas.CanvasLineJoin">
<summary>Describes the shape that joins two lines or segments.</summary>
<remarks>
@ -154,32 +140,6 @@ under the License.
</member>
<member name="T:Microsoft.Graphics.Canvas.CanvasRoundedRectangle">
<summary>Describes a rectangle with rounded corners.</summary>
<remarks>
<p>Each corner of the rectangle specified by Rect is replaced with a quarter ellipse,
with a radius in each direction specified by RadiusX and RadiusY.</p>
<p>If the RadiusX is greater than or equal to half the width of the rectangle,
and the RadiusY is greater than or equal to one-half the height, the
rounded rectangle is an ellipse with the same width and height as the rect.</p>
<p>Even when both RadiusX and RadiusY are zero, the rounded rectangle is
different from a rectangle. When stroked, the corners of the rounded
rectangle are roundly joined, not mitered (square).</p>
</remarks>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasRoundedRectangle.Rect">
<summary>The coordinates of the rectangle.</summary>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasRoundedRectangle.RadiusX">
<summary>The X axis (horizontal) radius for the quarter ellipse that is drawn to replace every corner of the rectangle.</summary>
</member>
<member name="F:Microsoft.Graphics.Canvas.CanvasRoundedRectangle.RadiusY">
<summary>The Y axis (vertical) radius for the quarter ellipse that is drawn to replace every corner of the rectangle.</summary>
</member>
<member name="T:Microsoft.Graphics.Canvas.CanvasStrokeTransformBehavior">
<summary>Defines how the world transform, dots per inch (DPI), and stroke width affect the shape of the pen used to stroke a primitive.</summary>
</member>

Просмотреть файл

@ -53,13 +53,15 @@ under the License.
void myWidget_CreateResources(CanvasControl sender, object args)
{
redBrush = new CanvasSolidColorBrush(sender, Colors.Red);
// Create any resources needed by the Draw event handler.
// Load bitmaps, create brushes, etc.
}
void myWidget_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
args.DrawingSession.Clear(Colors.CornflowerBlue);
args.DrawingSession.DrawText("Hello, world!", new Point(42, 42), redBrush);
args.DrawingSession.DrawEllipse(190, 125, 140, 40, Colors.Black, 6);
args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}
}
</code>

Просмотреть файл

@ -36,69 +36,285 @@ under the License.
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.Clear(Windows.UI.Color)">
<summary>Clears to the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawImage(Microsoft.Graphics.Canvas.ICanvasImage)">
<summary>Draws an image positioned at the origin.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawImage(Microsoft.Graphics.Canvas.ICanvasImage,System.Single,System.Single)">
<summary>Draws an image at the specified position.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawImage(Microsoft.Graphics.Canvas.ICanvasImage,Windows.Foundation.Point)">
<summary>Draws an image at the specified position.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a line of single unit width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a line of the specified width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a line of the specified width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws a line of single unit width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a line of the specified width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a line of the specified width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a line of single unit width.</summary>
<summary>Draws a line of single unit width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a line of the specified width.</summary>
<summary>Draws a line of the specified width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a line of the specified width, using a custom stroke style.</summary>
<summary>Draws a line of the specified width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Windows.UI.Color)">
<summary>Draws a line of single unit width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Windows.UI.Color,System.Single)">
<summary>Draws a line of the specified width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawLine(Windows.Foundation.Point,Windows.Foundation.Point,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a line of the specified width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a rectangle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a rectangle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rectangle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws a rectangle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a rectangle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rectangle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a rectangle using single unit width.</summary>
<summary>Draws a rectangle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a rectangle using the specified width.</summary>
<summary>Draws a rectangle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rectangle using the specified width and a custom stroke style.</summary>
<summary>Draws a rectangle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Windows.UI.Color)">
<summary>Draws a rectangle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Windows.UI.Color,System.Single)">
<summary>Draws a rectangle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRectangle(Windows.Foundation.Rect,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rectangle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRectangle(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRectangle(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a rectangle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRectangle(Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the inside of a rectangle.</summary>
<summary>Fills the interior of a rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Microsoft.Graphics.Canvas.CanvasRoundedRectangle,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a rectangle with rounded corners and single unit width.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRectangle(Windows.Foundation.Rect,Windows.UI.Color)">
<summary>Fills the interior of a rectangle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Microsoft.Graphics.Canvas.CanvasRoundedRectangle,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a rectangle with rounded corners using the specified width.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a rounded rectangle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Microsoft.Graphics.Canvas.CanvasRoundedRectangle,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rectangle with rounded corners using the specified width and a custom stroke style.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a rounded rectangle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRoundedRectangle(Microsoft.Graphics.Canvas.CanvasRoundedRectangle,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the inside of a rounded rectangle.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rounded rectangle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Microsoft.Graphics.Canvas.CanvasEllipse,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws an ellipse using single unit width.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws a rounded rectangle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Microsoft.Graphics.Canvas.CanvasEllipse,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws an ellipse using the specified width.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a rounded rectangle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Microsoft.Graphics.Canvas.CanvasEllipse,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws an ellipse using the specified width and a custom stroke style.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rounded rectangle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillEllipse(Microsoft.Graphics.Canvas.CanvasEllipse,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the inside of an ellipse.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a rounded rectangle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Point,Microsoft.Graphics.Canvas.ICanvasBrush)">
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a rounded rectangle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rounded rectangle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws a rounded rectangle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a rounded rectangle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a rounded rectangle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a rounded rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRoundedRectangle(System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a rounded rectangle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a rounded rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillRoundedRectangle(Windows.Foundation.Rect,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a rounded rectangle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>It's like a circle, but squashed. Using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>It's like a circle, but squashed. Using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>It's like a circle, but squashed. Using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>It's like a circle, but squashed. Using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>It's like a circle, but squashed. Using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>It's like a circle, but squashed. Using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Windows.UI.Color)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse(Windows.Foundation.Point,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>It's like a circle, but squashed.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillEllipse(System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of an ellipse, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillEllipse(System.Single,System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a ellipse with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillEllipse(Windows.Foundation.Point,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of an ellipse, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillEllipse(Windows.Foundation.Point,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a ellipse with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a circle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a circle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a circle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws a circle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a circle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(System.Single,System.Single,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a circle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a circle of single unit stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a circle of the specified stroke width, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a circle of the specified stroke width, using a brush to define the color and with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Windows.UI.Color)">
<summary>Draws a circle of single unit stroke width and the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Windows.UI.Color,System.Single)">
<summary>Draws a circle of the specified stroke width and color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Windows.UI.Color,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a circle of the specified stroke width and color, with a custom stroke style.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillCircle(System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a circle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillCircle(System.Single,System.Single,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a circle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a circle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillCircle(Windows.Foundation.Point,System.Single,Windows.UI.Color)">
<summary>Fills the interior of a circle with the specified color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,System.Single,System.Single,Windows.UI.Color)">
<summary>Draws text using a default font.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Point,Windows.UI.Color)">
<summary>Draws text using a default font.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text at the specified position, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,System.Single,System.Single,Windows.UI.Color,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text at the specified position.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Point,Microsoft.Graphics.Canvas.ICanvasBrush,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text using the specified text format.</summary>
<summary>Draws text at the specified position, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws text using a default font.</summary>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Point,Windows.UI.Color,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text at the specified position.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,System.Single,System.Single,System.Single,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text inside the specified rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,System.Single,System.Single,System.Single,System.Single,Windows.UI.Color,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text inside the specified rectangle.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Rect,Microsoft.Graphics.Canvas.ICanvasBrush,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text using the specified text format.</summary>
<summary>Draws text inside the specified rectangle, using a brush to define the color.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawText(System.String,Windows.Foundation.Rect,Windows.UI.Color,Microsoft.Graphics.Canvas.CanvasTextFormat)">
<summary>Draws text inside the specified rectangle.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.Dispose">
<summary>Releases all resources used by the CanvasDrawingSession.</summary>
</member>
@ -120,17 +336,5 @@ under the License.
<member name="P:Microsoft.Graphics.Canvas.CanvasDrawingSession.Device">
<summary>Gets the underlying device used by this drawing session.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.FillCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Fills the interior of a circle.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush)">
<summary>Draws a circle using a single unit width.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single)">
<summary>Draws a circle using the specified width.</summary>
</member>
<member name="M:Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle(Windows.Foundation.Point,System.Single,Microsoft.Graphics.Canvas.ICanvasBrush,System.Single,Microsoft.Graphics.Canvas.CanvasStrokeStyle)">
<summary>Draws a circle using the specified width, and the specified stroke style.</summary>
</member>
</members>
</doc>

Просмотреть файл

@ -91,20 +91,4 @@ namespace Microsoft.Graphics.Canvas
Add = (int)3
} CanvasBlend;
[version(VERSION)]
typedef struct CanvasEllipse
{
Windows.Foundation.Point Point;
float RadiusX;
float RadiusY;
} CanvasEllipse;
[version(VERSION)]
typedef struct CanvasRoundedRectangle
{
Windows.Foundation.Rect Rect;
float RadiusX;
float RadiusY;
} CanvasRoundedRectangle;
}

Просмотреть файл

@ -30,6 +30,36 @@ namespace Microsoft.Graphics.Canvas
{
HRESULT Clear([in] Windows.UI.Color color);
//
// Some of these methods have large numbers of overloads.
//
// The following naming scheme is used:
//
// {METHOD}(AtCoords)?With(Brush|Color)(And{PARAMn})*
//
// Where {METHOD} is the method name and {PARAMn} is the nth additional
// parameter.
//
// Examples:
//
// DrawLineWithBrush(Point, Point, Brush) (0 additional parameters)
// DrawLineAtCoordsWithBrush(float, float, float, float, Brush) (0 additional parameters)
// DrawLineWithColor(Point, Point, Color) (0 additional parameters)
// DrawLineAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(float, float, float, float, Brush, float, StrokeStyle) (2 additional parameters)
//
// The overloads are sorted by:
//
// - additional parameter count
// - Brush before Color
// - without-AtCoords before with-AtCoords
//
// Default overloads are chosen by picking the richest and most complete functionality:
//
// - Prefer WithBrush over WithColor
// - Prefer packed structures (eg. Point) over expanded (AtCoords) variants
//
//
// DrawImage
//
@ -39,117 +69,526 @@ namespace Microsoft.Graphics.Canvas
[overload("DrawImage")]
HRESULT DrawImage(
[in] ICanvasImage* image);
[overload("DrawImage")]
HRESULT DrawImageWithOffset(
[in] ICanvasImage* image,
[in] Windows.Foundation.Point offset);
[overload("DrawImage")]
HRESULT DrawImageAtCoords(
[in] ICanvasImage* image,
[in] float x,
[in] float y);
[overload("DrawImage")]
HRESULT DrawImageAtOrigin(
[in] ICanvasImage* image);
//
// DrawLine
//
[overload("DrawLine")]
HRESULT DrawLine(
// 0 additional parameters
[overload("DrawLine"), default_overload]
HRESULT DrawLineWithBrush(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] ICanvasBrush* brush);
[overload("DrawLine")]
HRESULT DrawLineWithStrokeWidth(
HRESULT DrawLineAtCoordsWithBrush(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] ICanvasBrush* brush);
[overload("DrawLine")]
HRESULT DrawLineWithColor(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] Windows.UI.Color color);
[overload("DrawLine")]
HRESULT DrawLineAtCoordsWithColor(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] Windows.UI.Color color);
// 1 additional parameter (StrokeWidth)
[overload("DrawLine"), default_overload]
HRESULT DrawLineWithBrushAndStrokeWidth(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawLine"), default_overload]
HRESULT DrawLineAtCoordsWithBrushAndStrokeWidth(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawLine")]
HRESULT DrawLineWithStrokeWidthAndStrokeStyle(
HRESULT DrawLineWithColorAndStrokeWidth(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] Windows.UI.Color color,
[in] float strokeWidth);
[overload("DrawLine")]
HRESULT DrawLineAtCoordsWithColorAndStrokeWidth(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] Windows.UI.Color color,
[in] float strokeWidth);
// 2 additional parameters (StrokeWidth, StrokeStyle)
[overload("DrawLine"), default_overload]
HRESULT DrawLineWithBrushAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawLine"), default_overload]
HRESULT DrawLineAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawLine")]
HRESULT DrawLineWithColorAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point point0,
[in] Windows.Foundation.Point point1,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawLine")]
HRESULT DrawLineAtCoordsWithColorAndStrokeWidthAndStrokeStyle(
[in] float x0,
[in] float y0,
[in] float x1,
[in] float y1,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
//
// DrawRectangle
//
[overload("DrawRectangle")]
HRESULT DrawRectangle(
// 0 additional parameters
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleWithBrush(
[in] Windows.Foundation.Rect rect,
[in] ICanvasBrush* brush);
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] ICanvasBrush* brush);
[overload("DrawRectangle")]
HRESULT DrawRectangleWithStrokeWidth(
HRESULT DrawRectangleWithColor(
[in] Windows.Foundation.Rect rect,
[in] Windows.UI.Color color);
[overload("DrawRectangle")]
HRESULT DrawRectangleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] Windows.UI.Color color);
// 1 additional parameter (StrokeWidth)
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleWithBrushAndStrokeWidth(
[in] Windows.Foundation.Rect rect,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleAtCoordsWithBrushAndStrokeWidth(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawRectangle")]
HRESULT DrawRectangleWithStrokeWidthAndStrokeStyle(
HRESULT DrawRectangleWithColorAndStrokeWidth(
[in] Windows.Foundation.Rect rect,
[in] Windows.UI.Color color,
[in] float strokeWidth);
[overload("DrawRectangle")]
HRESULT DrawRectangleAtCoordsWithColorAndStrokeWidth(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] Windows.UI.Color color,
[in] float strokeWidth);
// 2 additional parameters (StrokeWidth, StrokeStyle)
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleWithBrushAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Rect rect,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRectangle"), default_overload]
HRESULT DrawRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRectangle")]
HRESULT DrawRectangleWithColorAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Rect rect,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRectangle")]
HRESULT DrawRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
//
// FillRectangle
//
HRESULT FillRectangle(
[overload("FillRectangle"), default_overload]
HRESULT FillRectangleWithBrush(
[in] Windows.Foundation.Rect rect,
[in] ICanvasBrush* brush);
[overload("FillRectangle"), default_overload]
HRESULT FillRectangleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] ICanvasBrush* brush);
[overload("FillRectangle")]
HRESULT FillRectangleWithColor(
[in] Windows.Foundation.Rect rect,
[in] Windows.UI.Color color);
[overload("FillRectangle")]
HRESULT FillRectangleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] Windows.UI.Color color);
//
// DrawRoundedRectangle
//
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangle(
[in] CanvasRoundedRectangle roundedRectangle,
// 0 additional parameters
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleWithBrush(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleWithStrokeWidth(
[in] CanvasRoundedRectangle roundedRectangle,
HRESULT DrawRoundedRectangleWithColor(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
// 1 additional parameter (StrokeWidth)
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleWithBrushAndStrokeWidth(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidth(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleWithStrokeWidthAndStrokeStyle(
[in] CanvasRoundedRectangle roundedRectangle,
HRESULT DrawRoundedRectangleWithColorAndStrokeWidth(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleAtCoordsWithColorAndStrokeWidth(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth);
// 2 additional parameters (StrokeWidth, StrokeStyle)
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleWithBrushAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRoundedRectangle"), default_overload]
HRESULT DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleWithColorAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawRoundedRectangle")]
HRESULT DrawRoundedRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
//
// FillRoundedRectangle
//
HRESULT FillRoundedRectangle(
[in] CanvasRoundedRectangle roundedRectangle,
[overload("FillRoundedRectangle"), default_overload]
HRESULT FillRoundedRectangleWithBrush(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("FillRoundedRectangle"), default_overload]
HRESULT FillRoundedRectangleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("FillRoundedRectangle")]
HRESULT FillRoundedRectangleWithColor(
[in] Windows.Foundation.Rect rect,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
[overload("FillRoundedRectangle")]
HRESULT FillRoundedRectangleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
//
// DrawEllipse
//
[overload("DrawEllipse")]
HRESULT DrawEllipse(
[in] CanvasEllipse ellipse,
// 0 additional parameters
[overload("DrawEllipse"), default_overload]
HRESULT DrawEllipseWithBrush(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("DrawEllipse")]
HRESULT DrawEllipseWithStrokeWidth(
[in] CanvasEllipse ellipse,
HRESULT DrawEllipseAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("DrawEllipse")]
HRESULT DrawEllipseWithColor(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
[overload("DrawEllipse")]
HRESULT DrawEllipseAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
// 1 additional parameter (StrokeWidth)
[overload("DrawEllipse"), default_overload]
HRESULT DrawEllipseWithBrushAndStrokeWidth(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawEllipse")]
HRESULT DrawEllipseWithStrokeWidthAndStrokeStyle(
[in] CanvasEllipse ellipse,
HRESULT DrawEllipseAtCoordsWithBrushAndStrokeWidth(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawEllipse")]
HRESULT DrawEllipseWithColorAndStrokeWidth(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth);
[overload("DrawEllipse")]
HRESULT DrawEllipseAtCoordsWithColorAndStrokeWidth(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth);
// 2 additional parameters (StrokeWidth, StrokeStyle)
[overload("DrawEllipse"), default_overload]
HRESULT DrawEllipseWithBrushAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawEllipse"), default_overload]
HRESULT DrawEllipseAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawEllipse")]
HRESULT DrawEllipseWithColorAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawEllipse")]
HRESULT DrawEllipseAtCoordsWithColorAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
@ -157,74 +596,251 @@ namespace Microsoft.Graphics.Canvas
// FillEllipse
//
HRESULT FillEllipse(
[in] CanvasEllipse ellipse,
[in] ICanvasBrush* brush);
//
// FillCircle
//
HRESULT FillCircle(
[overload("FillEllipse"), default_overload]
HRESULT FillEllipseWithBrush(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("FillEllipse"), default_overload]
HRESULT FillEllipseAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] ICanvasBrush* brush);
[overload("FillEllipse")]
HRESULT FillEllipseWithColor(
[in] Windows.Foundation.Point centerPoint,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
[overload("FillEllipse")]
HRESULT FillEllipseAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float radiusX,
[in] float radiusY,
[in] Windows.UI.Color color);
//
// DrawCircle
//
[overload("DrawCircle")]
HRESULT DrawCircle(
// 0 additional parameters
[overload("DrawCircle"), default_overload]
HRESULT DrawCircleWithBrush(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] ICanvasBrush* brush);
[overload("DrawCircle")]
HRESULT DrawCircleWithStrokeWidth(
HRESULT DrawCircleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float radius,
[in] ICanvasBrush* brush);
[overload("DrawCircle")]
HRESULT DrawCircleWithColor(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] Windows.UI.Color color);
[overload("DrawCircle")]
HRESULT DrawCircleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float radius,
[in] Windows.UI.Color color);
// 1 additional parameter (StrokeWidth)
[overload("DrawCircle"), default_overload]
HRESULT DrawCircleWithBrushAndStrokeWidth(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawCircle")]
HRESULT DrawCircleWithStrokeWidthAndStrokeStyle(
HRESULT DrawCircleAtCoordsWithBrushAndStrokeWidth(
[in] float x,
[in] float y,
[in] float radius,
[in] ICanvasBrush* brush,
[in] float strokeWidth);
[overload("DrawCircle")]
HRESULT DrawCircleWithColorAndStrokeWidth(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] Windows.UI.Color color,
[in] float strokeWidth);
[overload("DrawCircle")]
HRESULT DrawCircleAtCoordsWithColorAndStrokeWidth(
[in] float x,
[in] float y,
[in] float radius,
[in] Windows.UI.Color color,
[in] float strokeWidth);
// 2 additional parameters (StrokeWidth, StrokeStyle)
[overload("DrawCircle"), default_overload]
HRESULT DrawCircleWithBrushAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawCircle"), default_overload]
HRESULT DrawCircleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float radius,
[in] ICanvasBrush* brush,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawCircle")]
HRESULT DrawCircleWithColorAndStrokeWidthAndStrokeStyle(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
[overload("DrawCircle")]
HRESULT DrawCircleAtCoordsWithColorAndStrokeWidthAndStrokeStyle(
[in] float x,
[in] float y,
[in] float radius,
[in] Windows.UI.Color color,
[in] float strokeWidth,
[in] CanvasStrokeStyle* strokeStyle);
//
// FillCircle
//
[overload("FillCircle"), default_overload]
HRESULT FillCircleWithBrush(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] ICanvasBrush* brush);
[overload("FillCircle"), default_overload]
HRESULT FillCircleAtCoordsWithBrush(
[in] float x,
[in] float y,
[in] float radius,
[in] ICanvasBrush* brush);
[overload("FillCircle")]
HRESULT FillCircleWithColor(
[in] Windows.Foundation.Point centerPoint,
[in] float radius,
[in] Windows.UI.Color color);
[overload("FillCircle")]
HRESULT FillCircleAtCoordsWithColor(
[in] float x,
[in] float y,
[in] float radius,
[in] Windows.UI.Color color);
//
// DrawText
//
[overload("DrawText")]
HRESULT DrawTextAtPoint(
[in] HSTRING text,
[in] Windows.Foundation.Point point,
[in] ICanvasBrush* brush);
// 0 additional parameters
[overload("DrawText")]
HRESULT DrawTextAtPointWithFormat(
HRESULT DrawTextAtPointWithColor(
[in] HSTRING text,
[in] Windows.Foundation.Point point,
[in] Windows.UI.Color color);
[overload("DrawText")]
HRESULT DrawTextAtPointCoordsWithColor(
[in] HSTRING text,
[in] float x,
[in] float y,
[in] Windows.UI.Color color);
// 1 additional parameter (TextFormat)
[overload("DrawText")]
HRESULT DrawTextAtPointWithBrushAndFormat(
[in] HSTRING text,
[in] Windows.Foundation.Point point,
[in] ICanvasBrush* brush,
[in] CanvasTextFormat* format);
[overload("DrawText"), default_overload]
HRESULT DrawText(
[in] HSTRING text,
[in] Windows.Foundation.Rect rectangle,
[in] ICanvasBrush* brush);
[overload("DrawText"), default_overload]
HRESULT DrawTextWithFormat(
HRESULT DrawTextAtRectWithBrushAndFormat(
[in] HSTRING text,
[in] Windows.Foundation.Rect rectangle,
[in] ICanvasBrush* brush,
[in] CanvasTextFormat* format);
[overload("DrawText"), default_overload]
HRESULT DrawTextAtPointCoordsWithBrushAndFormat(
[in] HSTRING text,
[in] float x,
[in] float y,
[in] ICanvasBrush* brush,
[in] CanvasTextFormat* format);
[overload("DrawText"), default_overload]
HRESULT DrawTextAtRectCoordsWithBrushAndFormat(
[in] HSTRING text,
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] ICanvasBrush* brush,
[in] CanvasTextFormat* format);
[overload("DrawText")]
HRESULT DrawTextAtPointWithColorAndFormat(
[in] HSTRING text,
[in] Windows.Foundation.Point point,
[in] Windows.UI.Color color,
[in] CanvasTextFormat* format);
[overload("DrawText")]
HRESULT DrawTextAtRectWithColorAndFormat(
[in] HSTRING text,
[in] Windows.Foundation.Rect rectangle,
[in] Windows.UI.Color color,
[in] CanvasTextFormat* format);
[overload("DrawText")]
HRESULT DrawTextAtPointCoordsWithColorAndFormat(
[in] HSTRING text,
[in] float x,
[in] float y,
[in] Windows.UI.Color color,
[in] CanvasTextFormat* format);
[overload("DrawText")]
HRESULT DrawTextAtRectCoordsWithColorAndFormat(
[in] HSTRING text,
[in] float x,
[in] float y,
[in] float w,
[in] float h,
[in] Windows.UI.Color color,
[in] CanvasTextFormat* format);
//
// State properties
//

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -62,6 +62,8 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
InspectableClass(RuntimeClass_Microsoft_Graphics_Canvas_CanvasDrawingSession, BaseTrust);
std::shared_ptr<ICanvasDrawingSessionAdapter> m_adapter;
ComPtr<ID2D1SolidColorBrush> m_solidColorBrush;
ComPtr<ICanvasTextFormat> m_defaultTextFormat;
//
// Contract:
@ -94,133 +96,699 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
IFACEMETHOD(Clear)(
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawImage)(
ICanvasImage* image) override;
//
// DrawImage
//
IFACEMETHOD(DrawImageWithOffset)(
IFACEMETHOD(DrawImage)(
ICanvasImage* image,
ABI::Windows::Foundation::Point offset) override;
IFACEMETHOD(DrawLine)(
IFACEMETHOD(DrawImageAtCoords)(
ICanvasImage* image,
float x,
float y) override;
IFACEMETHOD(DrawImageAtOrigin)(
ICanvasImage* image) override;
//
// DrawLine
//
// 0 additional parameters
IFACEMETHOD(DrawLineWithBrush)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawLineWithStrokeWidth)(
IFACEMETHOD(DrawLineAtCoordsWithBrush)(
float x0,
float y0,
float x1,
float y1,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawLineWithColor)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawLineAtCoordsWithColor)(
float x0,
float y0,
float x1,
float y1,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (StrokeWidth)
IFACEMETHOD(DrawLineWithBrushAndStrokeWidth)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawLineWithStrokeWidthAndStrokeStyle)(
IFACEMETHOD(DrawLineAtCoordsWithBrushAndStrokeWidth)(
float x0,
float y0,
float x1,
float y1,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawLineWithColorAndStrokeWidth)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ABI::Windows::UI::Color color,
float strokeWidth) override;
IFACEMETHOD(DrawLineAtCoordsWithColorAndStrokeWidth)(
float x0,
float y0,
float x1,
float y1,
ABI::Windows::UI::Color color,
float strokeWidth) override;
// 2 additional parameters (StrokeWidth, StrokeStyle)
IFACEMETHOD(DrawLineWithBrushAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawRectangle)(
IFACEMETHOD(DrawLineAtCoordsWithBrushAndStrokeWidthAndStrokeStyle)(
float x0,
float y0,
float x1,
float y1,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawLineWithColorAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawLineAtCoordsWithColorAndStrokeWidthAndStrokeStyle)(
float x0,
float y0,
float x1,
float y1,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
//
// DrawRectangle
//
// 0 additional parameters
IFACEMETHOD(DrawRectangleWithBrush)(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRectangleWithStrokeWidth)(
IFACEMETHOD(DrawRectangleAtCoordsWithBrush)(
float x,
float y,
float w,
float h,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRectangleWithColor)(
ABI::Windows::Foundation::Rect rect,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawRectangleAtCoordsWithColor)(
float x,
float y,
float w,
float h,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (StrokeWidth)
IFACEMETHOD(DrawRectangleWithBrushAndStrokeWidth)(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawRectangleWithStrokeWidthAndStrokeStyle)(
IFACEMETHOD(DrawRectangleAtCoordsWithBrushAndStrokeWidth)(
float x,
float y,
float w,
float h,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawRectangleWithColorAndStrokeWidth)(
ABI::Windows::Foundation::Rect rect,
ABI::Windows::UI::Color color,
float strokeWidth) override;
IFACEMETHOD(DrawRectangleAtCoordsWithColorAndStrokeWidth)(
float x,
float y,
float w,
float h,
ABI::Windows::UI::Color color,
float strokeWidth) override;
// 2 additional parameters (StrokeWidth, StrokeStyle)
IFACEMETHOD(DrawRectangleWithBrushAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(FillRectangle)(
IFACEMETHOD(DrawRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float w,
float h,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawRectangleWithColorAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Rect rect,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float w,
float h,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
//
// FillRectangle
//
IFACEMETHOD(FillRectangleWithBrush)(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRoundedRectangle)(
CanvasRoundedRectangle roundedRectangle,
IFACEMETHOD(FillRectangleAtCoordsWithBrush)(
float x,
float y,
float w,
float h,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRoundedRectangleWithStrokeWidth)(
CanvasRoundedRectangle roundedRectangle,
IFACEMETHOD(FillRectangleWithColor)(
ABI::Windows::Foundation::Rect rect,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(FillRectangleAtCoordsWithColor)(
float x,
float y,
float w,
float h,
ABI::Windows::UI::Color color) override;
//
// DrawRoundedRectangle
//
// 0 additional parameters
IFACEMETHOD(DrawRoundedRectangleWithBrush)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithBrush)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawRoundedRectangleWithColor)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithColor)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (StrokeWidth)
IFACEMETHOD(DrawRoundedRectangleWithBrushAndStrokeWidth)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawRoundedRectangleWithStrokeWidthAndStrokeStyle)(
CanvasRoundedRectangle roundedRectangle,
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidth)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawRoundedRectangleWithColorAndStrokeWidth)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth) override;
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithColorAndStrokeWidth)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth) override;
// 2 additional parameters (StrokeWidth, StrokeStyle)
IFACEMETHOD(DrawRoundedRectangleWithBrushAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(FillRoundedRectangle)(
CanvasRoundedRectangle roundedRectangle,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawEllipse)(
CanvasEllipse ellipse,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawEllipseWithStrokeWidth)(
CanvasEllipse ellipse,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawEllipseWithStrokeWidthAndStrokeStyle)(
CanvasEllipse ellipse,
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(FillEllipse)(
CanvasEllipse ellipse,
IFACEMETHOD(DrawRoundedRectangleWithColorAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawRoundedRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
//
// FillRoundedRectangle
//
IFACEMETHOD(FillRoundedRectangleWithBrush)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawCircle)(
IFACEMETHOD(FillRoundedRectangleAtCoordsWithBrush)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(FillRoundedRectangleWithColor)(
ABI::Windows::Foundation::Rect rect,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(FillRoundedRectangleAtCoordsWithColor)(
float x,
float y,
float w,
float h,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
//
// DrawEllipse
//
// 0 additional parameters
IFACEMETHOD(DrawEllipseWithBrush)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawEllipseAtCoordsWithBrush)(
float x,
float y,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawEllipseWithColor)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawEllipseAtCoordsWithColor)(
float x,
float y,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (StrokeWidth)
IFACEMETHOD(DrawEllipseWithBrushAndStrokeWidth)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawEllipseAtCoordsWithBrushAndStrokeWidth)(
float x,
float y,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawEllipseWithColorAndStrokeWidth)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth) override;
IFACEMETHOD(DrawEllipseAtCoordsWithColorAndStrokeWidth)(
float x,
float y,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth) override;
// 2 additional parameters (StrokeWidth, StrokeStyle)
IFACEMETHOD(DrawEllipseWithBrushAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawEllipseAtCoordsWithBrushAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float radiusX,
float radiusY,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawEllipseWithColorAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawEllipseAtCoordsWithColorAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
//
// FillEllipse
//
IFACEMETHOD(FillEllipseWithBrush)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(FillEllipseAtCoordsWithBrush)(
float x,
float y,
float radiusX,
float radiusY,
ICanvasBrush* brush) override;
IFACEMETHOD(FillEllipseWithColor)(
ABI::Windows::Foundation::Point centerPoint,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(FillEllipseAtCoordsWithColor)(
float x,
float y,
float radiusX,
float radiusY,
ABI::Windows::UI::Color color) override;
//
// DrawCircle
//
// 0 additional parameters
IFACEMETHOD(DrawCircleWithBrush)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawCircleWithStrokeWidth)(
IFACEMETHOD(DrawCircleAtCoordsWithBrush)(
float x,
float y,
float radius,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawCircleWithColor)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawCircleAtCoordsWithColor)(
float x,
float y,
float radius,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (StrokeWidth)
IFACEMETHOD(DrawCircleWithBrushAndStrokeWidth)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawCircleWithStrokeWidthAndStrokeStyle)(
IFACEMETHOD(DrawCircleAtCoordsWithBrushAndStrokeWidth)(
float x,
float y,
float radius,
ICanvasBrush* brush,
float strokeWidth) override;
IFACEMETHOD(DrawCircleWithColorAndStrokeWidth)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ABI::Windows::UI::Color color,
float strokeWidth) override;
IFACEMETHOD(DrawCircleAtCoordsWithColorAndStrokeWidth)(
float x,
float y,
float radius,
ABI::Windows::UI::Color color,
float strokeWidth) override;
// 2 additional parameters (StrokeWidth, StrokeStyle)
IFACEMETHOD(DrawCircleWithBrushAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(FillCircle)(
IFACEMETHOD(DrawCircleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float radius,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawCircleWithColorAndStrokeWidthAndStrokeStyle)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
IFACEMETHOD(DrawCircleAtCoordsWithColorAndStrokeWidthAndStrokeStyle)(
float x,
float y,
float radius,
ABI::Windows::UI::Color color,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override;
//
// FillCircle
//
IFACEMETHOD(FillCircleWithBrush)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawTextAtPoint)(
IFACEMETHOD(FillCircleAtCoordsWithBrush)(
float x,
float y,
float radius,
ICanvasBrush* brush) override;
IFACEMETHOD(FillCircleWithColor)(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ABI::Windows::UI::Color color) override;
IFACEMETHOD(FillCircleAtCoordsWithColor)(
float x,
float y,
float radius,
ABI::Windows::UI::Color color) override;
//
// DrawText
//
// 0 additional parameters
IFACEMETHOD(DrawTextAtPointWithColor)(
HSTRING text,
ABI::Windows::Foundation::Point point,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawTextAtPointWithFormat)(
ABI::Windows::UI::Color color) override;
IFACEMETHOD(DrawTextAtPointCoordsWithColor)(
HSTRING text,
float x,
float y,
ABI::Windows::UI::Color color) override;
// 1 additional parameter (TextFormat)
IFACEMETHOD(DrawTextAtPointWithBrushAndFormat)(
HSTRING text,
ABI::Windows::Foundation::Point point,
ICanvasBrush* brush,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawText)(
HSTRING text,
ABI::Windows::Foundation::Rect rectangle,
ICanvasBrush* brush) override;
IFACEMETHOD(DrawTextWithFormat)(
IFACEMETHOD(DrawTextAtRectWithBrushAndFormat)(
HSTRING text,
ABI::Windows::Foundation::Rect rectangle,
ICanvasBrush* brush,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtPointCoordsWithBrushAndFormat)(
HSTRING text,
float x,
float y,
ICanvasBrush* brush,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtRectCoordsWithBrushAndFormat)(
HSTRING text,
float x,
float y,
float w,
float h,
ICanvasBrush* brush,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtPointWithColorAndFormat)(
HSTRING text,
ABI::Windows::Foundation::Point point,
ABI::Windows::UI::Color color,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtRectWithColorAndFormat)(
HSTRING text,
ABI::Windows::Foundation::Rect rectangle,
ABI::Windows::UI::Color color,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtPointCoordsWithColorAndFormat)(
HSTRING text,
float x,
float y,
ABI::Windows::UI::Color color,
ICanvasTextFormat* format) override;
IFACEMETHOD(DrawTextAtRectCoordsWithColorAndFormat)(
HSTRING text,
float x,
float y,
float w,
float h,
ABI::Windows::UI::Color color,
ICanvasTextFormat* format) override;
//
// State properties
//
IFACEMETHOD(get_Antialiasing)(CanvasAntialiasing* value);
IFACEMETHOD(put_Antialiasing)(CanvasAntialiasing value);
@ -243,19 +811,66 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
IFACEMETHODIMP get_Device(ICanvasDevice** value);
private:
void DrawTextAtPointImpl(
ID2D1DeviceContext* deviceContext,
void DrawLineImpl(
const Point& p0,
const Point& p1,
ID2D1Brush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle);
void DrawRectangleImpl(
const Rect& rect,
ID2D1Brush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle);
void FillRectangleImpl(
const Rect& rect,
ID2D1Brush* brush);
void DrawRoundedRectangleImpl(
const Rect& rect,
float radiusX,
float radiusY,
ID2D1Brush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle);
void FillRoundedRectangleImpl(
const Rect& rect,
float radiusX,
float radiusY,
ID2D1Brush* brush);
void DrawEllipseImpl(
const Point& centerPoint,
float radiusX,
float radiusY,
ID2D1Brush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle);
void FillEllipseImpl(
const Point& centerPoint,
float radiusX,
float radiusY,
ID2D1Brush* brush);
void DrawTextAtRectImpl(
HSTRING text,
const ABI::Windows::Foundation::Point& point,
ICanvasBrush* brush,
const Rect& rect,
ID2D1Brush* brush,
ICanvasTextFormat* format);
void DrawTextImpl(
ID2D1DeviceContext* deviceContext,
void DrawTextAtPointImpl(
HSTRING text,
const ABI::Windows::Foundation::Rect& rect,
ICanvasBrush* brush,
const Point& point,
ID2D1Brush* brush,
ICanvasTextFormat* format);
ICanvasTextFormat* GetDefaultTextFormat();
ID2D1SolidColorBrush* GetColorBrush(const ABI::Windows::UI::Color& color);
};

Просмотреть файл

@ -509,7 +509,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
: m_closed(false)
, m_flowDirection(CanvasTextDirection::TopToBottom)
, m_fontFamilyName(L"Segoe UI")
, m_fontSize(96.0f)
, m_fontSize(32.0f)
, m_fontStretch(ABI::Windows::UI::Text::FontStretch_Normal)
, m_fontStyle(ABI::Windows::UI::Text::FontStyle_Normal)
, m_fontWeight(ToWindowsFontWeight(DWRITE_FONT_WEIGHT_NORMAL))

Просмотреть файл

@ -104,7 +104,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
inline D2D1_POINT_2F ToD2DPoint(const ABI::Windows::Foundation::Point& point)
{
return D2D1_POINT_2F{point.X, point.Y};
return D2D1_POINT_2F{ point.X, point.Y };
}
inline D2D1_RECT_F ToD2DRect(const ABI::Windows::Foundation::Rect& rect)
@ -114,27 +114,24 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
auto top = rect.Y;
auto bottom = rect.Y + rect.Height;
return D2D1_RECT_F{left, top, right, bottom};
return D2D1_RECT_F{ left, top, right, bottom };
}
inline D2D1_ROUNDED_RECT ToD2DRoundedRect(const CanvasRoundedRectangle& roundedRect)
inline D2D1_ROUNDED_RECT ToD2DRoundedRect(const ABI::Windows::Foundation::Rect& rect, float rx, float ry)
{
auto rect = ToD2DRect(roundedRect.Rect);
auto radiusX = roundedRect.RadiusX;
auto radiusY = roundedRect.RadiusY;
return D2D1_ROUNDED_RECT{rect, radiusX, radiusY};
return D2D1_ROUNDED_RECT{ ToD2DRect(rect), rx, ry };
}
inline D2D1_ELLIPSE ToD2DEllipse(
const ABI::Windows::Foundation::Point& point,
float radius)
inline D2D1_ELLIPSE ToD2DEllipse(const ABI::Windows::Foundation::Point& point, float rx, float ry)
{
return D2D1::Ellipse(ToD2DPoint(point), radius, radius);
return D2D1::Ellipse(ToD2DPoint(point), rx, ry);
}
inline ComPtr<ID2D1Brush> ToD2DBrush(ICanvasBrush* brush)
{
if (!brush)
return nullptr;
ComPtr<ICanvasBrushInternal> internal;
ThrowIfFailed(brush->QueryInterface(IID_PPV_ARGS(&internal)));
return internal->GetD2DBrush();
@ -152,15 +149,6 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas
static_assert(false, "Invalid ReinterpretAs type parameters");
}
template<> inline void ValidateReinterpretAs<D2D1_ELLIPSE*, CanvasEllipse*>()
{
static_assert(offsetof(D2D1_POINT_2F, x) == offsetof(ABI::Windows::Foundation::Point, X), "Point layout must match D2D1_POINT_2F layout");
static_assert(offsetof(D2D1_POINT_2F, y) == offsetof(ABI::Windows::Foundation::Point, Y), "Point layout must match D2D1_POINT_2F layout");
static_assert(offsetof(D2D1_ELLIPSE, point) == offsetof(CanvasEllipse, Point), "CanvasEllipse layout must match D2D1_ELLIPSE layout");
static_assert(offsetof(D2D1_ELLIPSE, radiusX) == offsetof(CanvasEllipse, RadiusX), "CanvasEllipse layout must match D2D1_ELLIPSE layout");
static_assert(offsetof(D2D1_ELLIPSE, radiusY) == offsetof(CanvasEllipse, RadiusY), "CanvasEllipse layout must match D2D1_ELLIPSE layout");
}
template<> inline void ValidateReinterpretAs<D2D1_MATRIX_3X2_F*, Numerics::Matrix3x2*>()
{
static_assert(offsetof(D2D1_MATRIX_3X2_F, _11) == offsetof(Numerics::Matrix3x2, M11), "Matrix3x2 layout must match D2D1_MATRIX_3X2_F");

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -132,27 +132,47 @@ TEST_CLASS(ConversionUnitTests)
[&] { ToRECT(Rect{0,2,mvf,mvf}); });
}
TEST_METHOD(PointToD2DPoint)
{
using ABI::Windows::Foundation::Point;
Assert::AreEqual(D2D1_POINT_2F{ 1, 2 }, ToD2DPoint(Point{ 1, 2 }));
}
TEST_METHOD(RectToD2DRect)
{
using ABI::Windows::Foundation::Rect;
Assert::AreEqual(D2D_RECT_F{1,2,3,4}, ToD2DRect(Rect{1,2,2,2}));
Assert::AreEqual(D2D_RECT_F{ 1, 2, 3, 4 }, ToD2DRect(Rect{ 1, 2, 2, 2 }));
}
TEST_METHOD(CanvasRoundedRectangleToD2DRoundedRect)
TEST_METHOD(RectAndRadiusToD2DRoundedRect)
{
using ABI::Windows::Foundation::Rect;
Assert::AreEqual(
D2D1_ROUNDED_RECT{D2D_RECT_F{1,2,3,4},5,6},
ToD2DRoundedRect(CanvasRoundedRectangle{Rect{1,2,2,2},5,6}));
Rect rect{ 1, 2, 3, 4 };
float rx = 5;
float ry = 6;
auto result = ToD2DRoundedRect(rect, rx, ry);
Assert::AreEqual(ToD2DRect(rect), result.rect);
Assert::AreEqual(rx, result.radiusX);
Assert::AreEqual(ry, result.radiusY);
}
TEST_METHOD(CanvasEllipseToD2DEllipse)
TEST_METHOD(PointAndRadiusToD2DEllipse)
{
Assert::AreEqual(
D2D1_ELLIPSE{D2D_POINT_2F{1,2},3,4},
*ReinterpretAs<D2D1_ELLIPSE*>(&CanvasEllipse{ Point{ 1, 2 }, 3, 4 }));
using ABI::Windows::Foundation::Point;
Point point{ 1, 2 };
float rx = 3;
float ry = 4;
auto result = ToD2DEllipse(point, rx, ry);
Assert::AreEqual(ToD2DPoint(point), result.point);
Assert::AreEqual(rx, result.radiusX);
Assert::AreEqual(ry, result.radiusY);
}
};

Просмотреть файл

@ -15,6 +15,7 @@
namespace canvas
{
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::UI;
class MockCanvasDrawingSession : public RuntimeClass<
ICanvasDrawingSession,
@ -26,298 +27,126 @@ namespace canvas
return S_OK;
}
IFACEMETHODIMP Clear(
ABI::Windows::UI::Color color) override
{
Assert::Fail(L"Unexpected call to Clear");
return E_NOTIMPL;
#define DONT_EXPECT(name, ...) \
IFACEMETHODIMP name(__VA_ARGS__) override \
{ \
Assert::Fail(L"Unexpected call to " WIDEN(#name)); \
return E_NOTIMPL; \
}
IFACEMETHOD(DrawImage)(
ICanvasImage* image) override
{
Assert::Fail(L"Unexpected call to DrawImage");
return E_NOTIMPL;
}
DONT_EXPECT(Clear , Color);
IFACEMETHOD(DrawImageWithOffset)(
ICanvasImage* image,
ABI::Windows::Foundation::Point offset) override
{
Assert::Fail(L"Unexpected call to DrawImageWithOffset");
return E_NOTIMPL;
}
DONT_EXPECT(DrawImage , ICanvasImage*, Point);
DONT_EXPECT(DrawImageAtCoords , ICanvasImage*, float, float);
DONT_EXPECT(DrawImageAtOrigin , ICanvasImage*);
IFACEMETHODIMP DrawLine(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to DrawLine");
return E_NOTIMPL;
}
DONT_EXPECT(DrawLineWithBrush , Point, Point, ICanvasBrush*);
DONT_EXPECT(DrawLineAtCoordsWithBrush , float, float, float, float, ICanvasBrush*);
DONT_EXPECT(DrawLineWithColor , Point, Point, Color);
DONT_EXPECT(DrawLineAtCoordsWithColor , float, float, float, float, Color);
DONT_EXPECT(DrawLineWithBrushAndStrokeWidth , Point, Point, ICanvasBrush*, float);
DONT_EXPECT(DrawLineAtCoordsWithBrushAndStrokeWidth , float, float, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawLineWithColorAndStrokeWidth , Point, Point, Color, float);
DONT_EXPECT(DrawLineAtCoordsWithColorAndStrokeWidth , float, float, float, float, Color, float);
DONT_EXPECT(DrawLineWithBrushAndStrokeWidthAndStrokeStyle , Point, Point, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawLineAtCoordsWithBrushAndStrokeWidthAndStrokeStyle , float, float, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawLineWithColorAndStrokeWidthAndStrokeStyle , Point, Point, Color, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawLineAtCoordsWithColorAndStrokeWidthAndStrokeStyle , float, float, float, float, Color, float, ICanvasStrokeStyle*);
IFACEMETHODIMP DrawLineWithStrokeWidth(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush,
float strokeWidth) override
{
Assert::Fail(L"Unexpected call to DrawLineWithStrokeWidth");
return E_NOTIMPL;
}
DONT_EXPECT(DrawRectangleWithBrush , Rect, ICanvasBrush*);
DONT_EXPECT(DrawRectangleAtCoordsWithBrush , float, float, float, float, ICanvasBrush*);
DONT_EXPECT(DrawRectangleWithColor , Rect, Color);
DONT_EXPECT(DrawRectangleAtCoordsWithColor , float, float, float, float, Color);
DONT_EXPECT(DrawRectangleWithBrushAndStrokeWidth , Rect, ICanvasBrush*, float);
DONT_EXPECT(DrawRectangleAtCoordsWithBrushAndStrokeWidth , float, float, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawRectangleWithColorAndStrokeWidth , Rect, Color, float);
DONT_EXPECT(DrawRectangleAtCoordsWithColorAndStrokeWidth , float, float, float, float, Color, float);
DONT_EXPECT(DrawRectangleWithBrushAndStrokeWidthAndStrokeStyle , Rect, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle , float, float, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRectangleWithColorAndStrokeWidthAndStrokeStyle , Rect, Color, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle , float, float, float, float, Color, float, ICanvasStrokeStyle*);
IFACEMETHODIMP DrawLineWithStrokeWidthAndStrokeStyle(
ABI::Windows::Foundation::Point point0,
ABI::Windows::Foundation::Point point1,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override
{
Assert::Fail(L"Unexpected call to DrawLineWithStrokeWidthAndStrokeStyle");
return E_NOTIMPL;
}
DONT_EXPECT(FillRectangleWithBrush , Rect, ICanvasBrush*);
DONT_EXPECT(FillRectangleAtCoordsWithBrush , float, float, float, float, ICanvasBrush*);
DONT_EXPECT(FillRectangleWithColor , Rect, Color);
DONT_EXPECT(FillRectangleAtCoordsWithColor , float, float, float, float, Color);
IFACEMETHODIMP DrawRectangle(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to DrawRectangle");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawRectangleWithStrokeWidth(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush,
float strokeWidth) override
{
Assert::Fail(L"Unexpected call to DrawRectangleWithStrokeWidth");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawRectangleWithStrokeWidthAndStrokeStyle(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override
{
Assert::Fail(L"Unexpected call to DrawRectangleWithStrokeWidthAndStrokeStyle");
return E_NOTIMPL;
}
IFACEMETHODIMP FillRectangle(
ABI::Windows::Foundation::Rect rect,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to FillRectangle");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawRoundedRectangle(
CanvasRoundedRectangle roundedRectangle,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to DrawRoundedRectangle");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawRoundedRectangleWithStrokeWidth(
CanvasRoundedRectangle roundedRectangle,
ICanvasBrush* brush,
float strokeWidth) override
{
Assert::Fail(L"Unexpected call to DrawRoundedRectangleWithStrokeWidth");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawRoundedRectangleWithStrokeWidthAndStrokeStyle(
CanvasRoundedRectangle roundedRectangle,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override
{
Assert::Fail(L"Unexpected call to DrawRoundedRectangleWithStrokeWidthAndStrokeStyle");
return E_NOTIMPL;
}
IFACEMETHODIMP FillRoundedRectangle(
CanvasRoundedRectangle roundedRectangle,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to FillRoundedRectangle");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawEllipse(
CanvasEllipse ellipse,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to DrawEllipse");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawEllipseWithStrokeWidth(
CanvasEllipse ellipse,
ICanvasBrush* brush,
float strokeWidth) override
{
Assert::Fail(L"Unexpected call to DrawEllipseWithStrokeWidth");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawEllipseWithStrokeWidthAndStrokeStyle(
CanvasEllipse ellipse,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle) override
{
Assert::Fail(L"Unexpected call to DrawEllipseWithStrokeWidthAndStrokeStyle");
return E_NOTIMPL;
}
IFACEMETHODIMP FillEllipse(
CanvasEllipse ellipse,
ICanvasBrush* brush) override
{
Assert::Fail(L"Unexpected call to FillEllipse");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawCircle(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush)
{
Assert::Fail(L"Unexpected call to DrawCircle");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawCircleWithStrokeWidth(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush,
float strokeWidth)
{
Assert::Fail(L"Unexpected call to DrawCircleWithStrokeWidth");
return E_NOTIMPL;
}
IFACEMETHODIMP DrawCircleWithStrokeWidthAndStrokeStyle(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush,
float strokeWidth,
ICanvasStrokeStyle* strokeStyle)
{
Assert::Fail(L"Unexpected call to DrawCircleWithStrokeWidthAndStrokeStyle");
return E_NOTIMPL;
}
IFACEMETHODIMP FillCircle(
ABI::Windows::Foundation::Point centerPoint,
float radius,
ICanvasBrush* brush)
{
Assert::Fail(L"Unexpected call to FillCircle");
return E_NOTIMPL;
}
DONT_EXPECT(DrawRoundedRectangleWithBrush , Rect, float, float, ICanvasBrush*);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithBrush , float, float, float, float, float, float, ICanvasBrush*);
DONT_EXPECT(DrawRoundedRectangleWithColor , Rect, float, float, Color);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithColor , float, float, float, float, float, float, Color);
DONT_EXPECT(DrawRoundedRectangleWithBrushAndStrokeWidth , Rect, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidth , float, float, float, float, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawRoundedRectangleWithColorAndStrokeWidth , Rect, float, float, Color, float);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithColorAndStrokeWidth , float, float, float, float, float, float, Color, float);
DONT_EXPECT(DrawRoundedRectangleWithBrushAndStrokeWidthAndStrokeStyle , Rect, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle , float, float, float, float, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRoundedRectangleWithColorAndStrokeWidthAndStrokeStyle , Rect, float, float, Color, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawRoundedRectangleAtCoordsWithColorAndStrokeWidthAndStrokeStyle , float, float, float, float, float, float, Color, float, ICanvasStrokeStyle*);
IFACEMETHODIMP DrawTextAtPoint(
HSTRING,
ABI::Windows::Foundation::Point,
ICanvasBrush*) override
{
Assert::Fail(L"Unexpected call to DrawTextAtPoint");
return E_NOTIMPL;
}
DONT_EXPECT(FillRoundedRectangleWithBrush , Rect, float, float, ICanvasBrush*);
DONT_EXPECT(FillRoundedRectangleAtCoordsWithBrush , float, float, float, float, float, float, ICanvasBrush*);
DONT_EXPECT(FillRoundedRectangleWithColor , Rect, float, float, Color);
DONT_EXPECT(FillRoundedRectangleAtCoordsWithColor , float, float, float, float, float, float, Color);
DONT_EXPECT(DrawEllipseWithBrush , Point, float, float, ICanvasBrush*);
DONT_EXPECT(DrawEllipseAtCoordsWithBrush , float, float, float, float, ICanvasBrush*);
DONT_EXPECT(DrawEllipseWithColor , Point, float, float, Color);
DONT_EXPECT(DrawEllipseAtCoordsWithColor , float, float, float, float, Color);
DONT_EXPECT(DrawEllipseWithBrushAndStrokeWidth , Point, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawEllipseAtCoordsWithBrushAndStrokeWidth , float, float, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawEllipseWithColorAndStrokeWidth , Point, float, float, Color, float);
DONT_EXPECT(DrawEllipseAtCoordsWithColorAndStrokeWidth , float, float, float, float, Color, float);
DONT_EXPECT(DrawEllipseWithBrushAndStrokeWidthAndStrokeStyle , Point, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawEllipseAtCoordsWithBrushAndStrokeWidthAndStrokeStyle , float, float, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawEllipseWithColorAndStrokeWidthAndStrokeStyle , Point, float, float, Color, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawEllipseAtCoordsWithColorAndStrokeWidthAndStrokeStyle , float, float, float, float, Color, float, ICanvasStrokeStyle*);
IFACEMETHODIMP DrawTextAtPointWithFormat(
HSTRING,
ABI::Windows::Foundation::Point,
ICanvasBrush*,
ICanvasTextFormat*) override
{
Assert::Fail(L"Unexpected call to DrawTextAtPointWithFormat");
return E_NOTIMPL;
}
DONT_EXPECT(FillEllipseWithBrush , Point, float, float, ICanvasBrush*);
DONT_EXPECT(FillEllipseAtCoordsWithBrush , float, float, float, float, ICanvasBrush*);
DONT_EXPECT(FillEllipseWithColor , Point, float, float, Color);
DONT_EXPECT(FillEllipseAtCoordsWithColor , float, float, float, float, Color);
DONT_EXPECT(DrawCircleWithBrush , Point, float, ICanvasBrush*);
DONT_EXPECT(DrawCircleAtCoordsWithBrush , float, float, float, ICanvasBrush*);
DONT_EXPECT(DrawCircleWithColor , Point, float, Color);
DONT_EXPECT(DrawCircleAtCoordsWithColor , float, float, float, Color);
DONT_EXPECT(DrawCircleWithBrushAndStrokeWidth , Point, float, ICanvasBrush*, float);
DONT_EXPECT(DrawCircleAtCoordsWithBrushAndStrokeWidth , float, float, float, ICanvasBrush*, float);
DONT_EXPECT(DrawCircleWithColorAndStrokeWidth , Point, float, Color, float);
DONT_EXPECT(DrawCircleAtCoordsWithColorAndStrokeWidth , float, float, float, Color, float);
DONT_EXPECT(DrawCircleWithBrushAndStrokeWidthAndStrokeStyle , Point, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawCircleAtCoordsWithBrushAndStrokeWidthAndStrokeStyle , float, float, float, ICanvasBrush*, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawCircleWithColorAndStrokeWidthAndStrokeStyle , Point, float, Color, float, ICanvasStrokeStyle*);
DONT_EXPECT(DrawCircleAtCoordsWithColorAndStrokeWidthAndStrokeStyle , float, float, float, Color, float, ICanvasStrokeStyle*);
IFACEMETHODIMP DrawText(
HSTRING,
ABI::Windows::Foundation::Rect,
ICanvasBrush*) override
{
Assert::Fail(L"Unexpected call to DrawText");
return E_NOTIMPL;
}
DONT_EXPECT(FillCircleWithBrush , Point, float, ICanvasBrush*);
DONT_EXPECT(FillCircleAtCoordsWithBrush , float, float, float, ICanvasBrush*);
DONT_EXPECT(FillCircleWithColor , Point, float, Color);
DONT_EXPECT(FillCircleAtCoordsWithColor , float, float, float, Color);
IFACEMETHODIMP DrawTextWithFormat(
HSTRING,
ABI::Windows::Foundation::Rect,
ICanvasBrush*,
ICanvasTextFormat*) override
{
Assert::Fail(L"Unexpected call to DrawTextWithFormat");
return E_NOTIMPL;
}
DONT_EXPECT(DrawTextAtPointWithColor , HSTRING, Point, Color);
DONT_EXPECT(DrawTextAtPointCoordsWithColor , HSTRING, float, float, Color);
DONT_EXPECT(DrawTextAtPointWithBrushAndFormat , HSTRING, Point, ICanvasBrush*, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtRectWithBrushAndFormat , HSTRING, Rect, ICanvasBrush*, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtPointCoordsWithBrushAndFormat , HSTRING, float, float, ICanvasBrush*, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtRectCoordsWithBrushAndFormat , HSTRING, float, float, float, float, ICanvasBrush*, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtPointWithColorAndFormat , HSTRING, Point, Color, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtRectWithColorAndFormat , HSTRING, Rect, Color, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtPointCoordsWithColorAndFormat , HSTRING, float, float, Color, ICanvasTextFormat*);
DONT_EXPECT(DrawTextAtRectCoordsWithColorAndFormat , HSTRING, float, float, float, float, Color, ICanvasTextFormat*);
IFACEMETHODIMP get_Antialiasing(CanvasAntialiasing* value)
{
Assert::Fail(L"Unexpected call to get_Antialiasing");
return E_NOTIMPL;
}
DONT_EXPECT(get_Antialiasing , CanvasAntialiasing*);
DONT_EXPECT(put_Antialiasing , CanvasAntialiasing);
DONT_EXPECT(get_Blend , CanvasBlend*);
DONT_EXPECT(put_Blend , CanvasBlend);
DONT_EXPECT(get_TextAntialiasing , CanvasTextAntialiasing*);
DONT_EXPECT(put_TextAntialiasing , CanvasTextAntialiasing);
DONT_EXPECT(get_Transform , ABI::Microsoft::Graphics::Canvas::Numerics::Matrix3x2*);
DONT_EXPECT(put_Transform , ABI::Microsoft::Graphics::Canvas::Numerics::Matrix3x2);
DONT_EXPECT(get_Units , CanvasUnits*);
DONT_EXPECT(put_Units , CanvasUnits);
IFACEMETHODIMP put_Antialiasing(CanvasAntialiasing value)
{
Assert::Fail(L"Unexpected call to put_Antialiasing");
return E_NOTIMPL;
}
IFACEMETHODIMP get_Blend(CanvasBlend* value)
{
Assert::Fail(L"Unexpected call to get_Blend");
return E_NOTIMPL;
}
IFACEMETHODIMP put_Blend(CanvasBlend value)
{
Assert::Fail(L"Unexpected call to put_Blend");
return E_NOTIMPL;
}
IFACEMETHODIMP get_TextAntialiasing(CanvasTextAntialiasing* value)
{
Assert::Fail(L"Unexpected call to get_TextAntialiasing");
return E_NOTIMPL;
}
IFACEMETHODIMP put_TextAntialiasing(CanvasTextAntialiasing value)
{
Assert::Fail(L"Unexpected call to put_TextAntialiasing");
return E_NOTIMPL;
}
IFACEMETHODIMP get_Transform(ABI::Microsoft::Graphics::Canvas::Numerics::Matrix3x2* value)
{
Assert::Fail(L"Unexpected call to get_Transform");
return E_NOTIMPL;
}
IFACEMETHODIMP put_Transform(ABI::Microsoft::Graphics::Canvas::Numerics::Matrix3x2 value)
{
Assert::Fail(L"Unexpected call to put_Transform");
return E_NOTIMPL;
}
IFACEMETHODIMP get_Units(CanvasUnits* value)
{
Assert::Fail(L"Unexpected call to get_Units");
return E_NOTIMPL;
}
IFACEMETHODIMP put_Units(CanvasUnits value)
{
Assert::Fail(L"Unexpected call to put_Units");
return E_NOTIMPL;
}
#undef DONT_EXPECT
};
}

Просмотреть файл

@ -47,6 +47,7 @@ namespace canvas
std::function<void(ID2D1Image*)> MockDrawImage;
std::function<void(ID2D1Device**)> MockGetDevice;
std::function<HRESULT(ID2D1Effect **)> MockCreateEffect;
std::function<HRESULT(const D2D1_COLOR_F* color, const D2D1_BRUSH_PROPERTIES* brushProperties, ID2D1SolidColorBrush** solidColorBrush)> MockCreateSolidColorBrush;
// ID2D1Resource
@ -87,8 +88,15 @@ namespace canvas
ID2D1SolidColorBrush** solidColorBrush
) override
{
ComPtr<MockD2DSolidColorBrush> mockD2DSolidColorBrush = Make<MockD2DSolidColorBrush>();
return mockD2DSolidColorBrush.CopyTo(solidColorBrush);
if (MockCreateSolidColorBrush)
{
return MockCreateSolidColorBrush(color, brushProperties, solidColorBrush);
}
else
{
ComPtr<MockD2DSolidColorBrush> mockD2DSolidColorBrush = Make<MockD2DSolidColorBrush>();
return mockD2DSolidColorBrush.CopyTo(solidColorBrush);
}
}
IFACEMETHODIMP CreateGradientStopCollection(const D2D1_GRADIENT_STOP *,UINT32,D2D1_GAMMA,D2D1_EXTEND_MODE,ID2D1GradientStopCollection **) override

Просмотреть файл

@ -19,6 +19,8 @@ namespace canvas
ChainInterfaces<ID2D1SolidColorBrush, ID2D1Brush, ID2D1Resource>>
{
public:
std::function<void(const D2D1_COLOR_F* color)> MockSetColor;
//
// ID2D1SolidColorBrush
//
@ -26,7 +28,14 @@ namespace canvas
_In_ CONST D2D1_COLOR_F *color
)
{
Assert::Fail(L"Unexpected call to SetColor");
if (MockSetColor)
{
MockSetColor(color);
}
else
{
Assert::Fail(L"Unexpected call to SetColor");
}
}
STDMETHOD_(D2D1_COLOR_F, GetColor)(