зеркало из https://github.com/mono/SkiaSharp.git
[SkMatrix] Add various Map methods
This commit is contained in:
Родитель
1757a3bb46
Коммит
c53ab2b03b
|
@ -1304,6 +1304,100 @@ typeMask = Mask.Scale | Mask.RectStaysRect
|
|||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_post_concat")]
|
||||
public extern static void PostConcat (ref SKMatrix target, ref SKMatrix matrix);
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_map_rect")]
|
||||
extern static void MapRect (ref SKMatrix matrix, out SKRect dest, ref SKRect source);
|
||||
|
||||
public SKRect MapRect (SKRect source)
|
||||
{
|
||||
SKRect result;
|
||||
MapRect (ref this, out result, ref source);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
extern static void sk_matrix_map_points (ref SKMatrix matrix, IntPtr dst, IntPtr src, int count);
|
||||
|
||||
public void MapPoints (SKPoint [] result, SKPoint [] points)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
if (points == null)
|
||||
throw new ArgumentNullException ("points");
|
||||
int dl = result.Length;
|
||||
if (dl != points.Length)
|
||||
throw new ArgumentException ("buffers must be the same size");
|
||||
unsafe {
|
||||
fixed (SKPoint *rp = &result[0]){
|
||||
fixed (SKPoint *pp = &points[0]){
|
||||
sk_matrix_map_points (ref this, (IntPtr) rp, (IntPtr) pp, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SKPoint [] MapPoints (SKPoint [] points)
|
||||
{
|
||||
if (points == null)
|
||||
throw new ArgumentNullException ("points");
|
||||
var res = new SKPoint [points.Length];
|
||||
MapPoints (res, points);
|
||||
return res;
|
||||
}
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
extern static void sk_matrix_map_vectors (ref SKMatrix matrix, IntPtr dst, IntPtr src, int count);
|
||||
|
||||
public void MapVectors (SKPoint [] result, SKPoint [] vectors)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
if (vectors == null)
|
||||
throw new ArgumentNullException ("vectors");
|
||||
int dl = result.Length;
|
||||
if (dl != vectors.Length)
|
||||
throw new ArgumentException ("buffers must be the same size");
|
||||
unsafe {
|
||||
fixed (SKPoint *rp = &result[0]){
|
||||
fixed (SKPoint *pp = &vectors[0]){
|
||||
sk_matrix_map_vectors (ref this, (IntPtr) rp, (IntPtr) pp, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SKPoint [] MapVectors (SKPoint [] vectors)
|
||||
{
|
||||
if (vectors == null)
|
||||
throw new ArgumentNullException ("vectors");
|
||||
var res = new SKPoint [vectors.Length];
|
||||
MapVectors (res, vectors);
|
||||
return res;
|
||||
}
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
extern static SKPoint sk_matrix_map_xy (ref SKMatrix matrix, float x, float y);
|
||||
|
||||
public SKPoint MapXY (float x, float y)
|
||||
{
|
||||
return sk_matrix_map_xy (ref this, x, y);
|
||||
}
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
extern static SKPoint sk_matrix_map_vector (ref SKMatrix matrix, float x, float y);
|
||||
|
||||
public SKPoint MapVector (float x, float y)
|
||||
{
|
||||
return sk_matrix_map_vector (ref this, x, y);
|
||||
}
|
||||
|
||||
[DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
extern static float sk_matrix_map_radius (ref SKMatrix matrix, float radius);
|
||||
|
||||
public float MapRadius (float radius)
|
||||
{
|
||||
return sk_matrix_map_radius (ref this, radius);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
|
|
@ -811,11 +811,9 @@ namespace SkiaSharp
|
|||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static int sk_matrix_try_invert(ref SKMatrix matrix, out SKMatrix result);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static int sk_matrix_preconcat(ref SKMatrix target, ref SKMatrix first, ref SKMatrix second);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static int sk_matrix_preconcat(ref SKMatrix target, ref SKMatrix matrix);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static int sk_matrix_postconcat(ref SKMatrix target, ref SKMatrix matrix);
|
||||
public extern static int sk_matrix_post_concat(ref SKMatrix target, ref SKMatrix matrix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,8 @@
|
|||
<Docs>
|
||||
<summary>Returns the configured alpha type for the bitmap.</summary>
|
||||
<value>
|
||||
<para />
|
||||
<para>
|
||||
</para>
|
||||
</value>
|
||||
<remarks>This determines the kind of encoding used for the alpha channel, opaque, premultiplied or unpremultiplied.</remarks>
|
||||
</Docs>
|
||||
|
|
|
@ -250,6 +250,183 @@
|
|||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapPoints">
|
||||
<MemberSignature Language="C#" Value="public SkiaSharp.SKPoint[] MapPoints (SkiaSharp.SKPoint[] points);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance valuetype SkiaSharp.SKPoint[] MapPoints(valuetype SkiaSharp.SKPoint[] points) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>SkiaSharp.SKPoint[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="points" Type="SkiaSharp.SKPoint[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="points">An array of points that you want to map.</param>
|
||||
<summary>
|
||||
<para>Apply the to the array of points and return the mapped results.</para>
|
||||
</summary>
|
||||
<returns>New array allocated with the mapped results.</returns>
|
||||
<remarks>
|
||||
<para>Mapping points uses all components of the matrix. If you want to ignore the translation, use MapVectors.</para>
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapPoints">
|
||||
<MemberSignature Language="C#" Value="public void MapPoints (SkiaSharp.SKPoint[] result, SkiaSharp.SKPoint[] points);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void MapPoints(valuetype SkiaSharp.SKPoint[] result, valuetype SkiaSharp.SKPoint[] points) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="result" Type="SkiaSharp.SKPoint[]" />
|
||||
<Parameter Name="points" Type="SkiaSharp.SKPoint[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="result">Array where the mapped results will be stored, the array needs to have the same number of elements of the <paramref name="points" /> array.</param>
|
||||
<param name="points">Source array with the points to convert.</param>
|
||||
<summary>Apply the to the array of points and return the mapped results.</summary>
|
||||
<remarks>
|
||||
<para>Mapping points uses all components of the matrix. If you want to ignore the translation, use MapVectors.</para>
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapRadius">
|
||||
<MemberSignature Language="C#" Value="public float MapRadius (float radius);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 MapRadius(float32 radius) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Single</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="radius" Type="System.Single" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="radius">Radius to map.</param>
|
||||
<summary>
|
||||
<para>Return the mean radius of a circle after it has been mapped by this matrix</para>
|
||||
</summary>
|
||||
<returns>Return the mean radius of a circle after it has been mapped by this matrix</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapRect">
|
||||
<MemberSignature Language="C#" Value="public SkiaSharp.SKRect MapRect (SkiaSharp.SKRect source);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance valuetype SkiaSharp.SKRect MapRect(valuetype SkiaSharp.SKRect source) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>SkiaSharp.SKRect</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="source" Type="SkiaSharp.SKRect" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="source">Source recatngle to map.</param>
|
||||
<summary>Apply the matrix to the source rectangle and return the mapped rectangle.</summary>
|
||||
<returns>The rectangle with the matrix.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapVector">
|
||||
<MemberSignature Language="C#" Value="public SkiaSharp.SKPoint MapVector (float x, float y);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance valuetype SkiaSharp.SKPoint MapVector(float32 x, float32 y) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>SkiaSharp.SKPoint</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="x" Type="System.Single" />
|
||||
<Parameter Name="y" Type="System.Single" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="x">X component of the vector.</param>
|
||||
<param name="y">Y component of the vector.</param>
|
||||
<summary>Applies the matrix to a vector.</summary>
|
||||
<returns>Returns the mapped point.</returns>
|
||||
<remarks>Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapXY.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapVectors">
|
||||
<MemberSignature Language="C#" Value="public SkiaSharp.SKPoint[] MapVectors (SkiaSharp.SKPoint[] vectors);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance valuetype SkiaSharp.SKPoint[] MapVectors(valuetype SkiaSharp.SKPoint[] vectors) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>SkiaSharp.SKPoint[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="points" Type="SkiaSharp.SKPoint[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="vectors">An array of vectors that you want to map.</param>
|
||||
<summary>Apply the to the array of vectors and return the mapped results..</summary>
|
||||
<returns>New array allocated with the mapped results.</returns>
|
||||
<remarks>Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapPoints.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapVectors">
|
||||
<MemberSignature Language="C#" Value="public void MapVectors (SkiaSharp.SKPoint[] result, SkiaSharp.SKPoint[] vectors);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void MapVectors(valuetype SkiaSharp.SKPoint[] result, valuetype SkiaSharp.SKPoint[] vectors) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="result" Type="SkiaSharp.SKPoint[]" />
|
||||
<Parameter Name="points" Type="SkiaSharp.SKPoint[]" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="result">Array where the mapped results will be stored, the array needs to have the same number of elements of the <paramref name="vectors" /> array.</param>
|
||||
<param name="vectors">To be added.</param>
|
||||
<param name="points">An array of vectors that you want to map.</param>
|
||||
<summary>Apply the to the array of vectors and return the mapped results..</summary>
|
||||
<remarks>Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapPoints.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="MapXY">
|
||||
<MemberSignature Language="C#" Value="public SkiaSharp.SKPoint MapXY (float x, float y);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance valuetype SkiaSharp.SKPoint MapXY(float32 x, float32 y) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>1.49.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>SkiaSharp.SKPoint</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="x" Type="System.Single" />
|
||||
<Parameter Name="y" Type="System.Single" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="x">X coordinate.</param>
|
||||
<param name="y">Y coordinate.</param>
|
||||
<summary>Applies the matrix to a point.</summary>
|
||||
<returns>Returns the mapped point.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Persp0">
|
||||
<MemberSignature Language="C#" Value="public float Persp0;" />
|
||||
<MemberSignature Language="ILAsm" Value=".field public float32 Persp0" />
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<Docs>
|
||||
<summary>Possible encodings.</summary>
|
||||
<remarks>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
|
|
|
@ -15,14 +15,19 @@
|
|||
<remarks>
|
||||
<para>The SkTypeface class specifies the typeface and intrinsic style of a font.</para>
|
||||
<para>This is used in the paint, along with optionally algorithmic settings like textSize, textSkewX, textScaleX, FakeBoldText, to specifyhow text appears when drawn (and measured).</para>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<para>Typeface objects are immutable, and so they can be shared between threads.</para>
|
||||
<para>If you want to create type faces with specific weights not covered by the SKTypefaceStyle, you can pass a suffix to the font family name to trigger this, like this:</para>
|
||||
<para></para>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<para>
|
||||
</para>
|
||||
<code lang="C#"><![CDATA[var myThinFace = SKTypeface.FromFamilyName ("sans-serif-thin");]]></code>
|
||||
<para></para>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<para>
|
||||
</para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
|
@ -207,7 +212,8 @@
|
|||
<param name="index">The font face index.</param>
|
||||
<summary>Return a new typeface given a file. </summary>
|
||||
<returns>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
</returns>
|
||||
<remarks>
|
||||
<para>If the file does not exist, or is not a valid font file, returns <paramref name="null" />.</para>
|
||||
|
@ -235,7 +241,8 @@
|
|||
<summary>Return a new typeface given a stream. Ownership of the stream is transferred, so the caller must not reference it again.</summary>
|
||||
<returns>If the stream is not a valid font file, returns <paramref name="null" />. </returns>
|
||||
<remarks>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<example>
|
||||
<code lang="C#"><![CDATA[var stream = new SKFileStream (“myfont.ttf”);
|
||||
using (var tf = SKTypeface.FromStream (stream)) {
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
<summary>Specifies the intrinsic style attributes of a given typeface.</summary>
|
||||
<remarks>
|
||||
<para>While the API does not surface enumeration values for other thin, light, ultra-light, heavy and black, you can achieve the same result by creating an SKTypeface with the suffix “-light”, “-thin” and so on.</para>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<para>Like this:</para>
|
||||
<para></para>
|
||||
<para>
|
||||
</para>
|
||||
<code lang="C#"><![CDATA[var myThinFace = SKTypeface.FromFamilyName ("sans-serif-thin");]]></code>
|
||||
</remarks>
|
||||
</Docs>
|
||||
|
|
|
@ -1073,6 +1073,8 @@
|
|||
TargetAttributes = {
|
||||
21FD2B2F1C014C000023CFAE = {
|
||||
CreatedOnToolsVersion = 7.1.1;
|
||||
DevelopmentTeam = PJQC57N853;
|
||||
DevelopmentTeamName = "Miguel De Icaza";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
2
skia
2
skia
|
@ -1 +1 @@
|
|||
Subproject commit 4cd61dc5e7f5b7b79b3a2815798c4d7479aad51d
|
||||
Subproject commit 2d35987d8ad6e25e2126998d8585fbb7a1b20fd2
|
Загрузка…
Ссылка в новой задаче