Skip to content

Commit 689c9c4

Browse files
Main project builds
1 parent d8c5383 commit 689c9c4

File tree

281 files changed

+27303
-27896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+27303
-27896
lines changed

.editorconfig

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Version: 2.1.0 (Using https://semver.org/)
2-
# Updated: 2021-03-03
1+
# Version: 4.1.1 (Using https://semver.org/)
2+
# Updated: 2022-05-23
33
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
44
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
55
# See http://EditorConfig.org for more information about .editorconfig files.
@@ -49,11 +49,11 @@ indent_size = 2
4949
indent_size = 2
5050

5151
# Markdown Files
52-
[*.md]
52+
[*.{md,mdx}]
5353
trim_trailing_whitespace = false
5454

5555
# Web Files
56-
[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}]
56+
[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}]
5757
indent_size = 2
5858

5959
# Batch Files
@@ -75,7 +75,7 @@ indent_style = tab
7575

7676
[*.{cs,csx,cake,vb,vbx}]
7777
# Default Severity for all .NET Code Style rules below
78-
dotnet_analyzer_diagnostic.category-style.severity = warning
78+
dotnet_analyzer_diagnostic.severity = warning
7979

8080
##########################################
8181
# Language Rules
@@ -122,20 +122,21 @@ dotnet_style_coalesce_expression = true:warning
122122
dotnet_style_null_propagation = true:warning
123123
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
124124
# File header preferences
125-
file_header_template = Copyright (c) Six Labors.\nLicensed under the Apache License, Version 2.0.
125+
file_header_template = Copyright (c) Six Labors.\nLicensed under the Six Labors Split License.
126126
# SA1636: File header copyright text should match
127127
# Justification: .editorconfig supports file headers. If this is changed to a value other than "none", a stylecop.json file will need to added to the project.
128128
# dotnet_diagnostic.SA1636.severity = none
129129

130130
# Undocumented
131-
dotnet_style_operator_placement_when_wrapping = end_of_line
131+
dotnet_style_operator_placement_when_wrapping = end_of_line:warning
132+
csharp_style_prefer_null_check_over_type_check = true:warning
132133

133134
# C# Style Rules
134135
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
135136
[*.{cs,csx,cake}]
136137
# 'var' preferences
137-
csharp_style_var_for_built_in_types = never
138-
csharp_style_var_when_type_is_apparent = true:warning
138+
csharp_style_var_for_built_in_types = false:warning
139+
csharp_style_var_when_type_is_apparent = false:warning
139140
csharp_style_var_elsewhere = false:warning
140141
# Expression-bodied members
141142
csharp_style_expression_bodied_methods = true:warning
@@ -200,12 +201,15 @@ dotnet_diagnostic.IDE0059.severity = suggestion
200201
# Organize using directives
201202
dotnet_sort_system_directives_first = true
202203
dotnet_separate_import_directive_groups = false
204+
# Dotnet namespace options
205+
dotnet_style_namespace_match_folder = true:suggestion
206+
dotnet_diagnostic.IDE0130.severity = suggestion
203207

204208
# C# formatting rules
205209
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules
206210
[*.{cs,csx,cake}]
207211
# Newline options
208-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#new-line-options
212+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options
209213
csharp_new_line_before_open_brace = all
210214
csharp_new_line_before_else = true
211215
csharp_new_line_before_catch = true
@@ -214,15 +218,15 @@ csharp_new_line_before_members_in_object_initializers = true
214218
csharp_new_line_before_members_in_anonymous_types = true
215219
csharp_new_line_between_query_expression_clauses = true
216220
# Indentation options
217-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#indentation-options
221+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#indentation-options
218222
csharp_indent_case_contents = true
219223
csharp_indent_switch_labels = true
220224
csharp_indent_labels = no_change
221225
csharp_indent_block_contents = true
222226
csharp_indent_braces = false
223227
csharp_indent_case_contents_when_block = false
224228
# Spacing options
225-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#spacing-options
229+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options
226230
csharp_space_after_cast = false
227231
csharp_space_after_keywords_in_control_flow_statements = true
228232
csharp_space_between_parentheses = false
@@ -246,9 +250,12 @@ csharp_space_before_open_square_brackets = false
246250
csharp_space_between_empty_square_brackets = false
247251
csharp_space_between_square_brackets = false
248252
# Wrap options
249-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
253+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options
250254
csharp_preserve_single_line_statements = false
251255
csharp_preserve_single_line_blocks = true
256+
# Namespace options
257+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options
258+
csharp_style_namespace_declarations = file_scoped:warning
252259

253260
##########################################
254261
# .NET Naming Rules

