This commit is contained in:
2012-09-02 15:24:38 +02:00
commit 5b667b5781
250 changed files with 70477 additions and 0 deletions

View File

@@ -0,0 +1,120 @@
namespace Sample06
{
partial class MainForm
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.picBox = new System.Windows.Forms.PictureBox();
this.bExample01 = new System.Windows.Forms.Button();
this.bOriginal = new System.Windows.Forms.Button();
this.bExample02 = new System.Windows.Forms.Button();
this.bExample03 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit();
this.SuspendLayout();
//
// picBox
//
this.picBox.BackColor = System.Drawing.Color.White;
this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picBox.Location = new System.Drawing.Point(12, 12);
this.picBox.Name = "picBox";
this.picBox.Size = new System.Drawing.Size(747, 465);
this.picBox.TabIndex = 0;
this.picBox.TabStop = false;
//
// bExample01
//
this.bExample01.Location = new System.Drawing.Point(93, 483);
this.bExample01.Name = "bExample01";
this.bExample01.Size = new System.Drawing.Size(88, 23);
this.bExample01.TabIndex = 1;
this.bExample01.Text = "Example 01";
this.bExample01.UseVisualStyleBackColor = true;
this.bExample01.Click += new System.EventHandler(this.bExample01_Click);
//
// bOriginal
//
this.bOriginal.Location = new System.Drawing.Point(12, 483);
this.bOriginal.Name = "bOriginal";
this.bOriginal.Size = new System.Drawing.Size(75, 23);
this.bOriginal.TabIndex = 2;
this.bOriginal.Text = "Original";
this.bOriginal.UseVisualStyleBackColor = true;
this.bOriginal.Click += new System.EventHandler(this.bOriginal_Click);
//
// bExample02
//
this.bExample02.Location = new System.Drawing.Point(187, 483);
this.bExample02.Name = "bExample02";
this.bExample02.Size = new System.Drawing.Size(88, 23);
this.bExample02.TabIndex = 3;
this.bExample02.Text = "Example 02";
this.bExample02.UseVisualStyleBackColor = true;
this.bExample02.Click += new System.EventHandler(this.bExample02_Click);
//
// bExample03
//
this.bExample03.Location = new System.Drawing.Point(281, 483);
this.bExample03.Name = "bExample03";
this.bExample03.Size = new System.Drawing.Size(88, 23);
this.bExample03.TabIndex = 4;
this.bExample03.Text = "Example 03";
this.bExample03.UseVisualStyleBackColor = true;
this.bExample03.Click += new System.EventHandler(this.bExample03_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(771, 518);
this.Controls.Add(this.bExample03);
this.Controls.Add(this.bExample02);
this.Controls.Add(this.bOriginal);
this.Controls.Add(this.bExample01);
this.Controls.Add(this.picBox);
this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sample06";
((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox picBox;
private System.Windows.Forms.Button bExample01;
private System.Windows.Forms.Button bOriginal;
private System.Windows.Forms.Button bExample02;
private System.Windows.Forms.Button bExample03;
}
}

View File

@@ -0,0 +1,177 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using FreeImageAPI;
using System.Drawing.Imaging;
namespace Sample06
{
public partial class MainForm : Form
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public MainForm()
{
InitializeComponent();
}
private void bExample01_Click(object sender, EventArgs e)
{
// Load bitmap
FIBITMAP dib = FreeImage.LoadEx("Sample.jpg");
// Check success
if (dib.IsNull)
{
MessageBox.Show("Could not load Sample.jpg", "Error");
return;
}
// Check whether bitmap is 24-bit
if (FreeImage.GetBPP(dib) != 24)
{
MessageBox.Show("Sample.jpg is not 24-bit.", "Error");
FreeImage.UnloadEx(ref dib);
return;
}
// Convert the 24-bit bitmap to 8-bit and forcing the result will be greyscale
dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE, true);
if (FreeImage.GetBPP(dib) == 8)
{
// Convert the FreeImage-Bitmap into a .NET bitmap
Bitmap bitmap = FreeImage.GetBitmap(dib);
// Dispose the bitmap of the pictureBox
if (picBox.Image != null)
{
picBox.Image.Dispose();
}
// Assign the bitmap to the picturebox
picBox.Image = bitmap;
}
// Unload source bitmap
FreeImage.UnloadEx(ref dib);
}
private void bOriginal_Click(object sender, EventArgs e)
{
// Load bitmap
FIBITMAP dib = FreeImage.LoadEx("Sample.jpg");
// Check success
if (dib.IsNull)
{
MessageBox.Show("Could not load Sample.jpg", "Error");
return;
}
// Convert the FreeImage-Bitmap into a .NET bitmap
Bitmap bitmap = FreeImage.GetBitmap(dib);
// Check success
if (bitmap != null)
{
// Dispose old bitmap
if (picBox.Image != null)
{
picBox.Image.Dispose();
}
// Assign new bitmap
picBox.Image = bitmap;
}
// Unload bitmap
FreeImage.UnloadEx(ref dib);
}
private void bExample02_Click(object sender, EventArgs e)
{
FIBITMAP dib = FreeImage.LoadEx("Sample.jpg");
// Check success
if (dib.IsNull)
{
MessageBox.Show("Could not load Sample.jpg", "Error");
return;
}
// Convert bitmap to 8 bit
dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP, true);
// Check whether conversion succeeded
if (FreeImage.GetBPP(dib) != 8)
{
MessageBox.Show("Converting Sample.jpg to 8-bit failed.", "Error");
FreeImage.UnloadEx(ref dib);
return;
}
// Convert the FreeImage-Bitmap into a .NET bitmap
Bitmap bitmap = FreeImage.GetBitmap(dib);
// Dispose old bitmap
if (picBox.Image != null)
{
picBox.Image.Dispose();
}
// Assign new bitmap
picBox.Image = bitmap;
// Unload bitmap
FreeImage.UnloadEx(ref dib);
}
private void bExample03_Click(object sender, EventArgs e)
{
// Load bitmap
Bitmap bitmap = (Bitmap)Bitmap.FromFile("Sample.jpg");
// Convert the .NET bitmap into a FreeImage-Bitmap
FIBITMAP dib = FreeImage.CreateFromBitmap(bitmap);
// Unload bitmap
bitmap.Dispose();
// Rescale the bitmap
FIBITMAP temp = FreeImage.Rescale(dib, 300, 300, FREE_IMAGE_FILTER.FILTER_BICUBIC);
// Unload bitmap
FreeImage.UnloadEx(ref dib);
Random rand = new Random();
// Rotate the bitmap
dib = FreeImage.Rotate(temp, rand.NextDouble() * 360d);
// Unload bitmap
FreeImage.UnloadEx(ref temp);
// Convert the FreeImage-Bitmap into a .NET bitmap
bitmap = FreeImage.GetBitmap(dib);
// Unload bitmap
FreeImage.UnloadEx(ref dib);
// Unload bitmap
if (picBox.Image != null)
{
picBox.Image.Dispose();
}
// Assign new bitmap
picBox.Image = bitmap;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,16 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("69a8cbdd-43da-49e3-8d0b-2680c4ca2851")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,107 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample06</RootNamespace>
<AssemblyName>Sample06</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>
</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>
</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="FreeImageNET, Version=3.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\FreeImageNET.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Sample.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB