Skip to content

Commit 70da339

Browse files
Merge branch 'main' into blaze
2 parents d819f81 + 5132451 commit 70da339

File tree

189 files changed

+1541
-1227
lines changed

Some content is hidden

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

189 files changed

+1541
-1227
lines changed

.editorconfig

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:war
104104
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
105105
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion
106106
# Expression-level preferences
107-
dotnet_style_object_initializer = true:warning
108-
dotnet_style_collection_initializer = true:warning
107+
dotnet_style_object_initializer = true:error
108+
dotnet_style_collection_initializer = true:error
109109
dotnet_style_explicit_tuple_names = true:warning
110110
dotnet_style_prefer_inferred_tuple_names = true:warning
111111
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
@@ -135,9 +135,9 @@ csharp_style_prefer_null_check_over_type_check = true:warning
135135
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
136136
[*.{cs,csx,cake}]
137137
# 'var' preferences
138-
csharp_style_var_for_built_in_types = false:warning
139-
csharp_style_var_when_type_is_apparent = false:warning
140-
csharp_style_var_elsewhere = false:warning
138+
csharp_style_var_for_built_in_types = false:error
139+
csharp_style_var_when_type_is_apparent = false:error
140+
csharp_style_var_elsewhere = false:error
141141
# Expression-bodied members
142142
csharp_style_expression_bodied_methods = true:warning
143143
csharp_style_expression_bodied_constructors = true:warning
@@ -160,7 +160,10 @@ csharp_style_pattern_local_over_anonymous_function = true:warning
160160
csharp_style_deconstructed_variable_declaration = true:warning
161161
csharp_style_prefer_index_operator = true:warning
162162
csharp_style_prefer_range_operator = true:warning
163-
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
163+
csharp_style_implicit_object_creation_when_type_is_apparent = true:error
164+
# ReSharper inspection severities
165+
resharper_arrange_object_creation_when_type_evident_highlighting = error
166+
resharper_arrange_object_creation_when_type_not_evident_highlighting = error
164167
# "Null" checking preferences
165168
csharp_style_throw_expression = true:warning
166169
csharp_style_conditional_delegate_call = true:warning
@@ -174,6 +177,9 @@ csharp_using_directive_placement = outside_namespace:warning
174177
csharp_prefer_static_local_function = true:warning
175178
# Primary constructor preferences
176179
csharp_style_prefer_primary_constructors = false:none
180+
# Collection preferences
181+
dotnet_style_prefer_collection_expression = true:error
182+
resharper_use_collection_expression_highlighting =true:error
177183

178184
##########################################
179185
# Unnecessary Code Rules

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,10 @@
136136
*.ico filter=lfs diff=lfs merge=lfs -text
137137
*.cur filter=lfs diff=lfs merge=lfs -text
138138
*.ani filter=lfs diff=lfs merge=lfs -text
139+
*.heic filter=lfs diff=lfs merge=lfs -text
140+
*.hif filter=lfs diff=lfs merge=lfs -text
141+
*.avif filter=lfs diff=lfs merge=lfs -text
142+
###############################################################################
143+
# Handle ICC files by git lfs
144+
###############################################################################
145+
*.icc filter=lfs diff=lfs merge=lfs -text

.github/ISSUE_TEMPLATE/commercial-bug-report.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/build-and-test.yml

Lines changed: 74 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,102 @@ on:
1111
- main
1212
types: [ labeled, opened, synchronize, reopened ]
1313
jobs:
14+
# Prime a single LFS cache and expose the exact key for the matrix
15+
WarmLFS:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
lfs_key: ${{ steps.expose-key.outputs.lfs_key }}
19+
steps:
20+
- name: Git Config
21+
shell: bash
22+
run: |
23+
git config --global core.autocrlf false
24+
git config --global core.longpaths true
25+
26+
- name: Git Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
submodules: recursive
31+
32+
# Deterministic list of LFS object IDs, then compute a portable key:
33+
# - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256
34+
# - `awk '{print $1}'` extracts just the SHA field
35+
# - `sort` sorts in byte order (hex hashes sort the same everywhere)
36+
# This ensures the file content is identical regardless of OS or locale
37+
- name: Git Create LFS id list
38+
shell: bash
39+
run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id
40+
41+
- name: Git Expose LFS cache key
42+
id: expose-key
43+
shell: bash
44+
env:
45+
LFS_KEY: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
46+
run: echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT"
47+
48+
- name: Git Setup LFS Cache
49+
uses: actions/cache@v4
50+
with:
51+
path: .git/lfs
52+
key: ${{ steps.expose-key.outputs.lfs_key }}
53+
54+
- name: Git Pull LFS
55+
shell: bash
56+
run: git lfs pull
57+
1458
Build:
59+
needs: WarmLFS
1560
strategy:
1661
matrix:
1762
isARM:
1863
- ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }}
1964
options:
2065
- os: ubuntu-latest
21-
framework: net7.0
22-
sdk: 7.0.x
66+
framework: net9.0
67+
sdk: 9.0.x
2368
sdk-preview: true
2469
runtime: -x64
2570
codecov: false
2671
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
27-
framework: net7.0
28-
sdk: 7.0.x
72+
framework: net9.0
73+
sdk: 9.0.x
2974
sdk-preview: true
3075
runtime: -x64
3176
codecov: false
3277
- os: windows-latest
33-
framework: net7.0
34-
sdk: 7.0.x
78+
framework: net9.0
79+
sdk: 9.0.x
3580
sdk-preview: true
3681
runtime: -x64
3782
codecov: false
3883
- os: buildjet-4vcpu-ubuntu-2204-arm
39-
framework: net7.0
40-
sdk: 7.0.x
84+
framework: net9.0
85+
sdk: 9.0.x
4186
sdk-preview: true
4287
runtime: -x64
4388
codecov: false
89+
4490
- os: ubuntu-latest
45-
framework: net6.0
46-
sdk: 6.0.x
91+
framework: net8.0
92+
sdk: 8.0.x
4793
runtime: -x64
4894
codecov: false
4995
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
50-
framework: net6.0
51-
sdk: 6.0.x
96+
framework: net8.0
97+
sdk: 8.0.x
5298
runtime: -x64
5399
codecov: false
54100
- os: windows-latest
55-
framework: net6.0
56-
sdk: 6.0.x
101+
framework: net8.0
102+
sdk: 8.0.x
103+
runtime: -x64
104+
codecov: false
105+
- os: buildjet-4vcpu-ubuntu-2204-arm
106+
framework: net8.0
107+
sdk: 8.0.x
57108
runtime: -x64
58-
codecov: true
109+
codecov: false
59110
exclude:
60111
- isARM: false
61112
options:
@@ -65,8 +116,10 @@ jobs:
65116