.gitattributes

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,19 @@
6464
# Set explicit file behavior to:
6565
# treat as text
6666
# normalize to Unix-style line endings and
67-
# use a union merge when resoling conflicts
67+
# use a union merge when resolving conflicts
6868
###############################################################################
6969
*.csproj text eol=lf merge=union
7070
*.dbproj text eol=lf merge=union
7171
*.fsproj text eol=lf merge=union
7272
*.ncrunchproject text eol=lf merge=union
7373
*.vbproj text eol=lf merge=union
74+
*.shproj text eol=lf merge=union
7475
###############################################################################
7576
# Set explicit file behavior to:
7677
# treat as text
7778
# normalize to Windows-style line endings and
78-
# use a union merge when resoling conflicts
79+
# use a union merge when resolving conflicts
7980
###############################################################################
8081
*.sln text eol=crlf merge=union
8182
###############################################################################
@@ -87,15 +88,13 @@
8788
*.eot binary
8889
*.exe binary
8990
*.otf binary
90-
*.pbm binary
9191
*.pdf binary
9292
*.ppt binary
9393
*.pptx binary
9494
*.pvr binary
9595
*.snk binary
9696
*.ttc binary
9797
*.ttf binary
98-
*.wbmp binary
9998
*.woff binary
10099
*.woff2 binary
101100
*.xls binary
@@ -119,10 +118,18 @@
119118
*.bmp filter=lfs diff=lfs merge=lfs -text
120119
*.gif filter=lfs diff=lfs merge=lfs -text
121120
*.png filter=lfs diff=lfs merge=lfs -text
121+
*.qoi filter=lfs diff=lfs merge=lfs -text
122122
*.tif filter=lfs diff=lfs merge=lfs -text
123123
*.tiff filter=lfs diff=lfs merge=lfs -text
124124
*.tga filter=lfs diff=lfs merge=lfs -text
125125
*.webp filter=lfs diff=lfs merge=lfs -text
126126
*.dds filter=lfs diff=lfs merge=lfs -text
127127
*.ktx filter=lfs diff=lfs merge=lfs -text
128128
*.ktx2 filter=lfs diff=lfs merge=lfs -text
129+
*.pam filter=lfs diff=lfs merge=lfs -text
130+
*.pbm filter=lfs diff=lfs merge=lfs -text
131+
*.pgm filter=lfs diff=lfs merge=lfs -text
132+
*.ppm filter=lfs diff=lfs merge=lfs -text
133+
*.pnm filter=lfs diff=lfs merge=lfs -text
134+
*.wbmp filter=lfs diff=lfs merge=lfs -text
135+
*.exr filter=lfs diff=lfs merge=lfs -text

samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
54
<DebugType>portable</DebugType>
65
<OutputType>Exe</OutputType>
76
</PropertyGroup>
87

8+
<Choose>
9+
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
10+
<PropertyGroup>
11+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
12+
</PropertyGroup>
13+
</When>
14+
<Otherwise>
15+
<PropertyGroup>
16+
<TargetFrameworks>net6.0</TargetFrameworks>
17+
</PropertyGroup>
18+
</Otherwise>
19+
</Choose>
20+
921
<ItemGroup>
1022
<ProjectReference Include="..\..\src\ImageSharp.Drawing\ImageSharp.Drawing.csproj" />
1123
</ItemGroup>
Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,72 @@
11
// Copyright (c) Six Labors.
2-
// Licensed under the Apache License, Version 2.0.
2+
// Licensed under the Six Labors Split License.
33

4-
using System;
5-
using System.Collections.Generic;
64
using System.Numerics;
75
using SixLabors.ImageSharp;
86
using SixLabors.ImageSharp.Drawing;
97
using SixLabors.ImageSharp.Drawing.Processing;
108
using SixLabors.ImageSharp.PixelFormats;
119
using SixLabors.ImageSharp.Processing;
1210

