Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 55 additions & 0 deletions ImageLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,61 @@
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>bin\Release\Kaliko.ImageLibrary.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 2.0|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>..\.build\net20\Kaliko.ImageLibrary.XML</DocumentationFile>
<OutputPath>..\.build\net20\</OutputPath>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 3.0|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>..\.build\net30\Kaliko.ImageLibrary.XML</DocumentationFile>
<OutputPath>..\.build\net30\</OutputPath>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 3.5|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>..\.build\net35\Kaliko.ImageLibrary.XML</DocumentationFile>
<OutputPath>..\.build\net35\</OutputPath>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.0|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>..\.build\net40\Kaliko.ImageLibrary.XML</DocumentationFile>
<OutputPath>..\.build\net40\</OutputPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>..\.build\net45\Kaliko.ImageLibrary.XML</DocumentationFile>
<OutputPath>..\.build\net45\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
Expand Down
6 changes: 4 additions & 2 deletions ImageLibrary.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageLibrary", "ImageLibrary.csproj", "{073C7180-35E8-442A-9334-AA3F529C0985}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{4381B75F-8E8B-4F82-AABC-A16AD72D201A}"
Expand Down
14 changes: 10 additions & 4 deletions KalikoImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class KalikoImage : IDisposable {
public KalikoImage(Image image) {
TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
Image = image;

MakeImageNonIndexed();

_g = Graphics.FromImage(Image);
}

Expand Down Expand Up @@ -334,7 +337,9 @@ public void DrawText(TextField textField) {
/// </summary>
/// <param name="fileName">File path</param>
public void LoadImage(string fileName) {
Image = Image.FromFile(fileName);
using (var bitmap = new Bitmap(fileName)) {
Image = new Bitmap(bitmap);
}

MakeImageNonIndexed();

Expand All @@ -346,7 +351,9 @@ public void LoadImage(string fileName) {
/// </summary>
/// <param name="stream">Pointer to stream</param>
public void LoadImage(Stream stream) {
Image = Image.FromStream(stream);
using (var bitmap = new Bitmap(stream)) {
Image = new Bitmap(bitmap);
}

MakeImageNonIndexed();

Expand Down Expand Up @@ -439,8 +446,7 @@ public KalikoImage Scale(ScalingBase scaleEngine) {



internal static void DrawScaledImage(
KalikoImage destinationImage, KalikoImage sourceImage, int x, int y, int width, int height) {
internal static void DrawScaledImage(KalikoImage destinationImage, KalikoImage sourceImage, int x, int y, int width, int height) {
DrawScaledImage(destinationImage.Image, sourceImage.Image, x, y, width, height);
}

Expand Down