66117
steps:
67118
- name: Install libgdi+, which is required for tests running on ubuntu
68-
if: ${{ matrix.options.os == 'buildjet-4vcpu-ubuntu-2204-arm' }}
69-
run: sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
119+
if: ${{ contains(matrix.options.os, 'ubuntu') }}
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
70123
71124
- name: Git Config
72125
shell: bash
@@ -80,16 +133,12 @@ jobs:
80133
fetch-depth: 0
81134
submodules: recursive
82135

83-
# See https://github.com/actions/checkout/issues/165#issuecomment-657673315
84-
- name: Git Create LFS FileList
85-
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
86-
136+
# Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
87137
- name: Git Setup LFS Cache
88138
uses: actions/cache@v4
89-
id: lfs-cache
90139
with:
91140
path: .git/lfs
92-
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
141+
key: ${{ needs.WarmLFS.outputs.lfs_key }}
93142

94143
- name: Git Pull LFS
95144
run: git lfs pull
@@ -110,14 +159,14 @@ jobs:
110159
uses: actions/setup-dotnet@v4
111160
with:
112161
dotnet-version: |
113-
6.0.x
162+
8.0.x
114163
115164
- name: DotNet Setup Preview
116165
if: ${{ matrix.options.sdk-preview == true }}
117166
uses: actions/setup-dotnet@v4
118167
with:
119168
dotnet-version: |
120-
7.0.x
169+
9.0.x
121170
122171
- name: DotNet Build
123172
if: ${{ matrix.options.sdk-preview != true }}

ImageSharp.Drawing.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ EndProject
2828
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{FBE8C1AD-5AEC-4514-9B64-091D8E145865}"
2929
ProjectSection(SolutionItems) = preProject
3030
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
31-
.github\ISSUE_TEMPLATE\oss-bug-report.md = .github\ISSUE_TEMPLATE\oss-bug-report.md
31+
.github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
3232
EndProjectSection
3333
EndProject
3434
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815C0625-CD3D-440F-9F80-2D83856AB7AE}"

samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
1010
<PropertyGroup>
1111
<TargetFrameworks>net8.0</TargetFrameworks>
12+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
1213
</PropertyGroup>
1314
</When>
1415
<Otherwise>

samples/DrawShapesWithImageSharp/ImageSharpLogo.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public static void SaveLogo(float size, string path)
1717
// the point are based on a 1206x1206 shape so size requires scaling from there
1818
float scalingFactor = size / 1206;
1919

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

2222
// segment whose center of rotation should be
23-
var segmentOffset = new Vector2(301.16968f, 301.16974f);
23+
Vector2 segmentOffset = new(301.16968f, 301.16974f);
2424
IPath segment = new Polygon(
2525
new LinearLineSegment(new Vector2(230.54f, 361.0261f), new Vector2(5.8641942f, 361.46031f)),
2626
new CubicBezierLineSegment(
@@ -30,28 +30,28 @@ public static void SaveLogo(float size, string path)
3030
new Vector2(78.26f, 97.0461f))).Translate(center - segmentOffset);
3131

3232
// we need to create 6 of theses all rotated about the center point
33-
var segments = new List<IPath>();
33+
List<IPath> segments = [];
3434
for (int i = 0; i < 6; i++)
3535
{
3636
float angle = i * ((float)Math.PI / 3);
3737
IPath s = segment.Transform(Matrix3x2.CreateRotation(angle, center));
3838
segments.Add(s);
3939
}
4040

41-
var colors = new List<Color>()
42-
{
41+
List<Color> colors =
42+
[
4343
Color.ParseHex("35a849"),
4444
Color.ParseHex("fcee21"),
4545
Color.ParseHex("ed7124"),
4646
Color.ParseHex("cb202d"),
4747
Color.ParseHex("5f2c83"),
48-
Color.ParseHex("085ba7"),
49-
};
48+
Color.ParseHex("085ba7")
49+
];
5050

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

5353
int dimensions = (int)Math.Ceiling(size);
54-
using (var img = new Image<Rgba32>(dimensions, dimensions))
54+
using (Image<Rgba32> img = new(dimensions, dimensions))
5555
{
5656
img.Mutate(i => i.Fill(Color.Black));
5757
img.Mutate(i => i.Fill(Color.ParseHex("e1e1e1ff"), new EllipsePolygon(center, 600f).Transform(scaler)));

0 commit comments

Comments
 (0)