Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants authored Aug 28, 2021
2 parents 8774c97 + d31cc33 commit 0087497
Show file tree
Hide file tree
Showing 75 changed files with 1,048 additions and 1,192 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:

- name: DotNet Build
shell: pwsh
run: ./ci-build.ps1 "${{matrix.options.framework}}"
run: ./ci-build.ps1
env:
SIXLABORS_TESTING: True

Expand Down
14 changes: 14 additions & 0 deletions ImageSharp.Drawing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Drawing.Benchmar
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedInfrastructure", "shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.shproj", "{68A8CC40-6AED-4E96-B524-31B1158FDEEA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{528610AC-7C0C-46E8-9A2D-D46FD92FEE29}"
ProjectSection(SolutionItems) = preProject
samples\Directory.Build.props = samples\Directory.Build.props
samples\Directory.Build.targets = samples\Directory.Build.targets
samples\Drawing.Samples.ruleset = samples\Drawing.Samples.ruleset
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawShapesWithImageSharp", "samples\DrawShapesWithImageSharp\DrawShapesWithImageSharp.csproj", "{5493F024-0A3F-420C-AC2D-05B77A36025B}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{2e33181e-6e28-4662-a801-e2e7dc206029}*SharedItemsImports = 5
Expand All @@ -346,6 +355,10 @@ Global
{59804113-1DD4-4F80-8D06-35FF71652508}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59804113-1DD4-4F80-8D06-35FF71652508}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59804113-1DD4-4F80-8D06-35FF71652508}.Release|Any CPU.Build.0 = Release|Any CPU
{5493F024-0A3F-420C-AC2D-05B77A36025B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5493F024-0A3F-420C-AC2D-05B77A36025B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5493F024-0A3F-420C-AC2D-05B77A36025B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5493F024-0A3F-420C-AC2D-05B77A36025B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -371,6 +384,7 @@ Global
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{59804113-1DD4-4F80-8D06-35FF71652508} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{68A8CC40-6AED-4E96-B524-31B1158FDEEA} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{5493F024-0A3F-420C-AC2D-05B77A36025B} = {528610AC-7C0C-46E8-9A2D-D46FD92FEE29}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5F8B9D1F-CD8B-4CC5-8216-D531E25BD795}
Expand Down
7 changes: 1 addition & 6 deletions ci-build.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$targetFramework
)

dotnet clean -c Release

$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"

# Building for a specific framework.
dotnet build -c Release -f $targetFramework /p:RepositoryUrl=$repositoryUrl
dotnet build -c Release /p:RepositoryUrl=$repositoryUrl
2 changes: 2 additions & 0 deletions ci-pack.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dotnet clean -c Release

$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"

# Building for packing and publishing.
Expand Down
26 changes: 26 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<!--
Directory.Build.props is automatically picked up and imported by
Microsoft.Common.props. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. They import fairly early and only Sdk.props will have been
imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->

<!--Set product category-->
<PropertyGroup>
<SixLaborsProjectCategory>samples</SixLaborsProjectCategory>
<IsPackable>false</IsPackable>
</PropertyGroup>

<!-- Import the solution .props file. -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />

<PropertyGroup>
<CodeAnalysisRuleSet>..\Drawing.Samples.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
16 changes: 16 additions & 0 deletions samples/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<!--
Directory.Build.targets is automatically picked up and imported by
Microsoft.Common.targets. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. They import fairly late and most other props/targets will have
been imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->

<!-- Import the solution .targets file. -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />

</Project>
13 changes: 3 additions & 10 deletions samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DebugType>portable</DebugType>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\SixLabors.Shapes.Text\SixLabors.Shapes.Text.csproj" />
<ProjectReference Include="..\..\src\SixLabors.Shapes\SixLabors.Shapes.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-dev002919" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.Numerics" Version="4.3.0" />
<ProjectReference Include="..\..\src\ImageSharp.Drawing\ImageSharp.Drawing.csproj" />
</ItemGroup>

</Project>
40 changes: 24 additions & 16 deletions samples/DrawShapesWithImageSharp/ImageSharpLogo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

using System;
using System.Collections.Generic;
using System.Numerics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;

Expand All @@ -16,13 +21,15 @@ public static void SaveLogo(float size, string path)

var center = new Vector2(603);

// segment whose center of rotation should be
// segment whose center of rotation should be
var segmentOffset = new Vector2(301.16968f, 301.16974f);
IPath segment = new Polygon(new LinearLineSegment(new Vector2(230.54f, 361.0261f), new System.Numerics.Vector2(5.8641942f, 361.46031f)),
new CubicBezierLineSegment(new Vector2(5.8641942f, 361.46031f),
new Vector2(-11.715693f, 259.54052f),
new Vector2(24.441609f, 158.17478f),
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset);
IPath segment = new Polygon(
new LinearLineSegment(new Vector2(230.54f, 361.0261f), new Vector2(5.8641942f, 361.46031f)),
new CubicBezierLineSegment(
new Vector2(5.8641942f, 361.46031f),
new Vector2(-11.715693f, 259.54052f),
new Vector2(24.441609f, 158.17478f),
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset);

// we need to create 6 of theses all rotated about the center point
var segments = new List<IPath>();
Expand All @@ -33,23 +40,24 @@ public static void SaveLogo(float size, string path)
segments.Add(s);
}

var colors = new List<Rgba32>() {
Rgba32.FromHex("35a849"),
Rgba32.FromHex("fcee21"),
Rgba32.FromHex("ed7124"),
Rgba32.FromHex("cb202d"),
Rgba32.FromHex("5f2c83"),
Rgba32.FromHex("085ba7"),
var colors = new List<Color>()
{
Color.ParseHex("35a849"),
Color.ParseHex("fcee21"),
Color.ParseHex("ed7124"),
Color.ParseHex("cb202d"),
Color.ParseHex("5f2c83"),
Color.ParseHex("085ba7"),
};

var scaler = Matrix3x2.CreateScale(scalingFactor, Vector2.Zero);

int dimensions = (int)Math.Ceiling(size);
using (var img = new Image<Rgba32>(dimensions, dimensions))
{
img.Mutate(i => i.Fill(Rgba32.Black));
img.Mutate(i => i.Fill(Rgba32.FromHex("e1e1e1ff"), new EllipsePolygon(center, 600f).Transform(scaler)));
img.Mutate(i => i.Fill(Rgba32.White, new EllipsePolygon(center, 600f - 60).Transform(scaler)));
img.Mutate(i => i.Fill(Color.Black));
img.Mutate(i => i.Fill(Color.ParseHex("e1e1e1ff"), new EllipsePolygon(center, 600f).Transform(scaler)));
img.Mutate(i => i.Fill(Color.White, new EllipsePolygon(center, 600f - 60).Transform(scaler)));

for (int s = 0; s < 6; s++)
{
Expand Down
Loading

0 comments on commit 0087497

Please sign in to comment.