Skip to content

Commit 8004c41

Browse files
committed
tizen
1 parent 446af2f commit 8004c41

File tree

7 files changed

+153
-19
lines changed

7 files changed

+153
-19
lines changed

source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SKImageSource.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace SkiaSharp.Views.Maui.Controls
77
{
88
/// <summary>
9-
/// Represents a <see cref="T:SkiaSharp.SKImage" /> image source.
9+
/// Represents a <see cref="SKImage" /> image source.
1010
/// </summary>
1111
public sealed partial class SKImageImageSource : ImageSource, ISKImageImageSource
1212
{
@@ -16,7 +16,7 @@ public sealed partial class SKImageImageSource : ImageSource, ISKImageImageSourc
1616
public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(SKImage), typeof(SKImageImageSource), default(SKImage));
1717

1818
/// <summary>
19-
/// Gets or sets the underlying <see cref="T:SkiaSharp.SKImage" /> of the image source.
19+
/// Gets or sets the underlying <see cref="SKImage" /> of the image source.
2020
/// </summary>
2121
public SKImage Image
2222
{
@@ -34,7 +34,7 @@ public override Task<bool> Cancel()
3434
}
3535

3636
/// <summary>
37-
/// Allows implicit casting from a <see cref="T:SkiaSharp.SKImage" />.
37+
/// Allows implicit casting from a <see cref="SKImage" />.
3838
/// </summary>
3939
/// <param name="image">The image to use when creating the ImageSource.</param>
4040
/// <returns>Returns a new instance of <see cref="SKImageImageSource" /> with the <see cref="SKImageImageSource.Image" /> property set to the image.</returns>
@@ -47,10 +47,10 @@ public static implicit operator SKImageImageSource(SKImage image)
4747
}
4848

4949
/// <summary>
50-
/// Allows implicit casting to a <see cref="T:SkiaSharp.SKImage" />.
50+
/// Allows implicit casting to a <see cref="SKImage" />.
5151
/// </summary>
5252
/// <param name="source">The ImageSource to retrieve the image from.</param>
53-
/// <returns>Returns the underlying <see cref="T:SkiaSharp.SKImage" /> of the ImageSource.</returns>
53+
/// <returns>Returns the underlying <see cref="SKImage" /> of the ImageSource.</returns>
5454
public static implicit operator SKImage(SKImageImageSource source)
5555
{
5656
return source?.Image;
@@ -65,7 +65,7 @@ protected override void OnPropertyChanged(string propertyName = null)
6565
}
6666

6767
/// <summary>
68-
/// Represents a <see cref="T:SkiaSharp.SKBitmap" /> image source.
68+
/// Represents a <see cref="SKBitmap" /> image source.
6969
/// </summary>
7070
public sealed partial class SKBitmapImageSource : ImageSource, ISKBitmapImageSource
7171
{
@@ -75,7 +75,7 @@ public sealed partial class SKBitmapImageSource : ImageSource, ISKBitmapImageSou
7575
public static readonly BindableProperty BitmapProperty = BindableProperty.Create(nameof(Bitmap), typeof(SKBitmap), typeof(SKBitmapImageSource), default(SKBitmap));
7676

7777
/// <summary>
78-
/// Gets or sets the underlying <see cref="T:SkiaSharp.SKBitmap" /> of the image source.
78+
/// Gets or sets the underlying <see cref="SKBitmap" /> of the image source.
7979
/// </summary>
8080
public SKBitmap Bitmap
8181
{
@@ -93,7 +93,7 @@ public override Task<bool> Cancel()
9393
}
9494

9595
/// <summary>
96-
/// Allows implicit casting from a <see cref="T:SkiaSharp.SKBitmap" />.
96+
/// Allows implicit casting from a <see cref="SKBitmap" />.
9797
/// </summary>
9898
/// <param name="bitmap">The bitmap to use when creating the ImageSource.</param>
9999
/// <returns>Returns a new instance of <see cref="SKBitmapImageSource" /> with the <see cref="SKBitmapImageSource.Bitmap" /> property set to the bitmap.</returns>
@@ -106,10 +106,10 @@ public static implicit operator SKBitmapImageSource(SKBitmap bitmap)
106106
}
107107

