-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from guitarrapc/fix/libskiasharp
fix: remove SkiaSharp.NativeAssets.Linux dependency to enable package handle via user
- Loading branch information
Showing
26 changed files
with
477 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,3 +361,5 @@ MigrationBackup/ | |
# Fody - auto-generated XML schema | ||
FodyWeavers.xsd | ||
|
||
# custom | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SkiaSharp.QrCode" Version="0.4.0" /> | ||
<!-- require libfontconfig1 https://github.com/mono/SkiaSharp/issues/964#issuecomment-549385484 --> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="samples\*.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using SkiaSharp; | ||
using System; | ||
using System.IO; | ||
using SkiaSharp.QrCode; | ||
using SkiaSharp.QrCode.Models; | ||
|
||
namespace SkiaQrCodeSampleConsole | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Directory.CreateDirectory("output"); | ||
|
||
var content = "testtesttest"; | ||
using (var generator = new QRCodeGenerator()) | ||
{ | ||
// Generate QrCode | ||
var qr = generator.CreateQrCode(content, ECCLevel.L); | ||
|
||
// Render to canvas | ||
var info = new SKImageInfo(512, 512); | ||
using (var surface = SKSurface.Create(info)) | ||
{ | ||
var canvas = surface.Canvas; | ||
canvas.Render(qr, info.Width, info.Height); | ||
|
||
// gen color | ||
// yellow https://rgb.to/yellow | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(60,100,50)); | ||
// red https://rgb.to/red | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(0, 100, 50)); | ||
|
||
// gen icon | ||
var logo = File.ReadAllBytes("samples/test.png"); | ||
var icon = new IconData | ||
{ | ||
Icon = SKBitmap.Decode(logo), | ||
IconSizePercent = 10, | ||
}; | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.Parse("000000"), icon); | ||
|
||
// Output to Stream -> File | ||
using (var image = surface.Snapshot()) | ||
using (var data = image.Encode(SKEncodedImageFormat.Png, 100)) | ||
using (var stream = File.OpenWrite(@"output/hoge.png")) | ||
{ | ||
data.SaveTo(stream); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash -ex | ||
|
||
FRAMEWORK=netcoreapp3.1 | ||
while [ $# -gt 0 ]; do | ||
case $1 in | ||
-f) FRAMEWORK=$2; shift 2; ;; | ||
*) shift ;; | ||
esac | ||
done | ||
|
||
apt update && apt install -y libfontconfig1 | ||
|
||
dotnet run --csproj BuildTest.csproj -f "${FRAMEWORK}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SkiaSharp.QrCode" Version="0.4.0" /> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="samples\*.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using SkiaSharp; | ||
using System; | ||
using System.IO; | ||
using SkiaSharp.QrCode; | ||
using SkiaSharp.QrCode.Models; | ||
|
||
namespace SkiaQrCodeSampleConsole | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Directory.CreateDirectory("output"); | ||
|
||
var content = "testtesttest"; | ||
using (var generator = new QRCodeGenerator()) | ||
{ | ||
// Generate QrCode | ||
var qr = generator.CreateQrCode(content, ECCLevel.L); | ||
|
||
// Render to canvas | ||
var info = new SKImageInfo(512, 512); | ||
using (var surface = SKSurface.Create(info)) | ||
{ | ||
var canvas = surface.Canvas; | ||
canvas.Render(qr, info.Width, info.Height); | ||
|
||
// gen color | ||
// yellow https://rgb.to/yellow | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(60,100,50)); | ||
// red https://rgb.to/red | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(0, 100, 50)); | ||
|
||
// gen icon | ||
var logo = File.ReadAllBytes("samples/test.png"); | ||
var icon = new IconData | ||
{ | ||
Icon = SKBitmap.Decode(logo), | ||
IconSizePercent = 10, | ||
}; | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.Parse("000000"), icon); | ||
|
||
// Output to Stream -> File | ||
using (var image = surface.Snapshot()) | ||
using (var data = image.Encode(SKEncodedImageFormat.Png, 100)) | ||
using (var stream = File.OpenWrite(@"output/hoge.png")) | ||
{ | ||
data.SaveTo(stream); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -ex | ||
|
||
FRAMEWORK=netcoreapp3.1 | ||
while [ $# -gt 0 ]; do | ||
case $1 in | ||
-f) FRAMEWORK=$2; shift 2; ;; | ||
*) shift ;; | ||
esac | ||
done | ||
|
||
dotnet run --csproj BuildTest.csproj -f "${FRAMEWORK}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SkiaSharp.QrCode" Version="0.4.0" /> | ||
<!-- require libfontconfig1 https://github.com/mono/SkiaSharp/issues/964#issuecomment-549385484 --> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="samples\*.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using SkiaSharp; | ||
using System; | ||
using System.IO; | ||
using SkiaSharp.QrCode; | ||
using SkiaSharp.QrCode.Models; | ||
|
||
namespace SkiaQrCodeSampleConsole | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Directory.CreateDirectory("output"); | ||
|
||
var content = "testtesttest"; | ||
using (var generator = new QRCodeGenerator()) | ||
{ | ||
// Generate QrCode | ||
var qr = generator.CreateQrCode(content, ECCLevel.L); | ||
|
||
// Render to canvas | ||
var info = new SKImageInfo(512, 512); | ||
using (var surface = SKSurface.Create(info)) | ||
{ | ||
var canvas = surface.Canvas; | ||
canvas.Render(qr, info.Width, info.Height); | ||
|
||
// gen color | ||
// yellow https://rgb.to/yellow | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(60,100,50)); | ||
// red https://rgb.to/red | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.FromHsl(0, 100, 50)); | ||
|
||
// gen icon | ||
var logo = File.ReadAllBytes("samples/test.png"); | ||
var icon = new IconData | ||
{ | ||
Icon = SKBitmap.Decode(logo), | ||
IconSizePercent = 10, | ||
}; | ||
canvas.Render(qr, info.Width, info.Height, SKColor.Empty, SKColor.Parse("000000"), icon); | ||
|
||
// Output to Stream -> File | ||
using (var image = surface.Snapshot()) | ||
using (var data = image.Encode(SKEncodedImageFormat.Png, 100)) | ||
using (var stream = File.OpenWrite(@"output/hoge.png")) | ||
{ | ||
data.SaveTo(stream); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash -ex | ||
|
||
FRAMEWORK=netcoreapp3.1 | ||
while [ $# -gt 0 ]; do | ||
case $1 in | ||
-f) FRAMEWORK=$2; shift 2; ;; | ||
*) shift ;; | ||
esac | ||
done | ||
|
||
apt update && apt install -y libfontconfig1 | ||
|
||
dotnet run --csproj BuildTest.csproj -f "${FRAMEWORK}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SkiaSharp.QrCode" Version="0.4.0" /> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="samples\*.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.