Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the repo to use Directory.Build.props/targets files #920

Merged
merged 6 commits into from Jun 1, 2019
Merged

Updating the repo to use Directory.Build.props/targets files #920

merged 6 commits into from Jun 1, 2019

Conversation

tannergooding
Copy link
Contributor

@tannergooding tannergooding commented May 28, 2019

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This completes the first half of #867 by moving ImageSharp to use centralized Directory.Build.props and Directory.Build.targets files for managing project and repo-wide configuration settings.

This also sets everything up to support strong-name signing, but is first dependent on SixLabors/SharedInfrastructure#1 being merged and then the various dependencies being updated to consume that strong name key.

After this is merged, work can begin on a follow up PR which updates the build scripts for the repository.

@@ -1,20 +1,371 @@
# top-most EditorConfig file
###############################################################################
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Configuration options from the previous are kept and the remaining defaults are explicitly listed. This ensures that any user-specific VS configuration doesn't take precedence instead.

Copy link
Member

Choose a reason for hiding this comment

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

I wasn't aware this was still in the repo. Ideally we would use the one from Standards

https://github.com/SixLabors/Standards/blob/8b085c0ec4fb64797b9965741f7138f8f66a6b44/.editorconfig

Copy link
Member

Choose a reason for hiding this comment

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

Super happy to update the Standards one with these defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to live in the appropriate repo root either way, as it is hierarchical in nature and wouldn't be impactful from the standards directory.

Copy link
Member

Choose a reason for hiding this comment

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

I think we can add it from anywhere as long as it's added to the solution and marked as root.

https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019#add-and-remove-editorconfig-files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

editorconfig isn't some standard that Microsoft/Visual Studio created, it is an external standard that we adopted because of its wide-spread use.

The way it is meant to be used (and the way it works) is described both here: https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019#file-hierarchy-and-precedence and at the source of truth here: https://editorconfig.org/#file-location.

Things won't function (in VS and in other editors) if it isn't located in the current directory or a parent of the current directory.

Copy link
Member

Choose a reason for hiding this comment

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

Man that's such an incredibly frustrating design. I'm going o have to rethink the entire way I enforce standards now. (╯°□°)╯︵ ┻━┻

###############################################################################
[*]
charset = utf-8
end_of_line = lf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The end_of_line default was changed to lf since that is what git will check it in as (all platforms/by default) and is what git will check it out as on Unix. It makes for better cross-platform consistency.

Copy link

@Paxxi Paxxi May 30, 2019

Choose a reason for hiding this comment

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

Won't this make a mess of files if a user has set autocrlf=true in their git global settings?
Might want to set eol in the gitattributes file to make sure they're checked out as lf https://www.git-scm.com/docs/gitattributes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I hadn't looked at the .gitattributes file as part of this PR, will update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.gitattributes file was updated to explicitly call out eol=lf as the default and to explicitly specify various attributes for existing file types to ensure that it is handled correctly.

Copy link

Choose a reason for hiding this comment

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

I think you need to set bat/cmd to always be crlf or they won't run. Not at computer so can't test it, going on memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bat/cmd definitely work with lf line endings. I have it configured that way in all of my projects and did just test locally (and I don't believe it is Windows 10 specific).

Copy link

Choose a reason for hiding this comment

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

Perfect 😀

csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only new option that differs from the VS default. The VS default is true for compatibility reasons. This option is used in combination with csharp_indent_case_contents and you have effectively the following combinations:

(VS Default) csharp_indent_case_contents=true, csharp_indent_case_contents_when_block=true:

switch (value)
{
    case 1:
        break;

    case 2:
        {
            break;
        }
}

csharp_indent_case_contents=false, csharp_indent_case_contents_when_block=true:

switch (value)
{
    case 1:
    break;

    case 2:
        {
            break;
        }
}

csharp_indent_case_contents=false, csharp_indent_case_contents_when_block=false:

switch (value)
{
    case 1:
    break;

    case 2:
    {
        break;
    }
}

(The one I chose) csharp_indent_case_contents=true, csharp_indent_case_contents_when_block=false:

switch (value)
{
    case 1:
        break;

    case 2:
    {
        break;
    }
}

Copy link
Member

Choose a reason for hiding this comment

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

You chose..... Wisely.

<DebugType Condition="'$(codecov)' != ''">full</DebugType>
<NullableContextOptions>disable</NullableContextOptions>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>false</SignAssembly>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once strong-name signing is enabled, it should just involve:

  • Updating the standards submodule
  • Updating the SixLabors dependencies to the strong-name signed versions
  • Flipping this to true
  • Adding the PublicKey metdata to the InternalsVisibleTo items

</PropertyGroup>

<!-- Package versions for package references across all projects -->
<PropertyGroup>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Package versions are all listed/managed here. VS won't update these currently (but likely will eventually).

This allows you to ensure that you can upgrade all projects at the same time, easily.

Copy link
Member

Choose a reason for hiding this comment

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

It's a damn shame the tooling is behind here. What happens when you update a package through the manager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will change the version in the project file directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use PackageReference Update="package-name" Version="" rather than the *PackageVersion properties, as suggested on the twitter thread.

It, unfortunately, doesn't work with the UX either (project file will still be directly changed), but it seems a lot "cleaner" way of doing this.


<!-- Package references which are consumed by all projects -->
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetPackageVersion)" IsImplicitlyDefined="true" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the Roslyn compiler toolset and ensures all machines build with the same compiler version, regardless of what is on the box.

