Skip to content

Commit

Permalink
SkColorFilter: fix constant names, issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
migueldeicaza committed Mar 6, 2016
1 parent e8b814c commit e6559d6
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 55 deletions.
6 changes: 3 additions & 3 deletions binding/Binding/SKColorFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace SkiaSharp
{
public class SKColorFilter : SKObject
{
public const int MIN_CUBE_SIZE = 4;
public const int MAX_CUBE_SIZE = 64;
public const int MinCubeSize = 4;
public const int MaxCubeSize = 64;

public static bool IsValid3DColorCube(SKData cubeData, int cubeDimension)
{
var minMemorySize = 4 * cubeDimension * cubeDimension * cubeDimension;
return
(cubeDimension >= MIN_CUBE_SIZE) && (cubeDimension <= MAX_CUBE_SIZE) &&
(cubeDimension >= MinCubeSize) && (cubeDimension <= MaxCubeSize) &&
(null != cubeData) && (cubeData.Size >= minMemorySize);
}

Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKAlphaType.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<Docs>
<summary>Describes how to interpret the alpha component of a pixel.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down
18 changes: 12 additions & 6 deletions docs/en/SkiaSharp/SKBitmap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<summary>Default construct creates a bitmap with zero width and height, and no pixels. Its colortype is set to <see cref="E:SkiaSharp.SKColorType.Unknown." /></summary>
<remarks>
<para>This constructor does not allocate a backing store for the bitmap.</para>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -87,7 +88,8 @@
<summary>Creates a bitmap with the given width, height and opacity with color type set to <see cref="E:SkiaSharp.SKColorType.N_32" /></summary>
<remarks>
<para>This constructor might throw an exception if it is not possible to create a bitmap with the specified configuration (for example, the image info requires a color table, and there is no color table).</para>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -230,7 +232,8 @@
<summary>Copies the contents of the bitmap and returns the copy.</summary>
<returns>The copy of the bitmap, or <paramref name="null" /> on error.</returns>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -545,7 +548,8 @@
<summary>Returns the address of the pixels for this SKBitmap</summary>
<returns>Returns a pointer to the region that contains the pixel data for this bitmap.   This might return <see langword="null" /> if there is no pixel buffer associated with this bitmap.</returns>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -612,7 +616,8 @@
<value>
<see langword="true" /> if it is immutable, <see langword="false" /> otherwise.</value>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -775,7 +780,8 @@
<summary>Call this to balance a previous call to <see cref="M:SkiaSharp.SKBitmap.LockPixels" />.</summary>
<remarks>
<para>When you are finished access the pixel memory, call this to balance a previous call to <see cref="M:SkiaSharp.SKBitmap.LockPixels" />. This allows pixelrefs that implement cached/deferred image decoding to know when there are active clients of a given image.</para>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKBlurStyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<Docs>
<summary>Blur types for the <see cref="M:SkiaSharp.SKMaskFilteter.CreateBlur" /> method.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down
60 changes: 40 additions & 20 deletions docs/en/SkiaSharp/SKCanvas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,35 @@
<summary>Encapsulates all of the state about drawing into a device (bitmap).</summary>
<remarks>
<para>Encapsulates all of the state about drawing into a device (bitmap).</para>
<para></para>
<para>
</para>
<para>This includes a reference to the device itself, and a stack of matrix/clip values. For any given draw call (e.g. drawRect), the geometry of the object being drawn is transformed by the concatenation of all the matrices in the stack. The transformed geometry is clipped by the intersection of all of the clips in the stack.</para>
<para></para>
<para>
</para>
<para>While the Canvas holds the state of the drawing device, the state (style) of the object being drawn is held by the Paint, which is provided as a parameter to each of the draw() methods. The Paint holds attributes such as color, typeface, the text size, the stroke width, the shader (for example, gradients, patterns), etc.</para>
<para></para>
<para>
</para>
<para>The SkCanvas is returned when accessing the <see cref="P:SkiaSharp.SKSurface.Canvas" /> property of a surface.</para>
<para>Transformations</para>
<para>The <see cref="T:SkiaSharp.SKCanvas" /> supports a number of 2D transformations.   Unlike other 2D graphic systems like CoreGraphics or Cairo, SKCanvas extends the transformations to include perspectives.   </para>
<para>You can use the <see cref="M:SkiaSharp.SKCanvas.Scale" />, <see cref="M:SkiaSharp.SKCanvas.Skew" />, <see cref="M:SkiaSharp.SKCanvas.Translate" />, <see cref="M:SkiaSharp.SKCanvas.RotateDegrees" />, <see cref="M:SkiaSharp.SKCanvas.RotateRadians" /> to perform some of the most common 2D transformations.   </para>
<para>For more control you can use the <see cref="M:SkiaSharp.SKCanvas.SetMatrix" /> to set an arbitrary transformation using the <see cref="T:SkiaSharp.SKMatrix" /> and the <see cref="M:SkiaSharp.SKCanvas.Concat" /> to concatenate an <see cref="T:SkiaSharp.SKMatrix" /> transformation to the current matrix in use.</para>
<para>The <see cref="M:SkiaSharp.SKCanvas.ResetMatrix" /> can be used to reset the state of the matrix</para>
<para></para>
<para>
</para>
<para>Drawing</para>
<para>The drawing operations can take a <see cref="T:SkiaSharp.SKPaint" /> parameter to affect their drawing.  You use <see cref="T:SkiaSharp.SKPaint" /> objects to cache the style and color information to draw geometries, texts and bitmaps.</para>
<para>Clipping Path</para>
<para>State</para>
<para>It is possible to save the current transformations by calling the <see cref="M:SkiaSharp.SKCanvas.Save" /> method which preserves the current transformation matrix, you can then alter the matrix and restore the previous state by using the <see cref="M:SkiaSharp.SKCanvas.Restore" /> or <see cref="M:SkiaSharp.SKCanvas.RestoreToCount" /> methods.   </para>
<para>Additionally, it is possible to push a new state with <see cref="M:SkiaSharp.SKCanvas.SaveLayer" /> which will make an offscreen copy of a region, and once the drawing is completed, calling the <see cref="M:SkiaSharp.SKCanvas.Restore" /> method which copies the offscreen bitmap into this canvas.</para>
<para>The example below shows a typical use:</para>
<para></para>
<para></para>
<para></para>
<para>
</para>
<para>
</para>
<para>
</para>
<example>
<code lang="C#"><![CDATA[using (var surface = SKSurface.Create (width: 640, height: 480, SKColorType.N_32, SKAlphaType.Premul)) {
SKCanvas canvas = surface.Canvas;
Expand Down Expand Up @@ -265,7 +272,8 @@
<param name="mode">The transfer mode for the color.</param>
<summary>Fills the current clipping path with the specified color using the specified transfer mode.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -455,7 +463,8 @@
<param name="paint">The paint used to draw the picture, or <see langword="null" />.</param>
<summary>Draws a picture on the canvas.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -556,15 +565,20 @@
<summary>Draws an array of points, lines or a polygon in the canvas.</summary>
<remarks>
<para>For all modes, the count parameter is interpreted as the total number of points. For kLine mode, count/2 line segments are drawn.</para>
<para></para>
<para>
</para>
<para>For point mode, each point is drawn centered at its coordinate, and its size is specified by the paint's stroke-width. It draws as a square, unless the paint's cap-type is round, in which the points are drawn as circles.</para>
<para></para>
<para>
</para>
<para>For line mode, each pair of points is drawn as a line segment, respecting the paint's settings for cap, join and width. </para>
<para></para>
<para>
</para>
<para>For polygon mode, the entire array is drawn as a series of connected line segments.</para>
<para></para>
<para>
</para>
<para>Note that, while similar, the line and polygon modes draw slightly differently than the equivalent path built with a series of move to, line to calls, in that the path will draw all of its contours at once, with no interactions if contours intersect each other (think XOR xfermode).  DrawPoints always draws each element one at a time.</para>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -640,7 +654,8 @@
<summary>Draws text from a UTF-8 buffer at specified locations on the canvas.</summary>
<remarks>
<para>Draw the text, with each character/glyph origin specified by the <paramref name="points" /> array. The origin is interpreted by the Align setting in the paint.</para>
<para></para>
<para>
</para>
<para>The <paramref name="buffer" /> parameter is a pointer to a region in memory that contains a UTF-8 encoded block of text.   This only consumes up to <paramref name="length" /> bytes from the buffer.</para>
</remarks>
</Docs>
Expand Down Expand Up @@ -698,7 +713,8 @@
<summary>Draws text encoded in a UTF-8 buffer on the canvas.</summary>
<remarks>
<para>Draws the <paramref name="text" />, with origin at (<paramref name="x" />,<paramref name="y" />), using the specified <paramref name="paint" />. The origin is interpreted based on the Align setting in the paint.</para>
<para></para>
<para>
</para>
<para>The <paramref name="buffer" /> parameter is a pointer to a region in memory that contains a UTF-8 encoded block of text.   This only consumes up to <paramref name="length" /> bytes from the buffer.</para>
</remarks>
</Docs>
Expand Down Expand Up @@ -801,7 +817,8 @@
<summary>Restore the canvas state.</summary>
<remarks>
<para>This call balances a previous call to <see cref="M:SkiaSharp.SKCanvas.Save" />, and is used to remove all modifications to the matrix, clip and draw filter state since the last Save call.</para>
<para></para>
<para>
</para>
<para>It is an error to call Restore() more times than Save() was called.</para>
</remarks>
</Docs>
Expand Down Expand Up @@ -846,7 +863,8 @@
<param name="degrees">The number of degrees to rotate.</param>
<summary>Preconcat the current matrix with the specified rotation.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand All @@ -867,7 +885,8 @@
<param name="radians">The number of radiants to rotate.</param>
<summary>Preconcat the current matrix with the specified rotation.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -907,7 +926,8 @@
<para>This will equal the number of Save calls minus Retore calls + 1. The save count on a new canvas is 1.</para>
</value>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKColor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<summary>32 bit ARGB color value, not premultiplied. </summary>
<remarks>
<para>The color components are always in a known order. </para>
<para></para>
<para>
</para>
<para>SkColor is the type used to specify colors in SkPaint and in gradients.</para>
</remarks>
</Docs>
Expand Down
15 changes: 8 additions & 7 deletions docs/en/SkiaSharp/SKColorFilter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<Docs>
<summary>Color filters for use in an <see cref="T:SkiaSharp.SKPaint" />.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down Expand Up @@ -258,9 +259,9 @@
</remarks>
</Docs>
</Member>
<Member MemberName="MAX_CUBE_SIZE">
<MemberSignature Language="C#" Value="public const int MAX_CUBE_SIZE = 64;" />
<MemberSignature Language="ILAsm" Value=".field public static literal int32 MAX_CUBE_SIZE = (64)" />
<Member MemberName="MaxCubeSize">
<MemberSignature Language="C#" Value="public const int MaxCubeSize = 64;" />
<MemberSignature Language="ILAsm" Value=".field public static literal int32 MaxCubeSize = (64)" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
Expand All @@ -274,9 +275,9 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="MIN_CUBE_SIZE">
<MemberSignature Language="C#" Value="public const int MIN_CUBE_SIZE = 4;" />
<MemberSignature Language="ILAsm" Value=".field public static literal int32 MIN_CUBE_SIZE = (4)" />
<Member MemberName="MinCubeSize">
<MemberSignature Language="C#" Value="public const int MinCubeSize = 4;" />
<MemberSignature Language="ILAsm" Value=".field public static literal int32 MinCubeSize = (4)" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKColorType.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<Docs>
<summary>Describes how to interpret the components of a pixel.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKColors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<Docs>
<summary>Definitions for some common color names.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down
3 changes: 2 additions & 1 deletion docs/en/SkiaSharp/SKCropRectFlags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<Docs>
<summary>Flags used by the <see cref="T:SkiaSharp.SKImageFilter.CropRect" /> method.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
<Members>
Expand Down
9 changes: 6 additions & 3 deletions docs/en/SkiaSharp/SKData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<remarks>
<para>Not only is the data immutable, but the actual pointer that is returned by the <see cref="P:SkiaSharp.SKData.Data" /> property is guaranteed to always be the same for the life of this instance.</para>
<para>The <see cref="M:SkiaSharp.SKData.AsStream" /> method can be used to return a <see cref="T:System.IO.Stream" /> that wraps this SKData and allows for .NET APIs to scan the contents of the SKData as a stream.</para>
<para></para>
<para>
</para>
<para>You can use the constructors for this object to make copies of the data, or you can use the <see cref="M:SkiaSharp.SKData.FromMallocMemory" /> to wrap a block of memory that has been allocated with the platform malloc function.</para>
</remarks>
</Docs>
Expand Down Expand Up @@ -48,7 +49,8 @@
<param name="bytes">Array of bytes that will be copied.</param>
<summary>Creates an SKData by copying the provided byte array.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand All @@ -68,7 +70,8 @@
<param name="length">Length of the buffer.</param>
<summary>Creates an SKData by copying the provided byte buffer for the specified length.</summary>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down
13 changes: 9 additions & 4 deletions docs/en/SkiaSharp/SKImage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
<summary>Abstraction for drawing a rectangle of pixels.</summary>
<remarks>
<para>SkImage is an abstraction for drawing a rectagle of pixels, though the particular type of image could be actually storing its data on the GPU, or as drawing commands (picture or PDF or otherwise), ready to be played back into another canvas.</para>
<para></para>
<para>
</para>
<para>The content of SkImage is always immutable, though the actual storage may change, if for example that image can be re-created via encoded data or other means.</para>
<para></para>
<para>
</para>
<para>SkImage always has a non-zero dimensions. If there is a request to create a new image, either directly or via SkSurface, and either of the requested dimensions are zero, then <see langword="null" /> will be returned.</para>
</remarks>
</Docs>
Expand Down Expand Up @@ -75,7 +77,9 @@
<param name="data">Data holding the encoded image.</param>
<summary>Creates an SKImage from an encoded image wrapped by the data.</summary>
<returns>The decoded image, or <see langword="null" /> on error.</returns>
<remarks>To be added.</remarks>
<remarks>
<para />
</remarks>
</Docs>
</Member>
<Member MemberName="FromData">
Expand All @@ -98,7 +102,8 @@
<summary>Creates an SKImage from an encoded image wrapped by the data.</summary>
<returns>The decoded image, or <see langword="null" /> on error.</returns>
<remarks>
<para></para>
<para>
</para>
</remarks>
</Docs>
</Member>
Expand Down
Loading

0 comments on commit e6559d6

Please sign in to comment.