More SkiaSharp docs
This commit is contained in:
Родитель
a6025b7a7d
Коммит
d744b3f6b2
|
@ -20,7 +20,7 @@
|
|||
<summary>The <see cref="T:SkiaSharp.SKBitmap" /> specifies a raster bitmap.</summary>
|
||||
<remarks>
|
||||
<para>A bitmap has an integer width and height, and a format (colortype), and a pointer to the actual pixels. Bitmaps can be drawn into a <see cref="T:SkiaSharp.SKCanvas" />, but they are also used to specify the target of a <see cref="T:SkiaSharp.SKCanvas" />' drawing operations.</para>
|
||||
<para>A <see cref="T:SkiaSharp.SKBitmap" /> exposes <see cref="M:SkiaSharp.SKBitmap.GetPixels" />, which lets a caller write its pixels. To retrive a pointer to the raw image data of the bitmap, call the <see cref="M:SkiaSharp.SKBitmap.LockPixels" /> method, and then call the <see cref="M:SkiaSharp.SKBitmap.GetPixels" /> method to get a pointer to the image data. Once you no longer need to use the raw data pointer, call the <see cref="M:SkiaSharp.SKBitmap.UnlockPixels" /> method. The raw data is laid out in the format configured at the time that the bitmap was created.</para>
|
||||
<para>A <see cref="T:SkiaSharp.SKBitmap" /> exposes <see cref="M:SkiaSharp.SKBitmap.GetPixels" />, which lets a caller write its pixels. To retrieve a pointer to the raw image data of the bitmap, call the <see cref="M:SkiaSharp.SKBitmap.LockPixels" /> method, and then call the <see cref="M:SkiaSharp.SKBitmap.GetPixels" /> method to get a pointer to the image data. Once you no longer need to use the raw data pointer, call the <see cref="M:SkiaSharp.SKBitmap.UnlockPixels" /> method. The raw data is laid out in the format configured at the time that the bitmap was created.</para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<summary>Encodes the image using the <see cref="F:SkiaSharp.SKImageEncodeFormat.Png" /> format.</summary>
|
||||
<returns>Returns the <see cref="T:SkiaSharp.SKData" /> wrapping the encoded image.</returns>
|
||||
<remarks>
|
||||
<para>Use the overload that takes a <see cref="T:SkiaSharp.SKImageEncodeFormat" /> if you want to encode in a different format.</para>
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
|
|
|
@ -23,6 +23,20 @@
|
|||
<para></para>
|
||||
<para>This makes it easy to create a shader once (e.g. bitmap tiling or gradient) and then change its transparency without having to modify the original shader, only the paint's alpha needs to be modified.</para>
|
||||
<para>Shaders are created by calling one of the static “Create” methods in the SKShader method that create a shader of the appropriate type.</para>
|
||||
<format type="text/html">
|
||||
<h2>Linear Gradient Shader</h2>
|
||||
</format>
|
||||
<example>
|
||||
<code lang="c#"><![CDATA[
|
||||
var colors = new SKColor [] { new SKColor (0, 255, 255), new SKColor (255, 0, 255), new SKColor (255, 255, 0), new SKColor (0, 255, 255)};
|
||||
var shader = SKShader.CreateLinearGradient (new SKPoint (0, 0), new SKPoint (255, 255), colors, null, SKShaderTileMode.Clamp);
|
||||
var paint = new SKPaint () { Shader = shader };
|
||||
canvas.DrawPaint (paint);
|
||||
]]></code>
|
||||
</example>
|
||||
<para>
|
||||
<img href="linear.png"/>
|
||||
</para>
|
||||
<format type="text/html">
|
||||
<h2>Radial Gradient Shader</h2>
|
||||
</format>
|
||||
|
@ -37,7 +51,7 @@ var paint = new SKPaint () {
|
|||
};
|
||||
canvas.DrawPaint (paint);]]></code>
|
||||
</example>
|
||||
<img src="/cvs/SkiaSharp/docs/en/SkiaSharp/_images/radial.png" />
|
||||
<para> <img href="radial.png" /></para>
|
||||
<format type="text/html">
|
||||
<h2>Two-point Conical Gradient Shader</h2>
|
||||
</format>
|
||||
|
@ -52,7 +66,7 @@ var paint = new SKPaint () {
|
|||
};
|
||||
canvas.DrawPaint (paint);]]></code>
|
||||
</example>
|
||||
<img src="/cvs/SkiaSharp/docs/en/SkiaSharp/_images/twopoint.png" />
|
||||
<para> <img href="twopoint.png" /></para>
|
||||
<format type="text/html">
|
||||
<h2>Sweep Gradient Shader</h2>
|
||||
</format>
|
||||
|
@ -69,7 +83,7 @@ var paint = new SKPaint () {
|
|||
};
|
||||
canvas.DrawPaint (paint);]]></code>
|
||||
</example>
|
||||
<format>
|
||||
<format type="text/html">
|
||||
<h2>Fractal Perlin Noise</h2>
|
||||
</format>
|
||||
<example>
|
||||
|
@ -77,8 +91,8 @@ canvas.DrawPaint (paint);]]></code>
|
|||
var paint = new SKPaint () { Shader = shader };
|
||||
canvas.DrawPaint (paint);]]></code>
|
||||
</example>
|
||||
<img src="/cvs/SkiaSharp/docs/en/SkiaSharp/_images/fractalnoise.png" />
|
||||
<format>
|
||||
<para> <img href="fractalnoise.png" /></para>
|
||||
<format type="text/html">
|
||||
<h2>Turbulence Perlin Noise</h2>
|
||||
</format>
|
||||
<example>
|
||||
|
@ -86,8 +100,8 @@ canvas.DrawPaint (paint);]]></code>
|
|||
var paint = new SKPaint () { Shader = turbulence };
|
||||
canvas.DrawPaint (paint);]]></code>
|
||||
</example>
|
||||
<img src="/cvs/SkiaSharp/docs/en/SkiaSharp/_images/turbulence.png" />
|
||||
<format>
|
||||
<para> <img href="turbulence.png" /></para>
|
||||
<format type="text/html">
|
||||
<h2>Compose Shader</h2>
|
||||
</format>
|
||||
<example>
|
||||
|
@ -100,7 +114,7 @@ var paint = new SKPaint () { Shader = shader };
|
|||
canvas.DrawPaint (paint);]]>
|
||||
</code>
|
||||
</example>
|
||||
<img src="/cvs/SkiaSharp/docs/en/SkiaSharp/_images/compose.png" />
|
||||
<para> <img href="compose.png" /></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
|
@ -199,7 +213,6 @@ canvas.DrawPaint (paint);]]>
|
|||
<summary>Creates a new shader that just draws the specified color.</summary>
|
||||
<returns>Returns a new <see cref="T:SkiaSharp.SKShader" />, or an empty shader on error. This function never returns null.</returns>
|
||||
<remarks>
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
|
@ -261,7 +274,17 @@ canvas.DrawPaint (paint);]]>
|
|||
<summary>Create a new compose shader, which combines two shaders by the <see cref="F:SkiaSharp.SKXferMode.SrcOver" /> blend mode.</summary>
|
||||
<returns>Returns a new <see cref="T:SkiaSharp.SKShader" />, or an empty shader on error. This function never returns null.</returns>
|
||||
<remarks>
|
||||
<para></para>
|
||||
<example>
|
||||
<code lang="c#"><![CDATA[
|
||||
var colors = new SKColor [] { new SKColor (0, 255, 255), new SKColor (255, 0, 255), new SKColor (255, 255, 0), new SKColor (0, 255, 255)};
|
||||
var sweep = SKShader.CreateSweepGradient (new SKPoint (128, 128), colors, null);
|
||||
var turbulence = SKShader.CreatePerlinNoiseTurbulence (0.05f, 0.05f, 4, 0);
|
||||
var shader = SKShader.CreateCompose (sweep, turbulence);
|
||||
var paint = new SKPaint () { Shader = shader };
|
||||
canvas.DrawPaint (paint);]]>
|
||||
</code>
|
||||
</example>
|
||||
<para> <img href="compose.png" /></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
|
@ -388,7 +411,15 @@ canvas.DrawPaint (paint);]]>
|
|||
<summary>Creates a shader that generates a linear gradient between the two specified points.</summary>
|
||||
<returns>Returns a new <see cref="T:SkiaSharp.SKShader" />, or an empty shader on error. This function never returns null.</returns>
|
||||
<remarks>
|
||||
<para></para>
|
||||
<example>
|
||||
<code lang="c#"><![CDATA[
|
||||
var colors = new SKColor [] { new SKColor (0, 255, 255), new SKColor (255, 0, 255), new SKColor (255, 255, 0), new SKColor (0, 255, 255)};
|
||||
var shader = SKShader.CreateLinearGradient (new SKPoint (0, 0), new SKPoint (255, 255), colors, null, SKShaderTileMode.Clamp);
|
||||
var paint = new SKPaint () { Shader = shader };
|
||||
canvas.DrawPaint (paint);
|
||||
]]></code>
|
||||
</example>
|
||||
<para><img href="linear.png"/></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
|
|
|
@ -27,9 +27,25 @@
|
|||
<para></para>
|
||||
<example>
|
||||
<code lang="C#"><![CDATA[using (var surface = SKSurface.Create (width: 640, height: 480, SKImageInfo.PlatformColorType, SKAlphaType.Premul)) {
|
||||
// fetch the canvas where we draw into
|
||||
SKCanvas myCanvas = surface.Canvas;
|
||||
|
||||
// Your drawing code goes here.
|
||||
// Configure our brush
|
||||
var redBrush = new SKPaint () {
|
||||
Color = new SKColor (0xff, 0, 0),
|
||||
IsStroke = true
|
||||
};
|
||||
var blueBrush = new SKPaint () {
|
||||
Color = new SKColor (0, 0, 0xff),
|
||||
IsStroke = true
|
||||
};
|
||||
|
||||
for (int i = 0; i < 64; i += 8)
|
||||
canvas.DrawRect (new SKRect (i, i, 256-i, 256-i), (i % 16 == 0) ? redBrush : blueBrush);
|
||||
|
||||
// Save the artwork
|
||||
var pngEncodedFile = surface.Snapshot().Encode();
|
||||
File.WriteAllBytes ("demo.png", pngEncodedFile);
|
||||
}
|
||||
]]></code>
|
||||
</example>
|
||||
|
@ -638,9 +654,11 @@
|
|||
<Docs>
|
||||
<summary>Takes a snapshot of the surface and returns it as an image.</summary>
|
||||
<returns>
|
||||
<para>An <see cref="T:SkiaSharp.SKImage" /> that contains a snapshot of the current image.</para>
|
||||
<para></para>
|
||||
</returns>
|
||||
<remarks>
|
||||
<para>You can use this method to take a snapshot of the image</para>
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
|
|
Загрузка…
Ссылка в новой задаче