Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ matrix:
- os: linux # Ubuntu 14.04
dist: trusty
sudo: required
dotnet: 2.1.401
dotnet: 2.1.602
mono: latest
# - os: osx # OSX 10.11
# osx_image: xcode7.3.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ For more examples check out:

If you prefer, you can compile ImageSharp yourself (please do and help!)

- Using [Visual Studio 2017](https://visualstudio.microsoft.com/vs/)
- Using [Visual Studio 2019](https://visualstudio.microsoft.com/vs/)
- Make sure you have the latest version installed
- Make sure you have [the .NET Core 2.1 SDK](https://www.microsoft.com/net/core#windows) installed

Expand Down
8 changes: 8 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ install:
}
}

$sdkUrl = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.2.105/dotnet-sdk-2.2.105-win-x64.zip"
Write-Host "Installing .NET Core"
$env:DOTNET_INSTALL_DIR = "$path/.dotnetsdk"
New-Item -Type Directory $env:DOTNET_INSTALL_DIR -Force | Out-Null
(New-Object System.Net.WebClient).DownloadFile($sdkUrl, "dotnet.zip")
Write-Host "Unzipping to $env:DOTNET_INSTALL_DIR"
Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory("dotnet.zip", $env:DOTNET_INSTALL_DIR)

before_build:
- git submodule -q update --init
- cmd: dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix>
<VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix>
<TargetFrameworks>netcoreapp2.1;netstandard1.3;netstandard2.0</TargetFrameworks>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>SixLabors.ImageSharp.Drawing</AssemblyName>
Expand Down
20 changes: 6 additions & 14 deletions src/ImageSharp/Formats/Bmp/BmpInfoHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,21 +372,13 @@ public static BmpInfoHeader ParseOs2Version2(ReadOnlySpan<byte> data)

// The compression value in OS/2 bitmap has a different meaning than in windows bitmaps.
// Map the OS/2 value to the windows values.
switch (compression)
infoHeader.Compression = compression switch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn that's nice!

{
case 0:
infoHeader.Compression = BmpCompression.RGB;
break;
case 1:
infoHeader.Compression = BmpCompression.RLE8;
break;
case 2:
infoHeader.Compression = BmpCompression.RLE4;
break;
default:
BmpThrowHelper.ThrowImageFormatException($"Compression type is not supported. ImageSharp only supports uncompressed, RLE4 and RLE8.");
break;
}
0 => BmpCompression.RGB,
1 => BmpCompression.RLE8,
2 => BmpCompression.RLE4,
_ => throw new ImageFormatException($"Compression type is not supported. ImageSharp only supports uncompressed, RLE4 and RLE8.")
};

infoHeader.ImageSize = BinaryPrimitives.ReadInt32LittleEndian(data.Slice(20, 4));
infoHeader.XPelsPerMeter = BinaryPrimitives.ReadInt32LittleEndian(data.Slice(24, 4));
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/ImageSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<DebugType Condition="$(codecov) == ''">portable</DebugType>
<DebugSymbols>True</DebugSymbols>
<Features>IOperation</Features>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' OR '$(TargetFramework)' == 'net472' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public IccOneDimensionalCurve ReadOneDimensionalCurve()
breakPoints[i] = this.ReadSingle();
}

IccCurveSegment[] segments = new IccCurveSegment[segmentCount];
var segments = new IccCurveSegment[segmentCount];
for (int i = 0; i < segmentCount; i++)
{
segments[i] = this.ReadCurveSegment();
Expand All @@ -47,7 +47,7 @@ public IccResponseCurve ReadResponseCurve(int channelCount)
measurement[i] = this.ReadUInt32();
}

Vector3[] xyzValues = new Vector3[channelCount];
var xyzValues = new Vector3[channelCount];
for (int i = 0; i < channelCount; i++)
{
xyzValues[i] = this.ReadXyzNumber();
Expand All @@ -67,9 +67,9 @@ public IccResponseCurve ReadResponseCurve(int channelCount)
}

/// <summary>
/// Reads a <see cref="IccParametricCurve"/>
/// Reads a <see cref="IccParametricCurve"/>/
/// </summary>
/// <returns>The read curve</returns>
/// <returns>The read curve.</returns>
public IccParametricCurve ReadParametricCurve()
{
ushort type = this.ReadUInt16();
Expand Down Expand Up @@ -104,15 +104,15 @@ public IccParametricCurve ReadParametricCurve()
f = this.ReadFix16();
}

switch (type)
return type switch
{
case 0: return new IccParametricCurve(gamma);
case 1: return new IccParametricCurve(gamma, a, b);
case 2: return new IccParametricCurve(gamma, a, b, c);
case 3: return new IccParametricCurve(gamma, a, b, c, d);
case 4: return new IccParametricCurve(gamma, a, b, c, d, e, f);
default: throw new InvalidIccProfileException($"Invalid parametric curve type of {type}");
}
0 => new IccParametricCurve(gamma),
1 => new IccParametricCurve(gamma, a, b),
2 => new IccParametricCurve(gamma, a, b, c),
3 => new IccParametricCurve(gamma, a, b, c, d),
4 => new IccParametricCurve(gamma, a, b, c, d, e, f),
_ => throw new InvalidIccProfileException($"Invalid parametric curve type of {type}")
};
}

/// <summary>
Expand Down