Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Magick.NET-Q16-AnyCPU from 11.3.0 to 13.3.0 in /Demo-ImageMagick #22

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions Demo-SkiaSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using System;
using System.IO;
using SkiaSharp;

namespace Net.Codecrete.QrCodeGenerator.Demo
{
Expand All @@ -22,13 +21,9 @@ internal static void Main()
var filename = "hello-world-QR.png";

var qr = QrCode.EncodeText(text, QrCode.Ecc.Medium); // Create the QR code symbol

qr.SaveAsPng(filename, scale: 10, border: 4);
Console.WriteLine($"QR code has been saved as {Path.GetFullPath(filename)}");

filename = "transparent-QR.png";
qr.SaveAsPng(filename, 10, 4, SKColors.DarkBlue, SKColors.Transparent);
Console.WriteLine($"QR code has been saved as {Path.GetFullPath(filename)}");
Console.WriteLine($"The QR code has been saved as {Path.GetFullPath(filename)}");
}
}
}
24 changes: 13 additions & 11 deletions Demo-SkiaSharp/QrCodeBitmapExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,27 @@ public static SKBitmap ToBitmap(this QrCode qrCode, int scale, int border, SKCol
}

// create bitmap
bool usesTransparency = background.Alpha != 255;
var bitmap = new SKBitmap(dim, dim,
usesTransparency ? SKColorType.Rgba8888 : SKColorType.Rgb888x,
usesTransparency ? SKAlphaType.Premul : SKAlphaType.Opaque);
SKBitmap bitmap = new SKBitmap(dim, dim, SKColorType.Rgb888x, SKAlphaType.Opaque);

using (var canvas = new SKCanvas(bitmap))
using (SKCanvas canvas = new SKCanvas(bitmap))
{
// draw background
canvas.Clear(background);
using (SKPaint paint = new SKPaint { Color = background })
{
canvas.DrawRect(0, 0, dim, dim, paint);
}

// draw modules
using var paint = new SKPaint { Color = foreground };
for (int y = 0; y < size; y++)
using (SKPaint paint = new SKPaint { Color = foreground })
{
for (int x = 0; x < size; x++)
for (int y = 0; y < size; y++)
{
if (qrCode.GetModule(x, y))
for (int x = 0; x < size; x++)
{
canvas.DrawRect((x + border) * scale, (y + border) * scale, scale, scale, paint);
if (qrCode.GetModule(x, y))
{
canvas.DrawRect((x + border) * scale, (y + border) * scale, scale, scale, paint);
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions QrCodeGenerator/QrCodeGenerator.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Net.Codecrete.QrCodeGenerator</RootNamespace>
<PackageId>Net.Codecrete.QrCodeGenerator</PackageId>
<Version>2.0.4</Version>
Expand Down
34 changes: 0 additions & 34 deletions QrCodeGenerator/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,6 @@
"resolved": "1.1.1",
"contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
}
},
"net6.0": {
"Microsoft.NET.ILLink.Analyzers": {
"type": "Direct",
"requested": "[7.0.100-1.23211.1, )",
"resolved": "7.0.100-1.23211.1",
"contentHash": "0GvbEgDGcUQA9KuWcQU1WwYHXt1tBzNr1Nls/M57rM7NA/AndFwCaCEoJpJkmxRY7xLlPDBnmGp8h5+FNqUngg=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[7.0.100-1.23211.1, )",
"resolved": "7.0.100-1.23211.1",
"contentHash": "tvG8XZYLjT0o3WicCyKBZysVWo1jC9HdCFmNRmddx3WbAz0UCsd0qKZqpiEo99VLA8Re+FzWK51OcRldQPbt2Q=="
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
"requested": "[1.*, )",
"resolved": "1.1.1",
"contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q=="
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
}
}
}
}
Loading