108108
/// <summary>
109-
/// Allows implicit casting to a <see cref="T:SkiaSharp.SKBitmap" />.
109+
/// Allows implicit casting to a <see cref="SKBitmap" />.
110110
/// </summary>
111111
/// <param name="source">The ImageSource to retrieve the bitmap from.</param>
112-
/// <returns>Returns the underlying <see cref="T:SkiaSharp.SKBitmap" /> of the ImageSource.</returns>
112+
/// <returns>Returns the underlying <see cref="SKBitmap" /> of the ImageSource.</returns>
113113
public static implicit operator SKBitmap(SKBitmapImageSource source)
114114
{
115115
return source?.Bitmap;
@@ -124,7 +124,7 @@ protected override void OnPropertyChanged(string propertyName = null)
124124
}
125125

126126
/// <summary>
127-
/// Represents a <see cref="T:SkiaSharp.SKPixmap" /> image source.
127+
/// Represents a <see cref="SKPixmap" /> image source.
128128
/// </summary>
129129
public sealed partial class SKPixmapImageSource : ImageSource, ISKPixmapImageSource
130130
{
@@ -134,7 +134,7 @@ public sealed partial class SKPixmapImageSource : ImageSource, ISKPixmapImageSou
134134
public static readonly BindableProperty PixmapProperty = BindableProperty.Create(nameof(Pixmap), typeof(SKPixmap), typeof(SKPixmapImageSource), default(SKPixmap));
135135

136136
/// <summary>
137-
/// Gets or sets the underlying <see cref="T:SkiaSharp.SKPixmap" /> of the image source.
137+
/// Gets or sets the underlying <see cref="SKPixmap" /> of the image source.
138138
/// </summary>
139139
public SKPixmap Pixmap
140140
{
@@ -152,7 +152,7 @@ public override Task<bool> Cancel()
152152
}
153153

154154
/// <summary>
155-
/// Allows implicit casting from a <see cref="T:SkiaSharp.SKPixmap" />.
155+
/// Allows implicit casting from a <see cref="SKPixmap" />.
156156
/// </summary>
157157
/// <param name="pixmap">The pixmap to use when creating the ImageSource.</param>
158158
/// <returns>Returns a new instance of <see cref="SKPixmapImageSource" /> with the <see cref="SKPixmapImageSource.Pixmap" /> property set to the bitmap.</returns>
@@ -165,10 +165,10 @@ public static implicit operator SKPixmapImageSource(SKPixmap pixmap)
165165
}
166166

167167
/// <summary>
168-
/// Allows implicit casting to a <see cref="T:SkiaSharp.SKPixmap" />.
168+
/// Allows implicit casting to a <see cref="SKPixmap" />.
169169
/// </summary>
170170
/// <param name="source">The ImageSource to retrieve the pixmap from.</param>
171-
/// <returns>Returns the underlying <see cref="T:SkiaSharp.SKPixmap" /> of the ImageSource.</returns>
171+
/// <returns>Returns the underlying <see cref="SKPixmap" /> of the ImageSource.</returns>
172172
public static implicit operator SKPixmap(SKPixmapImageSource source)
173173
{
174174
return source?.Pixmap;
@@ -183,7 +183,7 @@ protected override void OnPropertyChanged(string propertyName = null)
183183
}
184184