IsImplicitlyDefined=true just means users can't remove this from the list of NuGet packages in the UX.

Copy link
Member

Choose a reason for hiding this comment

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

TIL

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these are managed via the RestoreSources property in the Directory.Build.props

<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\standards\stylecop.json" />
</ItemGroup>

<ItemGroup>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Directory.Build.targets allows you to manage InternalsVisibleTo via these item groups.


<ItemDefinitionGroup>
<InternalsVisibleTo>
<Visible>false</Visible>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just keeps the InternalsVisibleTo from showing up in the UX as "files". The ItemDefinitionGroup allows you to add this metadata to all InternalsVisibleTo items centrally.

</InternalsVisibleTo>
</ItemDefinitionGroup>

<Target Name="GenerateInternalsVisibleTo"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A simple target to dynamically create the InternalsVisibleTo file, similarly to how AssemblyInfo is generated in SDK style projects.

<AssemblyTitle>SixLabors.ImageSharp.Drawing</AssemblyTitle>
<Authors>SixLabors and contributors</Authors>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of this removed stuff is now centrally managed.

using System.Runtime.CompilerServices;

// Ensure the internals can be built and tested.
[assembly: InternalsVisibleTo("SixLabors.ImageSharp.Drawing")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are now project metadata in the form of InternalsVisibleTo items

<PackageReference Include="SixLabors.Shapes.Text" Version="1.0.0-beta0007" />
<PackageReference Include="System.Drawing.Common" Version="4.5.1" />

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This appeared to be the only think preventing TargetFrameworks from working correctly...

Copy link
Member

Choose a reason for hiding this comment

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

What's happening?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In master right now, this project is only targeting a single tfm with TargetFrameworks being commented out.

It looks like the double inclusion of an entry point was what was preventing the other tfms from working and that filtering out Program.cs for the relevant tfms allows everything to work.

I explicitly called it out in case there was some other reason this should stay targeting a single tfm.

@codecov
Copy link

codecov bot commented May 28, 2019

Codecov Report

Merging #920 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #920      +/-   ##
==========================================
- Coverage   89.26%   89.26%   -0.01%     
==========================================
  Files        1076     1076              
  Lines       47210    47209       -1     
  Branches     3295     3315      +20     
==========================================
- Hits        42141    42140       -1     
  Misses       4366     4366              
  Partials      703      703
Impacted Files Coverage Δ
...iles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07ec651...811efc4. Read the comment docs.

@codecov
Copy link

codecov bot commented May 28, 2019

Codecov Report

Merging #920 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #920      +/-   ##
==========================================
- Coverage   89.26%   89.26%   -0.01%     
==========================================
  Files        1076     1076              
  Lines       47210    47209       -1     
  Branches     3295     3315      +20     
==========================================
- Hits        42141    42140       -1     
  Misses       4366     4366              
  Partials      703      703
Impacted Files Coverage Δ
...iles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07ec651...81c9deb. Read the comment docs.

<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.9.0.1" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was bumped to 7.12.0 as part of centralizing the package versions.

@tannergooding
Copy link
Contributor Author

I think the codecov "regression" may be due to a dead-code optimization done by the compiler as the code is currently annotated and is indeed not used:

// TODO: This is not used?
byte mb = (byte)((minor << 4) | bugfix);

@tannergooding
Copy link
Contributor Author

I think this is all good now. CC. @JimBobSquarePants, @antonfirsov

@@ -1,20 +1,371 @@
# top-most EditorConfig file
###############################################################################
Copy link
Member

Choose a reason for hiding this comment

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

I wasn't aware this was still in the repo. Ideally we would use the one from Standards

https://github.com/SixLabors/Standards/blob/8b085c0ec4fb64797b9965741f7138f8f66a6b44/.editorconfig

csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
Copy link
Member

Choose a reason for hiding this comment

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

You chose..... Wisely.

@@ -1,20 +1,371 @@
# top-most EditorConfig file
###############################################################################
Copy link
Member

Choose a reason for hiding this comment

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

Super happy to update the Standards one with these defaults.

</PropertyGroup>

<!-- Package versions for package references across all projects -->
<PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

It's a damn shame the tooling is behind here. What happens when you update a package through the manager?


<!-- Package references which are consumed by all projects -->
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetPackageVersion)" IsImplicitlyDefined="true" />
Copy link
Member

