Skip to content

Commit

Permalink
Add compatibility overloads for SKFilterQuality (#2963)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Aug 16, 2024
1 parent 054d48e commit e5675c9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions binding/SkiaSharp/SKBitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,20 @@ public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy) =>
public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling) =>
ToShader (tmx, tmy, sampling, null);

[Obsolete ("Use ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling) instead.")]
public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKFilterQuality quality) =>
ToShader (tmx, tmy, quality.ToSamplingOptions(), null);

public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix) =>
ToShader (tmx, tmy, SKSamplingOptions.Default, &localMatrix);

public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling, SKMatrix localMatrix) =>
ToShader (tmx, tmy, sampling, &localMatrix);

[Obsolete ("Use ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling, SKMatrix localMatrix) instead.")]
public SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKFilterQuality quality, SKMatrix localMatrix) =>
ToShader (tmx, tmy, quality.ToSamplingOptions(), &localMatrix);

private SKShader ToShader (SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling, SKMatrix* localMatrix) =>
SKShader.GetObject (SkiaApi.sk_bitmap_make_shader (Handle, tmx, tmy, &sampling, localMatrix));
}
Expand Down
8 changes: 8 additions & 0 deletions binding/SkiaSharp/SKImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,17 @@ public SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKMatr
public SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKSamplingOptions sampling) =>
ToShader (tileX, tileY, sampling, null);

[Obsolete ("Use ToShader(SKShaderTileMode tileX, SKShaderTileMode tileY, SKSamplingOptions sampling) instead.")]
public SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKFilterQuality quality) =>
ToShader (tileX, tileY, quality.ToSamplingOptions(), null);

public SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKSamplingOptions sampling, SKMatrix localMatrix) =>
ToShader (tileX, tileY, sampling, &localMatrix);

[Obsolete ("Use ToShader(SKShaderTileMode tileX, SKShaderTileMode tileY, SKSamplingOptions sampling, SKMatrix localMatrix) instead.")]
public SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKFilterQuality quality, SKMatrix localMatrix) =>
ToShader (tileX, tileY, quality.ToSamplingOptions(), &localMatrix);

private SKShader ToShader (SKShaderTileMode tileX, SKShaderTileMode tileY, SKSamplingOptions sampling, SKMatrix* localMatrix) =>
SKShader.GetObject (SkiaApi.sk_image_make_shader (Handle, tileX, tileY, &sampling, localMatrix));

Expand Down
8 changes: 8 additions & 0 deletions binding/SkiaSharp/SKShader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,20 @@ public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderT
public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling) =>
src?.ToShader (tmx, tmy, sampling) ?? throw new ArgumentNullException (nameof (src));

[Obsolete ("Use CreateImage(SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling) instead.")]
public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKFilterQuality quality) =>
src?.ToShader (tmx, tmy, quality.ToSamplingOptions()) ?? throw new ArgumentNullException (nameof (src));

public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix) =>
src?.ToShader (tmx, tmy, localMatrix) ?? throw new ArgumentNullException (nameof (src));

public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling, SKMatrix localMatrix) =>
src?.ToShader (tmx, tmy, sampling, localMatrix) ?? throw new ArgumentNullException (nameof (src));

[Obsolete ("Use CreateImage(SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKSamplingOptions sampling, SKMatrix localMatrix) instead.")]
public static SKShader CreateImage (SKImage src, SKShaderTileMode tmx, SKShaderTileMode tmy, SKFilterQuality quality, SKMatrix localMatrix) =>
src?.ToShader (tmx, tmy, quality.ToSamplingOptions(), localMatrix) ?? throw new ArgumentNullException (nameof (src));

// CreatePicture

public static SKShader CreatePicture (SKPicture src) =>
Expand Down

0 comments on commit e5675c9

Please sign in to comment.