185185
/// <summary>
186-
/// Represents a <see cref="T:SkiaSharp.SKPicture" /> image source.
186+
/// Represents a <see cref="SKPicture" /> image source.
187187
/// </summary>
188188
public sealed partial class SKPictureImageSource : ImageSource, ISKPictureImageSource
189189
{
@@ -198,7 +198,7 @@ public sealed partial class SKPictureImageSource : ImageSource, ISKPictureImageS
198198
public static readonly BindableProperty DimensionsProperty = BindableProperty.Create(nameof(Dimensions), typeof(SKSizeI), typeof(SKPictureImageSource), default(SKSizeI));
199199

200200
/// <summary>
201-
/// Gets or sets the underlying <see cref="T:SkiaSharp.SKImage" /> of the image source.
201+
/// Gets or sets the underlying <see cref="SKImage" /> of the image source.
202202
/// </summary>
203203
public SKPicture Picture
204204
{
@@ -225,10 +225,10 @@ public override Task<bool> Cancel()
225225
}
226226

227227
/// <summary>
228-
/// Allows explicit casting to a <see cref="T:SkiaSharp.SKPicture" />.
228+
/// Allows explicit casting to a <see cref="SKPicture" />.
229229
/// </summary>
230230
/// <param name="source">The ImageSource to retrieve the picture from.</param>
231-
/// <returns>Returns the underlying <see cref="T:SkiaSharp.SKPicture" /> of the ImageSource.</returns>
231+
/// <returns>Returns the underlying <see cref="SKPicture" /> of the ImageSource.</returns>
232232
public static explicit operator SKPicture(SKPictureImageSource source)
233233
{
234234
return source?.Picture;

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Tizen/CustomRenderingView.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace SkiaSharp.Views.Tizen
66
{
7+
/// <summary>
8+
/// An abstract view that can be inherited from to allow drawing on using SkiaSharp drawing commands.
9+
/// </summary>
710
public abstract class CustomRenderingView : Widget
811
{
912
private readonly Evas.ImagePixelsSetCallback redrawCallback;
@@ -20,8 +23,15 @@ public CustomRenderingView(EvasObject parent)
2023
redrawCallback = (d, o) => OnDrawFrame();
2124
}
2225

26+
/// <summary>
27+
/// Gets the current canvas size.
28+
/// </summary>
29+
/// <remarks>The canvas size may be different to the view size as a result of the current device's pixel density.</remarks>
2330
public SKSize CanvasSize => GetSurfaceSize();
2431

32+
/// <summary>
33+
/// Gets or sets the rendering mode.
34+
/// </summary>
2535
public RenderingMode RenderingMode
2636
{
2737
get { return renderingMode; }
@@ -39,6 +49,9 @@ public RenderingMode RenderingMode
3949
}
4050
}
4151

52+
/// <summary>
53+
/// Invalidates the entire surface of the control and causes the control to be redrawn.
54+
/// </summary>
4255
public void Invalidate()
4356
{
4457
if (RenderingMode == RenderingMode.WhenDirty)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
namespace SkiaSharp.Views.Tizen
22
{
3+
/// <summary>
4+
/// Various options for rendering a view.
5+
/// </summary>
36
public enum RenderingMode
47
{
8+
/// <summary>
9+
/// The view is repainted continuously.
10+
/// </summary>
511
Continuously,
12+
/// <summary>
13+
/// The view only redraws the surface when the it is created, resized, or when <see cref="M:SkiaSharp.Views.Tizen.CustomRenderingView.Invalidate" /> is called.
14+
/// </summary>
615
WhenDirty,
716
}
817
}

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Tizen/SKCanvasView.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace SkiaSharp.Views.Tizen
66
{
7+
/// <summary>
8+
/// A view that can be drawn on using SkiaSharp drawing commands.
9+
/// </summary>
710
public class SKCanvasView : CustomRenderingView
811
{
912
private bool ignorePixelScaling;
@@ -16,6 +19,10 @@ public SKCanvasView(EvasObject parent)
1619
info = new SKImageInfo(0, 0, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
1720
}
1821

22+
/// <summary>
23+
/// Gets or sets a value indicating whether the drawing canvas should be resized on high resolution displays.
24+
/// </summary>
25+
/// <remarks>By default, when <see langword="false" />, the canvas is resized to 1 canvas pixel per display pixel. When <see langword="true" />, the canvas is resized to device independent pixels, and then stretched to fill the view. Although performance is improved and all objects are the same size on different display densities, blurring and pixelation may occur.</remarks>
1926
public bool IgnorePixelScaling
2027
{
2128
get => ignorePixelScaling;
@@ -30,6 +37,25 @@ public bool IgnorePixelScaling
3037
}
3138
}
3239

40+
/// <summary>
41+
/// Occurs when the surface needs to be redrawn.
42+
/// </summary>
43+
/// <remarks>There are two ways to draw on this surface: by overriding the
44+
/// <see cref="SkiaSharp.Views.Tizen.SKCanvasView.OnDrawFrame(SkiaSharp.Views.Tizen.SKPaintSurfaceEventArgs)" />
45+
/// method, or by attaching a handler to the
46+
/// <see cref="SkiaSharp.Views.Tizen.SKCanvasView.PaintSurface" />
47+
/// event.
48+
/// ## Examples
49+
/// ```csharp
50+
/// myView.PaintSurface += (sender, e) => {
51+
/// var surface = e.Surface;
52+
/// var surfaceWidth = e.Info.Width;
53+
/// var surfaceHeight = e.Info.Height;
54+
/// var canvas = surface.Canvas;
55+
/// // draw on the canvas
56+
/// canvas.Flush ();
57+
/// };
58+
/// ```</remarks>
3359
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
3460

3561
protected override SKSizeI GetSurfaceSize() => canvasSize;

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Tizen/SKGLSurfaceView.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace SkiaSharp.Views.Tizen
99
{
10+
/// <summary>
11+
/// A hardware-accelerated view that can be drawn on using SkiaSharp drawing commands.
12+
/// </summary>
1013
public class SKGLSurfaceView : CustomRenderingView
1114
{
1215
private const GRSurfaceOrigin surfaceOrigin = GRSurfaceOrigin.BottomLeft;
@@ -40,8 +43,30 @@ public SKGLSurfaceView(EvasObject parent)
4043
};
4144
}
4245

46+
/// <summary>
47+
/// Occurs when the surface needs to be redrawn.
48+
/// </summary>
49+
/// <remarks>There are two ways to draw on this surface: by overriding the
50+
/// <see cref="SkiaSharp.Views.Tizen.SKGLSurfaceView.OnDrawFrame(SkiaSharp.Views.Tizen.SKPaintGLSurfaceEventArgs)" />
51+
/// method, or by attaching a handler to the
52+
/// <see cref="SkiaSharp.Views.Tizen.SKGLSurfaceView.PaintSurface" />
53+
/// event.
54+
/// ## Examples
55+
/// ```csharp
56+
/// myView.PaintSurface += (sender, e) => {
57+
/// var surface = e.Surface;
58+
/// var surfaceWidth = e.BackendRenderTarget.Width;
59+
/// var surfaceHeight = e.BackendRenderTarget.Height;
60+
/// var canvas = surface.Canvas;
61+
/// // draw on the canvas
62+
/// canvas.Flush ();
63+
/// };
64+
/// ```</remarks>
4365
public event EventHandler<SKPaintGLSurfaceEventArgs> PaintSurface;
4466

67+
/// <summary>
68+
/// Gets the current GPU context.
69+
/// </summary>
4570
public GRContext GRContext => context;
4671

4772
protected override SKSizeI GetSurfaceSize() => surfaceSize;

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Tizen/ScalingInfo.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace SkiaSharp.Views.Tizen
66
{
7+
/// <summary>
8+
/// A utility class that can be used to determine screen densities.
9+
/// </summary>
710
public static class ScalingInfo
811
{
912
private static readonly Lazy<string> profile = new Lazy<string>(() => Elementary.GetProfile());
@@ -25,16 +28,36 @@ public static class ScalingInfo
2528

2629
private static double? scalingFactorOverride;
2730

31+
/// <summary>
32+
/// Gets the device profile.
33+
/// </summary>
2834
public static string Profile => profile.Value;
2935

36+
/// <summary>
37+
/// Gets the DPI of the screen.
38+
/// </summary>
3039
public static int Dpi => dpi.Value;
3140

41+
/// <summary>
42+
/// The scaling factor to convert between raw pixels and device-independent pixels.
43+
/// </summary>
3244
public static double ScalingFactor => scalingFactorOverride ?? scalingFactor.Value;
3345

46+
/// <summary>
47+
/// Convert from raw pixels into device-independent pixels.
48+
/// </summary>
49+
/// <param name="v">The raw pixel dimension.</param>
50+
/// <returns>Returns the device-independent pixel dimension.</returns>
3451
public static double FromPixel(double v) => v / ScalingFactor;
3552

53+
/// <summary>
54+
/// Convert from device-independent pixels into raw pixels.
55+
/// </summary>
56+
/// <param name="v">The device-independent pixel dimension.</param>
57+
/// <returns>Returns the raw pixel dimension.</returns>
3658
public static double ToPixel(double v) => v * ScalingFactor;
3759

60+
/// <param name="scalingFactor"></param>
3861
public static void SetScalingFactor(double? scalingFactor)
3962
{
4063
scalingFactorOverride = scalingFactor;

0 commit comments

Comments
 (0)