Choose a reason for hiding this comment

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

TIL

ImageSharp.sln Outdated Show resolved Hide resolved
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "issues", "issues", "{BF8DFDC1-CEE5-4A37-B216-D3085360C776}"
ProjectSection(SolutionItems) = preProject
Copy link
Member

Choose a reason for hiding this comment

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

What's all this stuff? Feels like a relic from the past.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are all files that you currently have checked directly into the repository, namely under tests\Images.

Copy link
Member

Choose a reason for hiding this comment

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

Can we wildcard this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe solution files support that, and from a quick test locally it doesn't work.

I also don't feel particularly strongly about this being in here, I've just found that having all files accessible from the solution is convenient.

<PackageReference Include="SixLabors.Shapes.Text" Version="1.0.0-beta0007" />
<PackageReference Include="System.Drawing.Common" Version="4.5.1" />

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
Copy link
Member

Choose a reason for hiding this comment

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

What's happening?

Copy link
Member

@tocsoft tocsoft left a comment

Choose a reason for hiding this comment

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

this looks great, thanks a lot @tannergooding all the changes get a big thumbs up from me 👍

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

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

Let's flip this switch! Thanks @tannergooding for persevering and teaching me some new stuff!

@JimBobSquarePants JimBobSquarePants merged commit e2651e7 into SixLabors:master Jun 1, 2019
JimBobSquarePants pushed a commit that referenced this pull request Aug 25, 2019
* Nits - Benchmarks (#884)

* Update metadata names

* Use WithIterationCount

* Format Benchmark documents

* Update copyright assignment to Six Labors & Contributors

* Update deps

* React to Benchmark library update

* ResizeWindowOld

* ResizeWindow refactor 1

* ResizeWindow refactor 2

* ResizeWindow refactor 3

* ResizeWindow refactor 4

* basic sliding window implementation (semi-stable state)

* fix ResizeWithCropHeightMode

* reference output for Resize_BasicSmall

* minor optimization

* Handle incorrect colorspace metadata. Fix #882 (#885)

* refactor
- ResizeWindow -> ResizeWorker
- Most logic moved to ResizeWorker

* refactor stuff + implement CalculateResizeWorkerWindowCount()

* utilize CalculateResizeWorkerHeightInWindowBands()
which has been renamed from CalculateResizeWorkerWindowCount()

* improve benchmark: ArrayCopy -> CopyBuffers

* moar RowInterval stuff

* buffer.CopyColumns(...)

* simplify ResizeWorker logic

* WorkingBufferSizeHintInBytes_IsAppliedCorrectly

* more robust tests

* ResizeTests.LargeImage

* optimized sliding works!

* reapply unsafe optimizations

* moar unsafe optimization

* benchmark WorkingBufferSizeHint effects

* memory profiling with Sandbox46

* add ResizeWorker.pptx

* refine ResizeWorker.pptx

* xmldoc for ResizeWorker

* update ResizeWorker.pptx [skip CI]

* fix tests

* fix license text in CopyBuffers benchmark

* update travis.yml

* I'm terrible copy-paster

* extend the CopyBuffers benchmark

* use HashCode.Combine()

* Pass correct output size in ResizeMode.Min #892 (#893)

* Cleanup General Convolution (#887)

* Remove multiple premultiplication.

* Use in DenseMatrix everywhere.

* Make private

* Dont convert vector row on first pass

* Remove incorrectly assigned alpha.

* Remove boxing.

* Use correct min row.

* Reorder parameters

* Correctly handle alpha component.

* Update tests

* Use dedicated methods over branching.

* Faster Jpeg Huffman Decoding. (#894)

* Read from underlying stream less often

* Update benchmark dependencies

* Experimental mango port

Currently broken

* Populate table, 64byte buffer

Still broken.

* Baseline, non RST works

* 15/19 baseline tests pass now.

* Optimize position change.

* 18/19 pass

* 19/19 baseline decoded

* Can now decode all images.

* Now faster and much cleaner.

* Cleanup

* Fix reader, update benchmarks

* Update dependencies

* Remove unused method

* No need to clean initial buffer

* Remove bounds check on ReadByte()

* Refactor from feedback

* Feature: adaptive histogram equalization (#673)

* first version of sliding window adaptive histogram equalization

* going now from top to bottom of the image, added more comments

* using memory allocator to create the histogram and the cdf

* mirroring rows which exceeds the borders

* mirroring also left and right borders

* gridsize and cliplimit are now parameters of the constructor

* using Parallel.For

* only applying clipping once, effect applying it multiple times is neglectable

* added abstract base class for histogram equalization, added option to enable / disable clipping

* small improvements

* clipLimit now in percent of the total number of pixels in the grid

* optimization: only calculating the cdf until the maximum histogram index

* fix: using configuration from the parameter instead of the default

* removed unnecessary loops in CalculateCdf, fixed typo in method name AddPixelsToHistogram

* added different approach for ahe: image is split up in tiles, cdf is computed for each tile. Grey value will be determined by interpolating between 4 tiles

* simplified interpolation between the tiles

* number of tiles is now fixed and depended on the width and height of the image

* moved calculating LUT's into separate method

* number of tiles is now part of the options and will be used with the sliding window approach also, so both methods are comparable

* removed no longer valid xml comment

* attempt fixing the borders

* refactoring to improve readability

* linear interpolation in the border tiles

* refactored processing the borders into separate methods

* fixing corner tiles

* fixed build errors

* fixing mistake during merge from upstream: setting test images to "update Resize reference output because of improved ResizeKernelMap calculations"

* using Parallel.ForEach for all inner tile calculations

* using Parallel.ForEach to calculate the lookup tables

* re-using pre allocated pixel row in GetPixelRow

* fixed issue with the border tiles, when tile width != tile height

* changed default value for ClipHistogram to false again

* alpha channel from the original image is now preserved

* added unit tests for adaptive histogram equalization

* Update External

* 2x faster adaptive tiled processor

* Remove double indexing and bounds checks

* Begin optimizing the global histogram

* Parallelize GlobalHistogramEqualizationProcessor

* Moving sliding window from left to right instead of from top to bottom

* The tile width and height is again depended on the image width: image.Width / Tiles

* Removed keeping track of the maximum histogram position

* Updated reference image for sliding window AHE for moving the sliding window from left to right

* Removed unnecessary call to Span.Clear(), all values are overwritten anyway

* Revert "Moving sliding window from left to right instead of from top to bottom"

This reverts commit 8f19e5e.

# Conflicts:
#	src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationSWProcessor.cs

* Split GetPixelRow in two version: one which mirrors the edges (only needed in the borders of the images) and one which does not

* Refactoring and cleanup sliding window processor

* Added an upper limit of 100 tiles

* Performance tweaks

* Update External

* ImageBrush shouldn't Dispose of the image it is using. (#883)

Fixes #881

* Now throws a better excpetion DrawImage source does not overlap target (#877)

* No longer throws when DrawImage source does not overlap target

Previously, when DrawImage was used to overlay an image, in cases where the source image did not overlap the target image, a very confusing error was reported: "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: MaxDegreeOfParallelism"

Now, when this case happens, the DrawImage method will simply not affect the target image, which is the same way FillRegionProcessor handles such cases.

ParallelHelper.IterRows also now does more validation of the input rectangle so that any further cases of this kind of problem throw a more relvant exception. Note I switched from DebugGuard to Guard because IterRows is a public API and thus should always validate its inputs.

Fixes #875

* Refines DrawImage non-overlap error logic

Adresses PR feedback in #877.

Changes DrawImage shortcut to be less than or equal to. Also changes maxX calculation to use `Right` over `Width`. This is a semantic change that reflects intention better. No actual change because Top,Left for that rectanngle should always be 0,0.

And adds more informative argument names to ParallelHelper.IterRows error message.

* Non-overlapping DrawImage now throws

Adressing PR feedback from #877

DrawImage now throws when the source image does not overlap, with a useful error message.

Also improved the error messages for IterRows (and added validation to the other IterRows method)

* DrawImage overlap test changed to support RELEASE

The tests on the CI server are run in RELEASE which wrap the expected exception with an ImageProcessingException.

* Adress feedback for DrawImage exception

DrawImage throws an ImageProcessor exception which makes it easier to catch.

And reverted IterRows to use Guard helpers

* Bitmap encoder writes V3 header as default (#889)

* Bitmap encoder will now write a V3 header as default.

Introduces a new encoder option `SupportTransparency`: With this option a V4 header will be written with BITFIELDS compression.

* Add 4 and 16 bit images to the Identify test

* Add some useful links for bitmap documentation

* Add 32 bpp images to the Identify test

* Added further information on what will change for the encoder, if SupportTransparency is used.

* Add support for encoding 16 bit per pixel bitmaps (#899)

* Implemented encoding of 16 bits per pixel bitmaps

* Add unit tests for 16 bit encoding and Bgra5551 conversion

* Add additional Bgra5551 pixel conversion tests

* Add Bgra5551 tests for Short2/4 and HalfVector2/4

* Use scaled vector conversion

* define IImageVisitor

* pixel agnostic Mutate/Clone defined

* pixel-agnostic ResizeProcessor

* pixel-agnostic decoder API

* refactor FilterProcessor stuff

* basic fixes after rebase + temporarily comment out target frameworks

* refactor the rest of the FilterProcessor code

* reached a fully compiling state

* fix processor invocation tests

* re-add and fix filter invocation tests

* fix warnings and improve xmldocs

* *ProcessorImplementation<T> ===> *Processor<T>,

add suppression of SA1413 to AssemblyInfo.cs

* validating tests for Convolution processors

* validating tests for Convolution processors

* mark FileTestBase obsolete

* improve DitherTests CQ

* extended diffusion + dither tests

* Add additional pixel conversion tests

* validating tests for Effects

* validating tests for AutoOrient

* validating tests for Skew and Entropy crop

* validating tests for Overlay processors

* Add more pixel conversion tests

* skip DitherTests on old 32 bit runtimes

* refactor BoxBlur and GaussianBlur

* making filters public

* Further refactor on Gaussian stuff

* drop IEdgeDetectorProcessor

* Refactor edge detection

* refactor Effects processors

* Finished refactoring transforms

* sealed everything

* refactor HistogramEqualization

* cache Image dimensions into a field + re-enable all target frameworks

* fix Image.FromStream() + add tests

* full coverage for Image.Load (I hope)

* fix changes applied by mistake

* Fix docs for processing extensions

* publish non-generic QuantizeProcessor

* temporarily disable multitargeting

* add skeleton for Color type

* add more Rgba64 constructor overloads

* basic Color methods

* Pixel-agnostic Binarization processors

* Implement WernerPalette and WebSafePalette for Color

* refactor dithering and error diffusion to use Color

* Add support for encoding 8-bit bitmaps

* Changed WuQuantizer to OctreeQuantizer

* Update Readme (#905)

A few minor grammatical corrections.

* Trying MagickReferenceDecoder for the 8bit greyscale image encoder tests

* Setting dither to false in the OctreeQuantizer

* verbose naming for Histogram Equalization stuff + make it public

* formatting

* refactor of Overlays

* made AutoOrientExtensions non-generic

* cleanup and document Color

* cleanup

* Switched back to the default reference decoder

* Made PaletteQuantizer non-generic all the way

* QuantizedFrame<T> using ReadOnlyMemory<T>

* Correct readonly-semantics for QuantizedFrame

* introduce IQuantizedFrame<T>

* move all extension methods under a subfolder

(non-namespace providing)

* re-enable all target frameworks

* Using tolerant comparer for the Bit8Gs image

* More docs for Color, correct naming in ColorBuilder<TPixel>

* temporarily disable target frameworks

* Enabled dither again

* validating tests for: DrawPath, FillComplexPolygon

* validation in DrawImageTest

* RecolorImageTests

* FillPolygonTests

* DrawPolygonTests, DrawLinesTests

* DrawBeziersTests, DrawComplexPolygonTests

* move implicit Color conversion to pixel types,

add micro-optimizations

* fix merge issues

* DrawImageTests: add tolerance to make all test configurations happy

* Review changes

* started the refactor

* Pen, Brush & Processors refactored

* ImageSharp.Drawing compiles

* everything builds

* tests are passing

* fix new 8bit bmp code

* move drawing extensions to a (non-namespace-provider) subfolder

* rename files

* ImageBrush can apply a source image of a different pixel type than the target

* non-generic DrawImageProcessor

* DrawImageOfDifferentPixelType test cases

* clean-up drawing processors

* fix remaining stylecop issues

* Rgba32.Definitions: use Color instead of NamedColors<T>

* Remove NamedColors<T> usages

* Not using quantization for Grey8 images when encoding 8Bit Bitmaps

* Refactor Write8Bit into two methods: one for gray and one for color

* drop unnecessary generic IImageProcessorContext<TPixel> usages

* drop almost all usages of FileTestBase

* fix tests

* re-enable target frameworks

* Add tests for quantization of 32 bit bitmap to 8 bit color image

* Renamed DrawImageTest to DrawImageTests, fixed namespace

* Using tolerant comparer for the Encode_8BitColor tests

* Removed the Encode_8BitColor, because of the quantization differences with net472 and netcore

* Re-enabled Encode_8BitColor tests, if its 64 bit process

* Using MemoryMarshal.AsBytes in Write8BitGray to get the bytes of a row

* Fix merge mistake: Using DrawImageTests from current master branch

* API cleanup (related to #907) (#911)

* temporarily disable target frameworks

* drop DelegateProcessor

* drop IImageProcessingContext<TPixel>

* drop NamedColors<T>

* drop ColorBuilder<T>

* drop the *Base postfix for clean class hierarchies

* re-enable target frameworks

* use MathF in gradient brushes

* Move PngFilterMethod to the correct namespace.

* Fix for Issue #871 and #914 (#915)

* Fix #466 (#916)

* Added funding file with a link to open collective.

* Removes usage of linq in several critical paths (#918)

* Remove linq usage from jpeg + formatting

* png

* ICC + formattiing

* Resize

* Fix base class comparison.

* Updating the repo to use Directory.Build.props/targets files (#920)

* Updating the repo to use Directory.Build.props/targets files

* Adding an InternalsVisibleTo for DynamicProxyGenAssembly2, PublicKeyToken=null

* Removing duplicate includes from the ImageSharp.csproj

* Updating the .gitattributes file to explicitly list the line endings

* Removing the ImageSharp.ruleset file, as the one from standards should be used instead

* Updating the package version management to use `PackageReference Update`

* Fix build/test (#923)

* Prevent zigzag overflow. Fix #922

* Add test image and use constants

* Improve robustness of huffman decoder.

* Fix missing "using PixelFormats" line in Readme example (#921)

* Fix missing PixelFormats line in first API example

"<Rgba32>" does not appear to be defined without the "using SixLabors.ImageSharp.PixelFormats;" line and causes a "The type or namespace name 'Rgba32' could not be found (are you missing a using directive or an assembly reference?) (CS0246)" error to occur.

* Remove stray newline

* Feature: Bitmap RLE undefined pixel handling (#927)

* Add bitmap decoder option, how to treat skipped pixels for RLE

* Refactored bitmap tests into smaller tests, instead of just one test which goes through all bitmap files

* Add another adobe v3 header bitmap testcase

* Using the constant from BmpConstants to Identify bitmaps

* Bitmap decoder now can handle oversized palette's

* Add test for invalid palette size

* Renamed RleUndefinedPixelHandling to RleSkippedPixelHandling

* Explicitly using SystemDrawingReferenceDecoder in some BitmapDecoder tests

* Add test cases for unsupported bitmaps

* Comparing RLE test images to reference decoder only on windows

* Add test case for decoding winv4 fast path

* Add another 8 Bit RLE test with magick reference decoder

* Optimize RLE skipped pixel handling

* Refactor RLE decoding to eliminate code duplication

* Using MagickReferenceDecoder for the 8-Bit RLE test

* Fix 925 (#929)

* Prevent overflow

* Cleanup huffman table

* Search for RST markers.

* Fix Benchmarks project

* Bitmap decoder now can decode bitmap arrays (#930)

* Bitmap Decoder can now decode BitmapArray

* Add tests for bitmap metadata decoing. Fix an issue that a bitmap with a v5 header would be set in the metadata as an v4 header.

* Fixed issue with decoding bitmap arrays: color map size was not determined correctly. Added more test images.

* Refactor colormap size duplicate declaration.

* Fixed an issue, that when an unsupported bitmap is loaded the typ marker was not correctly shown in the error message

* Throw UnkownFormatException on Image.Load  (#932)

* Throw ImageFormatException on load

* Unseal class and make constructor internal
- This is so that no one can new it up / inherit it outside of the assembly

* Add new exception for distinguish between different exception
- This will be used on image.load operations with invalid image streams

* ImageFormatException -> UnkownImageFormatException

* Add Image.Load throws exception tests

* Fix #937 (#938)

* Add support for decoding RLE24 Bitmaps (#939)

* Add support for decoding RLE24

* Simplified determining colorMapSize, OS/2 always has 3 bytes for each palette entry

* Enum value for RLE24 is remapped to a different value, to be clearly separate from valid windows values.

* Introduce non-generic ImageFrameCollection (#941)

* temporarily disable target frameworks

* drop DelegateProcessor

* drop IImageProcessingContext<TPixel>

* drop NamedColors<T>

* drop ColorBuilder<T>

* drop the *Base postfix for clean class hierarchies

* adding basic skeletons

* non-generic ImageFrameCollection API definition

* non-generic ImageFrameCollection tests

* cleanup + docs + more tests

* implement ImageFrameCollection methods

* tests for generic PixelOperations.To<TDest>()

* experimental implementation

* fix .ttinclude

* generate generic From<TSourcePixel>(...)

* fix RgbaVector <--> BT709 Gray pixel conversion

* Gray8 and Gray16 using ConvertFromRgbaScaledVector4() by default

* fixed all conversion tests

* ConstructGif_FromDifferentPixelTypes

* fix xmldoc and other StyelCop findings

* re-enable all target frameworks

* fix NonGenericAddFrame() and NonGenericInsertFrame()

* fix remaining bugs

* #946: AoT compiler fixes and hid Seed methods

* #946: fixed StyleCop errors

* Master cleanup (#952)

* Fix gitignore and line endings

* Update README.md

* Bokeh blur implementation (#842)

* Added base BokehBlurProcessor class, and kernel parameters

* Added method to calculate the kernel parameters

* Switched to float, added method to create the 1D kernels

* Added complex kernels normalization

* Added BokehBlurExtensions class

* Added the Complex64 struct type

* Switched to Complex64 in the BokehBlurProcessor

* Added caching system for the bokeh processor parameters

* Added WeightedSum method to the Complex64 type

* Added IEquatable<T> interface to the Complex64 type

* New complex types added

* Added method to reshape a DenseMatrix<T> with no copies

* Added bokeh convolution first pass (WIP)

* Added second bokeh convolution pass (WIP)

* Added image sum pass to the bokeh processor (WIP)

* Minor bug fixes (WIP)

* Switched to Vector4 processing in the bokeh computation

* Minor tweaks

* Added Unit test for the bokeh kernel components

* Minor performance improvements

* Minor code refactoring, added gamma parameter (WIP)

* Removed unused temp buffers in the bokeh processing

* Gamma highlight processing implemented

* Speed optimizations, fixed partials computations in target rectangle

* Increased epsilon value in the unit tests

* Fixed for alpha transparency blur

* Fixed a bug when only blurring a target rectangle

* Added bokeh blur image tests (WIP)

* Added IXunitSerializable interface to the test info class

* culture independent parsing in BokehBlurTest.cs

* Performance optimizations in the bokeh processor

* Reduced number of memory allocations, fixed bug with multiple components

* Initialization and other speed improvements

* More initialization speed improvements

* Replaced LINQ with manual loop

* Added BokehBlur overload to just specify the target bounds

* Speed optimizations to the bokeh 1D convolutions

* More speed optimizations to the bokeh processor

* Fixed code style and Complex64.ToString method

* Fixed processing buffer initialization

* Minor performance improvements

* FIxed issue when applying bokeh blur to specific bounds

* Minor speed optimizaations

* Minor code refactoring

* Fixed convolution upper bound in second 1D pass

* improve BokehBlurTest coverage

* use Gray8 instead of Alpha8

* Adjusted guard position in bokeh processor constructor

* Added BokehBlurParameters struct

* Added BokehBlurKernelData struct

* Minor code refactoring

* Fixed API change build errors

* Bug fixes with the pixel premultiplication steps

* Removed unwanted unpremultiplication pass

* Removed unused using directives

* Fixed missing using directives in conditional branches

* Update from latest upstream master

* Update Block8x8F.Generated.cs

* Update GenericBlock8x8.Generated.cs

* Manual checking for files with LF (see gitter)

* Removed unused using directive

* Added IEquatable<ComplexVector4> interface

* Added IEquatable<BokehBlurParameters> interface

* Moved bokeh blur parameters types

* Added reference to original source code

* Complex convolution methods moved to another class

* Switched to MathF in the bokeh blur processor

* Switched to Vector4.Clamp

* Added Buffer2D<T>.Slice API

* Added BokehBlurExecutionMode enum

* Added new bokeh blur processor constructors

* Added new bokeh blur extension overloads with execution mode

* Code refactoring in preparation for the execution mode switch

* Implemented execution mode switch in the bokeh processor

* Moved BokehBlurExecutionMode struct

* Removed unused using directives

* Minor code refactoring

* More minor code refactoring

* Update External

* Fix undisposed buffers

* Bokeh blur processor cache switched to concurrent dictionary

* Minor code refactoring

* remove duplicate props from csproj

* Add support for read and write tEXt, iTXt and zTXt chunks (#951)

* Add support for writing tEXt chunks

* Add support for reading zTXt chunks

* Add check, if keyword is valid

* Add support for reading iTXt chunks

* Add support for writing iTXt chunks

* Remove Test Decode_TextEncodingSetToUnicode_TextIsReadWithCorrectEncoding: Assertion is wrong, the correct keyword name is "Software"

* Add support for writing zTXt chunk

* Add an encoder Option to enable compression when the string is larger than a given threshold

* Moved uncompressing text into separate method

* Remove textEncoding option from png decoder options: the encoding is determined by the specification: https://www.w3.org/TR/PNG/#11zTXt

* Removed invalid compressed zTXt chunk from test image

* Revert accidentally committed changes to Sandbox Program.cs

* Review adjustments

* Using 1024 bytes as a limit when to compress text as recommended by the spec

* Fix inconsistent line endings

* Trim leading and trailing whitespace on png keywords

* Move some metadata related tests into GifMetaDataTests.cs

* Add test case for gif with large text

* Gif text metadata is now a list of strings

* Encoder writes each comment as a separate block

* Adjustment of the Tests to the recent changes

* Move comments to GifMetadata

* Move Png TextData to format PngMetaData

* #244 Add support for interlaced PNG encoding (#955)

* #244 Implement interlaced PNG encoding

* #244 Update documentations

* #244 Remove comment

* Cleanup

* Update PngEncoderCore.cs

* fix some spelling (#957)

* fix some spelling

* more typos

* more typos

* more typos

* more typos

* more typos

* linearSegment

* fix "as" usage (#959)

* redundant usings (#960)

* use params where possible (#961)

* use params where possible

* use params

* fix some spelling (#962)

*  Add test illustrating issue

* Add test from issue #928

* Add possible fix

* remove unused variables and methods (#963)

* remove unused variables and methods

* remove some redundant variables

* remove some redundant variables

* redundant variables

* Update DrawTextOnImageTests.cs

* Minor optimizations

* cleanup

* Cleanup (#965)

* redundant ()

* redundant stirng interpolation

* use method groups

* redundant unsafe

* redundant qualifiers

* redundant ()

* redundant init

* redundant init

* redundant casts

* redundant casts

* Throw ObjectDisposedException when trying to operate on a disposed image (#968)

* disable multitargeting + TreatWarningsAsErrors to for fast development

* Check if image is disposed

in significant Image and Image<T> methods

* Mutate / Clone: ensure image is not disposed

* Revert "disable multitargeting + TreatWarningsAsErrors to for fast development"

This reverts commit 9ad74f7.

* remove some redundant variables and type params (#971)

* remove redundant variable init

* redundant variables

* remove redundant tileY variable

* remove redundant sum variable

* redundant mcu variable

* redundant type params

* Revert "remove redundant sum variable"

This reverts commit 21de86c.

* redundant comment

* remove redundant ParallelOptions

* aviod multiple array lookup

*  use var where apparent  (#972)

* use var where apparent

* use var where apparent

* should use Rgb24

* cache max in ConvertToRgba

* cache max value

* remove some redundant usings (#976)

* remove SteppedRange (#980)

* Implement decoder tests for debugging tests and add deflate bug output file

* Add TiffConfigurationModule to core Configuration. Implement simple unit-tests for Tiff decoder.

* Add benchmarks for big and medium tiff files

* Move Tiff classes to Formats.Tiff namespace

* Mark Tiff format tests with "Tiff" category, cleanup test classes

* Improve performance of Tiff decoders

* remove some redundant constructor overloads from exceptions (#979)

* remove some redundant constructor overloads from exceptions

* re add ImageProcessingException ctor

only used in release

* Fix of build error, cleanup.
Correct Metadata updated name (for Resolution properties), temporary disable tiff native metadata properties.

* Implement temporary tiff native metadata structures

* Mark missed tiff tests, exclude DecodeManual test

* Update test images submodule

* Explanations
antonfirsov pushed a commit to antonfirsov/ImageSharp that referenced this pull request Nov 11, 2019
…rs#920)

* Updating the repo to use Directory.Build.props/targets files

* Adding an InternalsVisibleTo for DynamicProxyGenAssembly2, PublicKeyToken=null

* Removing duplicate includes from the ImageSharp.csproj

* Updating the .gitattributes file to explicitly list the line endings

* Removing the ImageSharp.ruleset file, as the one from standards should be used instead

* Updating the package version management to use `PackageReference Update`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants