Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed May 7, 2017
2 parents 6c2320a + 33db3fa commit 3d52b59
Show file tree
Hide file tree
Showing 108 changed files with 3,907 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
213 changes: 213 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/

# Visual Studio 2015 cache/options directory
.vs/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml

*.publishproj

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
packages/
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016
Copyright (c) stakx 2016-2017

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# stakx.WIC

A COM interop library for .NET that makes Windows Imaging Component (WIC) available to managed code.

## What is the Windows Imaging Component (WIC)?

> _"The Windows Imaging Component (WIC) is a Component Object Model based imaging codec framework
> introduced in Windows Vista (…) for working with and processing digital images and image metadata."_
> — from the [Wikipedia article](wikipedia)
[wikipedia]: https://en.wikipedia.org/wiki/Windows_Imaging_Component

Windows Imaging Component allows you to accomplish tasks such as:

* decoding and encoding bitmap images or single bitmap image frames in various formats (GIF, ICO, JPEG, PNG, TIFF, and more)
* reading and writing image metadata
* converting bitmaps to different pixel formats (bit depth, channels)
* transforming bitmaps (clip, flip horizontally or vertically, rotate by 90° angles, scale)

## Why would you want to use stakx.WIC?

I originally started this project because I needed a library to do some fairly simple image processing…
inside an ASP.NET web application. And it is this last bit that introduces a few problems.
The .NET Framework does not come with any image processing functionality that is officially supported in server-side code:

1. There is the `System.Drawing` namespace.
The facilities in this namespace are based on the GDI+ API. It is officially unsupported in server-side code.
(Although it usually works just fine, if you know how to avoid memory leaks and work around performance issues;
regarding this topic, I'd recommend Nathanael Jones' article ["20 Image Resizing Pitfalls"][20-pitfalls].)

2. There is the `System.Windows.Media.Imaging` namespace.
This one belongs to the Windows Presentation Foundation (WPF) UI framework and contains thin wrappers around the WIC.
Being part of a UI framework, it is also not an ideal candidate for server-side scenarios.
(But like GDI+, it often works just fine.)

The nice thing about the WIC is that it is officially supported on Windows servers!
So if you can find a way to use it directly, then you're all good.
And this is exactly what this project offers: a set of type definitions so that you can use the WIC from .NET.

[20-pitfalls]: http://www.nathanaeljones.com/blog/2009/20-image-resizing-pitfalls

## How do you get started?

1. Familiarize yourself with the WIC, if you don't know it yet.
See e.g. the [Windows Imaging Component documentation on MSDN][msdn].

2. Add the [NuGet package `stakx.WIC`][nuget-package] to your project.
Alternatively, you can compile this project yourself (you will need Visual Studio 2017 for this), and then
add a reference to the built `stakx.WIC.dll` assembly to your project.

3. In your code, start by instantiating a `WICImagingFactory` object.
Most other WIC components can be created directly or indirectly through this factory object.

[msdn]: https://msdn.microsoft.com/en-us/library/windows/desktop/ee719902.aspx
[nuget-package]: https://www.nuget.org/packages/stakx.WIC/

## Is there any example code?

This project page does currently not provide any samples to show how exactly one would get stuff done using the WIC API.
Until I find the time to write some sample code in the future, please refer to the the WIC samples on [MSDN].
I have strived to keep the COM interop types in this project as close as possible to the original COM type definitions.
This should make it fairly easy for you to draw the connection between what you read on MSDN, and this .NET library.
17 changes: 17 additions & 0 deletions SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General information about all assemblies in this solution.
[assembly: AssemblyProduct("stakx.WIC")]
[assembly: AssemblyCopyright("© 2016 stakx")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]

// Types in all assemblies in this solution are not exposed to COM.
[assembly: ComVisible(false)]

// Version information for all assemblies in this solution.
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
4 changes: 4 additions & 0 deletions stakx.WIC.Interop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using System.Runtime.InteropServices;

// Make the COM type declarations embeddable:
[assembly: ImportedFromTypeLib(null)]
20 changes: 20 additions & 0 deletions stakx.WIC.Interop/stakx.WIC.Interop.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net40</TargetFrameworks>
<Authors>stakx</Authors>
<Company></Company>
<Copyright>Copyright © stakx 2016-2017</Copyright>
<PackageProjectUrl>https://github.com/stakx/stakx.WIC</PackageProjectUrl>
<RepositoryUrl>https://github.com/stakx/stakx.WIC.git</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageLicenseUrl>https://github.com/stakx/stakx.WIC/blob/develop/LICENSE</PackageLicenseUrl>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageTags>Windows, imaging, image processing, Windows Imaging Component, COM interop</PackageTags>
<Product>stakx.WIC</Product>
<Description>A COM interop library for .NET that makes Windows Imaging Component (WIC) available to managed code.</Description>
<Version>0.1.0</Version>
</PropertyGroup>

</Project>
Loading

0 comments on commit 3d52b59

Please sign in to comment.