13-
namespace SixLabors.Shapes.DrawShapesWithImageSharp
11+
namespace SixLabors.Shapes.DrawShapesWithImageSharp;
12+
13+
public static class ImageSharpLogo
1414
{
15-
public static class ImageSharpLogo
15+
public static void SaveLogo(float size, string path)
1616
{
17-
public static void SaveLogo(float size, string path)
18-
{
19-
// the point are based on a 1206x1206 shape so size requires scaling from there
20-
float scalingFactor = size / 1206;
17+
// the point are based on a 1206x1206 shape so size requires scaling from there
18+
float scalingFactor = size / 1206;
2119

22-
var center = new Vector2(603);
20+
var center = new Vector2(603);
2321

24-
// segment whose center of rotation should be
25-
var segmentOffset = new Vector2(301.16968f, 301.16974f);
26-
IPath segment = new Polygon(
27-
new LinearLineSegment(new Vector2(230.54f, 361.0261f), new Vector2(5.8641942f, 361.46031f)),
28-
new CubicBezierLineSegment(
29-
new Vector2(5.8641942f, 361.46031f),
30-
new Vector2(-11.715693f, 259.54052f),
31-
new Vector2(24.441609f, 158.17478f),
32-
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset);
22+
// segment whose center of rotation should be
23+
var segmentOffset = new Vector2(301.16968f, 301.16974f);
24+
IPath segment = new Polygon(
25+
new LinearLineSegment(new Vector2(230.54f, 361.0261f), new Vector2(5.8641942f, 361.46031f)),
26+
new CubicBezierLineSegment(
27+
new Vector2(5.8641942f, 361.46031f),
28+
new Vector2(-11.715693f, 259.54052f),
29+
new Vector2(24.441609f, 158.17478f),
30+
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset);
3331

34-
// we need to create 6 of theses all rotated about the center point
35-
var segments = new List<IPath>();
36-
for (int i = 0; i < 6; i++)
37-
{
38-
float angle = i * ((float)Math.PI / 3);
39-
IPath s = segment.Transform(Matrix3x2.CreateRotation(angle, center));
40-
segments.Add(s);
41-
}
32+
// we need to create 6 of theses all rotated about the center point
33+
var segments = new List<IPath>();
34+
for (int i = 0; i < 6; i++)
35+
{
36+
float angle = i * ((float)Math.PI / 3);
37+
IPath s = segment.Transform(Matrix3x2.CreateRotation(angle, center));
38+
segments.Add(s);
39+
}
4240

43-
var colors = new List<Color>()
44-
{
45-
Color.ParseHex("35a849"),
46-
Color.ParseHex("fcee21"),
47-
Color.ParseHex("ed7124"),
48-
Color.ParseHex("cb202d"),
49-
Color.ParseHex("5f2c83"),
50-
Color.ParseHex("085ba7"),
51-
};
41+
var colors = new List<Color>()
42+
{
43+
Color.ParseHex("35a849"),
44+
Color.ParseHex("fcee21"),
45+
Color.ParseHex("ed7124"),
46+
Color.ParseHex("cb202d"),
47+
Color.ParseHex("5f2c83"),
48+
Color.ParseHex("085ba7"),
49+
};
5250

53-
var scaler = Matrix3x2.CreateScale(scalingFactor, Vector2.Zero);
51+
var scaler = Matrix3x2.CreateScale(scalingFactor, Vector2.Zero);
5452

55-
int dimensions = (int)Math.Ceiling(size);
56-
using (var img = new Image<Rgba32>(dimensions, dimensions))
57-
{
58-
img.Mutate(i => i.Fill(Color.Black));
59-
img.Mutate(i => i.Fill(Color.ParseHex("e1e1e1ff"), new EllipsePolygon(center, 600f).Transform(scaler)));
60-
img.Mutate(i => i.Fill(Color.White, new EllipsePolygon(center, 600f - 60).Transform(scaler)));
53+
int dimensions = (int)Math.Ceiling(size);
54+
using (var img = new Image<Rgba32>(dimensions, dimensions))
55+
{
56+
img.Mutate(i => i.Fill(Color.Black));
57+
img.Mutate(i => i.Fill(Color.ParseHex("e1e1e1ff"), new EllipsePolygon(center, 600f).Transform(scaler)));
58+
img.Mutate(i => i.Fill(Color.White, new EllipsePolygon(center, 600f - 60).Transform(scaler)));
6159

62-
for (int s = 0; s < 6; s++)
63-
{
64-
img.Mutate(i => i.Fill(colors[s], segments[s].Transform(scaler)));
65-
}
60+
for (int s = 0; s < 6; s++)
61+
{
62+
img.Mutate(i => i.Fill(colors[s], segments[s].Transform(scaler)));
63+
}
6664

67-
img.Mutate(i => i.Fill(new Rgba32(0, 0, 0, 170), new ComplexPolygon(new EllipsePolygon(center, 161f), new EllipsePolygon(center, 61f)).Transform(scaler)));
65+
img.Mutate(i => i.Fill(new Rgba32(0, 0, 0, 170), new ComplexPolygon(new EllipsePolygon(center, 161f), new EllipsePolygon(center, 61f)).Transform(scaler)));
6866

69-
string fullPath = System.IO.Path.GetFullPath(System.IO.Path.Combine("Output", path));
67+
string fullPath = System.IO.Path.GetFullPath(System.IO.Path.Combine("Output", path));
7068

71-
img.Save(fullPath);
72-
}
69+
img.Save(fullPath);
7370
}
7471
}
7572
}

0 commit comments

Comments
 (0)