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,92 @@
What's New for FreeImage Delphi Wrapper
* : fixed
- : removed
! : changed
+ : added
July 29, 2010
+ [Lorenzo Monti] added Free Pascal / Lazarus 32 bit support
July 14, 2010
+ [Lorenzo Monti] updated wrapper for FreeImage 3.13.1
* [Lorenzo Monti] fixed declaration of FreeImageIO functions (FI_ReadProc, FI_WriteProc, FI_SeekProc, FI_TellProc)
! [Lorenzo Monti] renamed structure PluginStruct to Plugin, according to FreeImage.h
* [Lorenzo Monti] fixed declaration of JPEG_CMYK constant
* [Lorenzo Monti] fixed declaration of type FreeImage_OutputMessageFunction
* [Lorenzo Monti] fixed declaration of FreeImage_OutputMessageProc
+ [Lorenzo Monti] added wrapper for FreeImage_OutputMessageProc for older Delphi compilers (<6) not supporting varargs
* [Lorenzo Monti] fixed declaration of FreeImage_LookupX11Color and FreeImage_LookupSVGColor
! [Lorenzo Monti] changed declaration of FreeImage_GetPixelIndex, FreeImage_GetPixelColor, FreeImage_SetPixelIndex, FreeImage_SetPixelColor
! [Lorenzo Monti] changed declaration of FreeImage_GetInfo
! [Lorenzo Monti] changed declaration of FreeImage_GetICCProfile, FreeImage_CreateICCProfile, FreeImage_DestroyICCProfile
* [Lorenzo Monti] fixed declaration of FreeImage_SetComplexChannel
+ [Lorenzo Monti] added Delphi 2010 support
+ [Lorenzo Monti] added Version.inc to determine compiler version
! [Lorenzo Monti] moved all "external" definitions to implementation section
! [Lorenzo Monti] changed FreeBitmap.pas, FreeUtils.pas and TargaImage.pas to reflect changes in the FreeImage.pas unit
July 17, 2006
+ [Herv<72> Drolon] added FIF_FAXG3 and FIF_SGI definitions, added FreeImage_MakeThumbnail definition.
January 20, 2006
! [Anatoliy Pulyaevskiy] updated WinBitmap demo
* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.ConvertToStandartType renamed to TFreeBitmap.ConvertToStandardType
* [Anatoliy Pulyaevskiy] fixed using of SetFreeImageMarker (only for HDR dib)
October 19, 2005
+ [Anatoliy Pulyaevskiy] updated wrapper for FreeImage 3.8.0
+ [Anatoliy Pulyaevskiy] added Delphi 5 support
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.OnChanging event
! [Anatoliy Pulyaevskiy] changed declaration of TFreeBitmap.Assign method
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.CanSave function
! [Anatoliy Pulyaevskiy] property TFreeBitmap.Dib now have read/write access
+ [Anatoliy Pulyaevskiy] added TFreeTag class incapsulating FreeImage FITAG type
August 5, 2005
* [kaare-nysite] fixed the prototype of FreeImage_ConvertFromRawBits
June 21, 2005
* [Maarten Veerman] fixed the prototype of FreeImage_OpenMultiBitmap
February 17, 2005 - Version 1.3.0
+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.6.0
! [Anatoliy Pulyaevskiy] FreeImage.pas unit has been reworked
January 14, 2005 - Version 1.2.1
+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.3
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.SetHorizontalResolution and TFreeBitmap.SetVerticalResolution
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.MakeThumbnail procedure ( an adapted version of function given by Enzo Costantini)
+ [Enzo Costantini] added FIU_GetFIFType utility function
+ [Enzo Costantini] added TFreeWinBitmap.CopyToBitmapH function
* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.Rotate (fix from FreeImage CVS)
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.ConvertToStandartType
December 20, 2004 - Version 1.2.0
+ [Anatoliy Pulyaevskiy] added MultiBitmap Demo
* [Anatoliy Pulyaevskiy] fixed TFreeMultiBitmap.LockPage due to error with Locking/Unlocking pages
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.ConvertTo4Bits
* [Anatoliy Pulyaevskiy] TFreeBitmap.ConvertToGrayScale fixed converting bitmaps with FIC_MINISWHITE color type
* [Anatoliy Pulyaevskiy] fixed TFreeWinBitmap.DrawEx FDisplayDib deleting
+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.2
November 12, 2004 - Version 1.1.0
+ [Anatoliy Pulyaevskiy] added TFreeBitmap.Assign(Source: PFIBITMAP)
- [Anatoliy Pulyaevskiy] removed TFreeBitmap.SetDib
! [Anatoliy Pulyaevskiy] TFreeBitmap.Dib property now read-only
* [Anatoliy Pulyaevskiy] TFreeMultiBitmap.UnlockPage implemented
* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.Rescale not applies changes
November 8, 2004 - Version 1.0.0
+ [Anatoliy Pulyaevskiy] added Delphi version of FreeImagePlus
+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.0
January 7, 2004
+ [Tommy] added TargaImage unit
October 28, 2003
+ [Peter Bystr<74>m] updated the wrapper for FreeImage 3.0.2
August 9, 2003
+ [Simon Beavis] added a wrapper for FreeImage 2.6.1

View File

@@ -0,0 +1,13 @@
del /S *.~*
del /S *.dcu
del /S *.dsk
del /S *.cfg
del /S *.dof
del /S *.obj
del /S *.hpp
del /S *.ddp
del /S *.mps
del /S *.mpt
del /S *.bak
del /S *.exe
del /S *.stat

View File

@@ -0,0 +1,13 @@
program ImagePreview;
uses
Forms,
MainFrm in 'MainFrm.pas' {MainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

View File

@@ -0,0 +1,135 @@
object MainForm: TMainForm
Left = 304
Top = 165
Width = 467
Height = 405
Caption = 'Image Preview'
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poDesktopCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyUp = FormKeyUp
OnMouseWheel = ScrollBoxMouseWheel
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object ImgView32: TImgView32
Left = 0
Top = 0
Width = 459
Height = 371
Align = alClient
ParentShowHint = False
PopupMenu = PopupMenu
Scale = 1
ScrollBars.Color = clScrollBar
ScrollBars.ShowHandleGrip = True
ScrollBars.Style = rbsDefault
ShowHint = True
SizeGrip = sgAuto
TabOrder = 0
OnScroll = ImgView32Scroll
object AlphaView: TImgView32
Left = 8
Top = 8
Width = 161
Height = 145
Scale = 1
ScrollBars.Color = clScrollBar
ScrollBars.ShowHandleGrip = True
ScrollBars.Style = rbsDefault
SizeGrip = sgAuto
TabOrder = 2
Visible = False
end
end
object PopupMenu: TPopupMenu
Left = 304
Top = 28
object ZoomInItem: TMenuItem
Caption = 'Zoom In'
OnClick = ZoomInItemClick
end
object ZoomOutItem: TMenuItem
Caption = 'Zoom Out'
OnClick = ZoomOutItemClick
end
object ActualSizeItem: TMenuItem
Caption = 'Actual Size'
OnClick = ActualSizeItemClick
end
object N1: TMenuItem
Caption = '-'
end
object RotateClockwiseItem: TMenuItem
Caption = 'Rotate Clockwise'
OnClick = RotateClockwiseItemClick
end
object RotateAntiClockwiseItem: TMenuItem
Caption = 'Rotate Anti-Clockwise'
OnClick = RotateAntiClockwiseItemClick
end
object N4: TMenuItem
Caption = '-'
end
object FlipHorizontalItem: TMenuItem
Caption = 'Flip Horizontal'
OnClick = FlipHorizontalItemClick
end
object FilpVerticalItem: TMenuItem
Caption = 'Filp Vertical'
OnClick = FilpVerticalItemClick
end
object N3: TMenuItem
Caption = '-'
end
object ShowAlphaItem: TMenuItem
Caption = 'Show Just Alpha Channel'
OnClick = ShowAlphaItemClick
end
object ShowWithAlphaItem: TMenuItem
Caption = 'Show With Alpha Channel'
OnClick = ShowWithAlphaItemClick
end
object N2: TMenuItem
Caption = '-'
end
object OpenImageItem: TMenuItem
Caption = 'Open New Image'
OnClick = OpenImageItemClick
end
end
object FilterTimer: TTimer
Interval = 500
OnTimer = FilterTimerTimer
Left = 308
Top = 84
end
object OpenDialog: TOpenDialog
Filter =
'All image files|*.bmp;*.cut;*.ico;*.iff;*.lbm;*.jng;*.jpg;*.jpeg' +
';*.koa;*.mng;*.pbm;*.pcd;*.pcx;*.pgm;*.png;*.ppm;*.psd;*.ras;*.t' +
'ga;*.tif;*.tiff;.wbmp;*.xbm;*.xpm)|Windows or OS/2 Bitmap File (' +
'*.BMP)|*.BMP|Dr. Halo (*.CUT)|*.CUT|Windows Icon (*.ICO)|*.ICO|A' +
'miga IFF (*.IFF, *.LBM)|*.IFF;*.LBM|JPEG Network Graphics (*.JNG' +
')|*.JNG|Independent JPEG Group (*.JPG)|*.JPG|Commodore 64 Koala ' +
'(*.KOA)|*.KOA|Multiple Network Graphics (*.MNG)|*.MNG|Portable B' +
'itmap (*.PBM)|*.PBM|Kodak PhotoCD (*.PCD)|*.PCD|PCX bitmap forma' +
't (*.PCX)|*.PCX|Portable Graymap (*.PGM)|*.PGM|Portable Network ' +
'Graphics (*.PNG)|*.PNG|Portable Pixelmap (*.PPM)|*.PPM|Photoshop' +
' (*.PSD)|*.PSD|Sun Rasterfile (*.RAS)|*.RAS|Targa files (*.TGA)|' +
'*.TGA|Tagged Image File Format (*.TIF)|*.TIF;*.TIFF|Wireless Bit' +
'map (*.WBMP)|*.WBMP|X11 Bitmap Format (*.XBM)|*.XBM|X11 Pixmap F' +
'ormat (*.XPM)|*.XPM'
Title = 'Open Image File'
Left = 328
Top = 228
end
end

View File

@@ -0,0 +1,518 @@
unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, Math, GR32, GR32_Image, GR32_Transforms,
ExtDlgs;
type
TMainForm = class(TForm)
PopupMenu: TPopupMenu;
ZoomInItem: TMenuItem;
ZoomOutItem: TMenuItem;
ActualSizeItem: TMenuItem;
ImgView32: TImgView32;
N1: TMenuItem;
AlphaView: TImgView32;
ShowAlphaItem: TMenuItem;
RotateClockwiseItem: TMenuItem;
RotateAntiClockwiseItem: TMenuItem;
N3: TMenuItem;
ShowWithAlphaItem: TMenuItem;
N4: TMenuItem;
FlipHorizontalItem: TMenuItem;
FilpVerticalItem: TMenuItem;
FilterTimer: TTimer;
OpenImageItem: TMenuItem;
N2: TMenuItem;
OpenDialog: TOpenDialog;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ZoomInItemClick(Sender: TObject);
procedure ZoomOutItemClick(Sender: TObject);
procedure ActualSizeItemClick(Sender: TObject);
procedure ScrollBoxMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ShowAlphaItemClick(Sender: TObject);
procedure RotateClockwiseItemClick(Sender: TObject);
procedure RotateAntiClockwiseItemClick(Sender: TObject);
procedure ShowWithAlphaItemClick(Sender: TObject);
procedure FlipHorizontalItemClick(Sender: TObject);
procedure FilpVerticalItemClick(Sender: TObject);
procedure FilterTimerTimer(Sender: TObject);
procedure ImgView32Scroll(Sender: TObject);
procedure OpenImageItemClick(Sender: TObject);
private
{ Private declarations }
OrigWidth : integer;
OrigHeight : integer;
BPP : longword;
procedure LoadImage( Name : string);
procedure RecalcWindowSize;
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
uses FreeImage;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
procedure TMainForm.FormCreate(Sender: TObject);
begin
AlphaView.Visible := False;
AlphaView.Align := alClient;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FormDestroy(Sender: TObject);
begin
// ...
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FormShow(Sender: TObject);
begin
ImgView32.Bitmap.StretchFilter := sfSPline;
if ParamCount = 1 then
LoadImage(ParamStr(1));
end;
// -----------------------------------------------------------------------------
procedure TMainForm.LoadImage( Name : string);
var
dib : PFIBITMAP;
PBH : PBITMAPINFOHEADER;
PBI : PBITMAPINFO;
t : FREE_IMAGE_FORMAT;
Ext : string;
BM : TBitmap;
x, y : integer;
BP : PLONGWORD;
DC : HDC;
begin
try
t := FreeImage_GetFileType(PChar(Name), 16);
if t = FIF_UNKNOWN then
begin
// Check for types not supported by GetFileType
Ext := UpperCase(ExtractFileExt(Name));
if (Ext = '.TGA') or(Ext = '.TARGA') then
t := FIF_TARGA
else if Ext = '.MNG' then
t := FIF_MNG
else if Ext = '.PCD' then
t := FIF_PCD
else if Ext = '.WBMP' then
t := FIF_WBMP
else if Ext = '.CUT' then
t := FIF_CUT
else
raise Exception.Create('The file "' + Name + '" cannot be displayed because SFM does not recognise the file type.');
end;
dib := FreeImage_Load(t, PChar(name), 0);
if Dib = nil then
Close;
PBH := FreeImage_GetInfoHeader(dib);
PBI := FreeImage_GetInfo(dib^);
BPP := FreeImage_GetBPP(dib);
ShowWithAlphaItem.Enabled := BPP = 32;
ShowAlphaItem.Enabled := BPP = 32;
if BPP = 32 then
begin
ImgView32.Bitmap.SetSize(FreeImage_GetWidth(dib), FreeImage_GetHeight(dib));
BP := PLONGWORD(FreeImage_GetBits(dib));
for y := ImgView32.Bitmap.Height - 1 downto 0 do
for x := 0 to ImgView32.Bitmap.Width - 1 do
begin
ImgView32.Bitmap.Pixel[x, y] := BP^;
inc(BP);
end;
end
else
begin
BM := TBitmap.Create;
BM.Assign(nil);
DC := GetDC(Handle);
BM.handle := CreateDIBitmap(DC,
PBH^,
CBM_INIT,
PChar(FreeImage_GetBits(dib)),
PBI^,
DIB_RGB_COLORS);
ImgView32.Bitmap.Assign(BM);
AlphaView.Bitmap.Assign(BM);
BM.Free;
ReleaseDC(Handle, DC);
end;
FreeImage_Unload(dib);
OrigWidth := ImgView32.Bitmap.Width;
OrigHeight := ImgView32.Bitmap.Height;
Caption := ExtractFileName( Name ) + ' (' + IntToStr(OrigWidth) +
' x ' + IntToStr(OrigHeight) + ')';
if BPP = 32 then
Caption := Caption + ' + Alpha';
AlphaView.Bitmap.SetSize(OrigWidth, OrigWidth);
ImgView32.Hint := 'Name: ' + Name + #13 +
'Width: ' + IntToStr(OrigWidth) + #13 +
'Height: ' + IntToStr(OrigHeight) + #13 +
'BPP: ' + IntToStr(BPP);
RecalcWindowSize;
Show;
except
on e:exception do
begin
Application.BringToFront;
MessageDlg(e.message, mtInformation, [mbOK], 0);
Close;
end;
end;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ZoomInItemClick(Sender: TObject);
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
ImgView32.Scale := ImgView32.Scale * 2.0;
RecalcWindowSize;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ZoomOutItemClick(Sender: TObject);
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
ImgView32.Scale := ImgView32.Scale / 2.0;
RecalcWindowSize;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ActualSizeItemClick(Sender: TObject);
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
ImgView32.Scale := 1.0;
RecalcWindowSize;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.RecalcWindowSize;
var
Rect : TRect;
CW, CH : integer;
WSH, WSW : integer;
TitleH : integer;
BorderY : integer;
BorderX : integer;
begin
CW := ImgView32.Bitmap.Width + GetSystemMetrics(SM_CXVSCROLL);
CH := ImgView32.Bitmap.Height + GetSystemMetrics(SM_CYVSCROLL);
SystemParametersInfo( SPI_GETWORKAREA, 0, @Rect, 0);
WSH := Rect.Bottom - Rect.Top;
WSW := Rect.Right - Rect.Left;
TitleH := GetSystemMetrics(SM_CYCAPTION);
BorderY := GetSystemMetrics(SM_CYSIZEFRAME) * 2;
BorderX := GetSystemMetrics(SM_CXSIZEFRAME) * 2;
if (Top + CH + TitleH + BorderY > WSH) or (CH + TitleH + BorderY > WSH) then
begin
Top := Rect.Bottom - CH - BorderY;
if Top < 0 then
begin
Top := 0;
CH := WSH - TitleH - BorderY;
CW := CW + GetSystemMetrics(SM_CXVSCROLL);
if CW + BorderX > WSW then
CH := CH - GetSystemMetrics(SM_CYVSCROLL);
end;
end;
if (Left + CW + BorderX > WSW) or (CW + BorderX > WSW) then
begin
Left := Rect.Right - CW - BorderX;
if Left < 0 then
begin
Left := 0;
CW := WSW - BorderX;
CH := CH + GetSystemMetrics(SM_CYVSCROLL);
if CH + TitleH + BorderY > WSH then
CW := CW + GetSystemMetrics(SM_CXVSCROLL);
end
end;
ClientWidth := CW;
ClientHeight := CH;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ScrollBoxMouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
if WheelDelta < 0 then
ImgView32.Scroll(0, 20)
else
ImgView32.Scroll(0, -20);
Handled := True;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
Amount : integer;
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
if ssShift in Shift then
Amount := 20 * 2
else
Amount := 20;
case Key of
VK_ESCAPE:
Close;
VK_UP:
ImgView32.Scroll(0, -Amount);
VK_DOWN:
ImgView32.Scroll(0, Amount);
VK_LEFT:
ImgView32.Scroll(-Amount, 0);
VK_RIGHT:
ImgView32.Scroll(Amount, 0);
VK_HOME:
ImgView32.ScrollToCenter(0, 0);
VK_END:
ImgView32.ScrollToCenter(ImgView32.Bitmap.Width, ImgView32.Bitmap.Height);
VK_NEXT:
ImgView32.Scroll(0, (Trunc(ImgView32.Bitmap.Height div 4)));
VK_PRIOR:
ImgView32.Scroll(0, -(Trunc(ImgView32.Bitmap.Height div 4)));
end;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ShowAlphaItemClick(Sender: TObject);
var
x, y : integer;
Col : TColor32;
Alpha : TColor;
begin
if ShowAlphaItem.Checked then
begin
AlphaView.Visible := False;
AlphaView.Bitmap.Delete;
end
else
begin
AlphaView.Bitmap.Width := ImgView32.Bitmap.Width;
AlphaView.Bitmap.Height := ImgView32.Bitmap.Height;
for x := 0 to AlphaView.Bitmap.Width - 1 do
for y := 0 to AlphaView.Bitmap.Height - 1 do
begin
Col := ImgView32.Bitmap.Pixel[x, y];
Alpha := Col shr 24;
AlphaView.Bitmap.Pixel[x, y] := Alpha + (Alpha shl 8) + (Alpha shl 16);
end;
AlphaView.Visible := True;
end;
ShowAlphaItem.Checked := not ShowAlphaItem.Checked;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.RotateClockwiseItemClick(Sender: TObject);
var
x : integer;
y : integer;
DestX : integer;
DestY : integer;
C : TColor32;
begin
AlphaView.Bitmap.Assign(ImgView32.Bitmap);
ImgView32.BeginUpdate;
ImgView32.Bitmap.Width := AlphaView.Bitmap.Height;
ImgView32.Bitmap.Height := AlphaView.Bitmap.Width;
for x := 0 to AlphaView.Bitmap.Width - 1 do
for y := 0 to AlphaView.Bitmap.Height - 1 do
begin
C := AlphaView.Bitmap.Pixel[x, y];
DestX := (ImgView32.Bitmap.Width - 1) - Y;
DestY := X;
ImgView32.Bitmap.Pixels[DestX, DestY] := C;
end;
ImgView32.EndUpdate;
ImgView32.Refresh;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.RotateAntiClockwiseItemClick(Sender: TObject);
var
x : integer;
y : integer;
DestX : integer;
DestY : integer;
C : TColor32;
begin
AlphaView.Bitmap.Assign(ImgView32.Bitmap);
ImgView32.BeginUpdate;
ImgView32.Bitmap.Width := AlphaView.Bitmap.Height;
ImgView32.Bitmap.Height := AlphaView.Bitmap.Width;
for x := 0 to AlphaView.Bitmap.Width - 1 do
for y := 0 to AlphaView.Bitmap.Height - 1 do
begin
C := AlphaView.Bitmap.Pixel[x, y];
DestX := Y;
DestY := (ImgView32.Bitmap.Height - 1) -X;
ImgView32.Bitmap.Pixels[DestX, DestY] := C;
end;
ImgView32.EndUpdate;
ImgView32.Refresh;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ShowWithAlphaItemClick(Sender: TObject);
begin
if ShowWithAlphaItem.Checked then
ImgView32.Bitmap.DrawMode := dmOpaque
else
ImgView32.Bitmap.DrawMode := dmBlend;
ShowWithAlphaItem.Checked := not ShowWithAlphaItem.Checked;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FlipHorizontalItemClick(Sender: TObject);
var
x : integer;
y : integer;
DestX : integer;
DestY : integer;
C : TColor32;
begin
AlphaView.Bitmap.Assign(ImgView32.Bitmap);
ImgView32.BeginUpdate;
ImgView32.Bitmap.Width := AlphaView.Bitmap.Width;
ImgView32.Bitmap.Height := AlphaView.Bitmap.Height;
for x := 0 to AlphaView.Bitmap.Width - 1 do
for y := 0 to AlphaView.Bitmap.Height - 1 do
begin
C := AlphaView.Bitmap.Pixel[x, y];
DestX := (ImgView32.Bitmap.Width - 1) -X;
DestY := Y;
ImgView32.Bitmap.Pixels[DestX, DestY] := C;
end;
ImgView32.EndUpdate;
ImgView32.Refresh;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FilpVerticalItemClick(Sender: TObject);
var
x : integer;
y : integer;
DestX : integer;
DestY : integer;
C : TColor32;
begin
AlphaView.Bitmap.Assign(ImgView32.Bitmap);
ImgView32.BeginUpdate;
ImgView32.Bitmap.Width := AlphaView.Bitmap.Width;
ImgView32.Bitmap.Height := AlphaView.Bitmap.Height;
for x := 0 to AlphaView.Bitmap.Width - 1 do
for y := 0 to AlphaView.Bitmap.Height - 1 do
begin
C := AlphaView.Bitmap.Pixel[x, y];
DestX := X;
DestY := (ImgView32.Bitmap.Height - 1) - Y;
ImgView32.Bitmap.Pixels[DestX, DestY] := C;
end;
ImgView32.EndUpdate;
ImgView32.Refresh;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.FilterTimerTimer(Sender: TObject);
begin
FilterTimer.Enabled := False;
ImgView32.Bitmap.StretchFilter := sfSPline;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.ImgView32Scroll(Sender: TObject);
begin
FilterTimer.Enabled := False;
if ImgView32.Bitmap.StretchFilter <> sfNearest then
ImgView32.Bitmap.StretchFilter := sfNearest;
FilterTimer.Enabled := True;
end;
// -----------------------------------------------------------------------------
procedure TMainForm.OpenImageItemClick(Sender: TObject);
begin
if OpenDialog.Execute then
begin
try
Screen.Cursor := crHourGlass;
LoadImage(OpenDialog.FileName);
finally
Screen.Cursor := crDefault;
end;
end;
end;
end.

View File

@@ -0,0 +1,8 @@
This is a simple image viewing application that uses the FreeImage library to display images in many different formats.
The app displays the image whose name is passed in as a command line argument.
To compile the app you will also need the Graphics32 library available from www.g32.org. It has been tested with version 1.5.1 of Graphics32.
SJB.

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -0,0 +1,13 @@
program MultiBitmap;
uses
Forms,
mbMainForm in 'mbMainForm.pas' {MainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

View File

@@ -0,0 +1,10 @@
[Stats]
EditorSecs=82
DesignerSecs=5
InspectorSecs=1
CompileSecs=850
OtherSecs=5
StartTime=20.12.2004 11:40:22
RealKeys=0
EffectiveKeys=0
DebugSecs=19

View File

@@ -0,0 +1,89 @@
object MainForm: TMainForm
Left = 203
Top = 192
Width = 696
Height = 480
Caption = 'MultiBitmap Demo'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
OldCreateOrder = False
OnPaint = FormPaint
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object ToolBar: TToolBar
Left = 0
Top = 0
Width = 688
Height = 25
AutoSize = True
ButtonHeight = 21
ButtonWidth = 33
Caption = 'ToolBar'
EdgeBorders = [ebLeft, ebTop, ebRight, ebBottom]
Flat = True
Indent = 3
ShowCaptions = True
TabOrder = 0
object tbLoad: TToolButton
Left = 3
Top = 0
Caption = 'Load'
ImageIndex = 0
OnClick = tbLoadClick
end
object ToolButton1: TToolButton
Left = 36
Top = 0
Width = 8
Caption = 'ToolButton1'
ImageIndex = 1
Style = tbsSeparator
end
object tbClose: TToolButton
Left = 44
Top = 0
Caption = 'Close'
ImageIndex = 1
OnClick = tbCloseClick
end
object ToolButton2: TToolButton
Left = 77
Top = 0
Width = 8
Caption = 'ToolButton2'
ImageIndex = 2
Style = tbsSeparator
end
object Label1: TLabel
Left = 85
Top = 0
Width = 36
Height = 21
Caption = 'Pages: '
Layout = tlCenter
end
object cbPages: TComboBox
Left = 121
Top = 0
Width = 60
Height = 21
Style = csDropDownList
DropDownCount = 15
ItemHeight = 13
TabOrder = 0
OnChange = cbPagesChange
end
end
object OD: TOpenDialog
Filter = 'TIFF multibitmap (*.tiff, *.tif)|*.tiff; *.tif|ICO|*.ico'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Title = 'Open multibitmap..'
Left = 64
Top = 96
end
end

View File

@@ -0,0 +1,150 @@
unit mbMainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, StdCtrls, FreeBitmap;
type
TMainForm = class(TForm)
ToolBar: TToolBar;
tbLoad: TToolButton;
ToolButton1: TToolButton;
tbClose: TToolButton;
ToolButton2: TToolButton;
cbPages: TComboBox;
Label1: TLabel;
OD: TOpenDialog;
procedure tbLoadClick(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure tbCloseClick(Sender: TObject);
procedure cbPagesChange(Sender: TObject);
procedure FormResize(Sender: TObject);
private
FMultiBitmap: TFreeMultiBitmap;
FPage: TFreeWinBitmap;
procedure PageBitmapChangeHandler(Sender: TObject);
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure OpenMultiBitmap(const FileName: string);
procedure CloseMultiBitmap;
procedure OpenPage(Number: Integer);
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
{ TMainForm }
procedure TMainForm.CloseMultiBitmap;
begin
if FPage.IsValid then
FMultiBitmap.UnlockPage(Fpage, False);
FMultiBitmap.Close;
cbPages.Clear;
end;
constructor TMainForm.Create(AOwner: TComponent);
begin
inherited;
FMultiBitmap := TFreeMultiBitmap.Create;
FPage := TFreeWinBitmap.Create;
FPage.OnChange := PageBitmapChangeHandler;
end;
destructor TMainForm.Destroy;
begin
if FMultiBitmap.IsValid then
CloseMultiBitmap;
FMultiBitmap.Free;
inherited;
end;
procedure TMainForm.OpenMultiBitmap(const FileName: string);
var
I, Cnt: Integer;
begin
if FMultiBitmap.IsValid then CloseMultiBitmap;
FMultiBitmap.Open(FileName, False, True);
Cnt := FMultiBitmap.GetPageCount;
cbPages.OnChange := nil;
cbPages.Clear;
for I := 0 to Cnt - 1 do
cbPages.Items.Add(IntToStr(I));
cbPages.OnChange := cbPagesChange;
end;
procedure TMainForm.OpenPage(Number: Integer);
begin
if not FMultiBitmap.IsValid then Exit;
if FPage.IsValid then
FMultiBitmap.UnlockPage(FPage, False);
FMultiBitmap.LockPage(Number, FPage);
end;
procedure TMainForm.PageBitmapChangeHandler(Sender: TObject);
begin
Invalidate;
end;
procedure TMainForm.tbLoadClick(Sender: TObject);
begin
if OD.Execute then
begin
try
OpenMultiBitmap(OD.FileName);
except
raise Exception.CreateFmt('Can not load file %s', [OD.FileName]);
end;
end;
end;
procedure TMainForm.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
Message.Result := 1;
end;
procedure TMainForm.FormPaint(Sender: TObject);
begin
if not FPage.IsValid then
begin
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(ClientRect);
end
else
FPage.Draw(Canvas.Handle, ClientRect);
end;
procedure TMainForm.tbCloseClick(Sender: TObject);
begin
if FMultiBitmap.IsValid then
CloseMultiBitmap;
end;
procedure TMainForm.cbPagesChange(Sender: TObject);
var
Page: Integer;
begin
Page := StrToInt(cbPages.Text);
OpenPage(Page);
end;
procedure TMainForm.FormResize(Sender: TObject);
begin
Invalidate;
end;
end.

View File

@@ -0,0 +1,22 @@
TargaImage.pas is a TGraphic descendant for Delphi. Installing it
will allow Delphi TImage and TDBImage components to read Targa files
just like BMP & WMF files with no coding on your part.
It also adds the TGA file type to the Delphi Open/Save Picture dialog
boxes.
To install this unit, place it in your one of your library folders
and make it available to all your Delphi projects by using
Component>Install Component from the Delphi menus.
NOTE: any Delphi applications using this *must* have FreeImage.dll
installed in your application's folder, or somewhere in the path.
-----------------------
Tommy
Edinburgh, Scotland
LeTene@battlefieldeurope.org

View File

@@ -0,0 +1,212 @@
unit TargaImage;
// ==========================================================
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
//
// ==========================================================
interface
uses
Windows,
Classes,
FreeImage,
Graphics,
Types;
type
TTargaImage = class(TGraphic)
private
fImage: PFIBITMAP;
fWidth: Integer;
fHeight: Integer;
protected
procedure Draw(ACanvas: TCanvas; const ARect: TRect); override;
function GetEmpty: Boolean; override;
function GetHeight: Integer; override;
function GetWidth: Integer; override;
procedure SetHeight(Value: Integer); override;
procedure SetWidth(Value: Integer); override;
public
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override;
procedure LoadFromStream(Stream: TStream); override;
procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); override;
procedure SaveToStream(Stream: TStream); override;
end;
procedure Register;
implementation
{ Design-time registration }
procedure Register;
begin
TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage);
end;
{ IO functions }
function FI_ReadProc(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : UInt; stdcall;
var
stream: TStream;
bytesToRead: Cardinal;
begin
stream := TStream(handle);
bytesToRead := size*count;
Result := stream.Read(buffer^, bytesToRead);
end;
function FI_WriteProc(buffer : pointer; size, count : Cardinal; handle : fi_handle) : UInt; stdcall;
var
stream: TStream;
bytesToWrite: Cardinal;
begin
stream := TStream(handle);
bytesToWrite := size*count;
Result := stream.Write(buffer^, bytesToWrite);
end;
function FI_SeekProc(handle : fi_handle; offset : longint; origin : integer) : Integer; stdcall;
begin
TStream(handle).Seek(offset, origin);
Result := 0;
end;
function FI_TellProc(handle : fi_handle) : LongInt; stdcall;
begin
Result := TStream(handle).Position;
end;
{ TTargaImage }
constructor TTargaImage.Create;
begin
fImage := nil;
fWidth := 0;
fHeight := 0;
inherited;
end;
destructor TTargaImage.Destroy;
begin
if Assigned(fImage) then
FreeImage_Unload(fImage);
inherited;
end;
procedure TTargaImage.Assign(Source: TPersistent);
begin
if Source is TTargaImage then begin
fImage := FreeImage_Clone(TTargaImage(Source).fImage);
fWidth := FreeImage_GetWidth(fImage);
fHeight := FreeImage_GetHeight(fImage);
Changed(Self);
end else
inherited;
end;
procedure TTargaImage.Draw(ACanvas: TCanvas; const ARect: TRect);
var
pbi: PBitmapInfo;
begin
if Assigned(fImage) then begin
pbi := FreeImage_GetInfo(fImage);
SetStretchBltMode(ACanvas.Handle, COLORONCOLOR);
StretchDIBits(ACanvas.Handle, ARect.left, ARect.top,
ARect.right-ARect.left, ARect.bottom-ARect.top,
0, 0, fWidth, fHeight,
FreeImage_GetBits(fImage), pbi^, DIB_RGB_COLORS, SRCCOPY);
end;
end;
function TTargaImage.GetEmpty: Boolean;
begin
Result := Assigned(fImage);
end;
function TTargaImage.GetHeight: Integer;
begin
Result := fHeight;
end;
function TTargaImage.GetWidth: Integer;
begin
Result := fWidth;
end;
procedure TTargaImage.LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE);
begin
if Assigned(fImage) then begin
end;
end;
procedure TTargaImage.LoadFromStream(Stream: TStream);
var
io: FreeImageIO;
begin
with io do begin
read_proc := FI_ReadProc;
write_proc := FI_WriteProc;
seek_proc := FI_SeekProc;
tell_proc := FI_TellProc;
end;
fImage := FreeImage_LoadFromHandle(FIF_TARGA, @io, Stream);
if Assigned(fImage) then begin
fWidth := FreeImage_GetWidth(fImage);
fHeight := FreeImage_GetHeight(fImage);
end;
end;
procedure TTargaImage.SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE);
begin
end;
procedure TTargaImage.SaveToStream(Stream: TStream);
var
io: FreeImageIO;
begin
with io do begin
read_proc := FI_ReadProc;
write_proc := FI_WriteProc;
seek_proc := FI_SeekProc;
tell_proc := FI_TellProc;
end;
FreeImage_SaveToHandle(FIF_TARGA, fImage, @io, Stream);
end;
procedure TTargaImage.SetHeight(Value: Integer);
begin
if Assigned(fImage) then begin
fHeight := Value;
FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC);
end;
end;
procedure TTargaImage.SetWidth(Value: Integer);
begin
if Assigned(fImage) then begin
fWidth := Value;
FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC);
end;
end;
initialization
TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage);
end.

View File

@@ -0,0 +1,13 @@
program MainDemo;
uses
Forms,
MainForm in 'MainForm.pas' {fwbMainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfwbMainForm, fwbMainForm);
Application.Run;
end.

View File

@@ -0,0 +1,607 @@
object fwbMainForm: TfwbMainForm
Left = 205
Top = 206
Width = 696
Height = 480
Caption = 'FreeWinBitmap - MainDemo'
Color = clCaptionText
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu
OldCreateOrder = False
ShowHint = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnPaint = FormPaint
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object StatusBar: TStatusBar
Left = 0
Top = 411
Width = 688
Height = 23
Panels = <
item
Alignment = taCenter
Width = 120
end
item
Alignment = taCenter
Width = 80
end
item
Width = 50
end>
end
object tbTools: TToolBar
Left = 0
Top = 0
Width = 688
Height = 29
Caption = 'ToolBar'
Color = clBtnFace
EdgeBorders = [ebTop, ebBottom]
Flat = True
Images = ImageList1
ParentColor = False
TabOrder = 1
object ToolButton1: TToolButton
Left = 0
Top = 0
Width = 8
Caption = 'ToolButton1'
ImageIndex = 1
Style = tbsSeparator
end
object btnOpen: TToolButton
Left = 8
Top = 0
Hint = 'Open image file...'
Caption = 'Open...'
ImageIndex = 0
OnClick = mnuFileOpenClick
end
object ToolButton4: TToolButton
Left = 31
Top = 0
Width = 8
Caption = 'ToolButton4'
ImageIndex = 4
Style = tbsSeparator
end
object btnCopy: TToolButton
Left = 39
Top = 0
Hint = 'Copy to clipboard'
Caption = 'Copy'
ImageIndex = 1
OnClick = btnCopyClick
end
object btnPaste: TToolButton
Left = 62
Top = 0
Hint = 'Paste from from clipboard'
Caption = 'Paste'
ImageIndex = 2
OnClick = btnPasteClick
end
object ToolButton3: TToolButton
Left = 85
Top = 0
Width = 8
Caption = 'ToolButton3'
ImageIndex = 4
Style = tbsSeparator
end
object btnClear: TToolButton
Left = 93
Top = 0
Caption = 'Clear'
ImageIndex = 3
OnClick = btnClearClick
end
end
object MainMenu: TMainMenu
Left = 120
Top = 48
object mnuFile: TMenuItem
Caption = '&File'
object mnuFileOpen: TMenuItem
Caption = '&Open'
OnClick = mnuFileOpenClick
end
object mnuExit: TMenuItem
Caption = 'E&xit'
OnClick = mnuExitClick
end
end
object mnuImage: TMenuItem
Caption = 'Image'
object mnuImageFlip: TMenuItem
Caption = 'Flip'
object mnuFlipHorz: TMenuItem
Caption = 'Horizontal'
OnClick = mnuFlipHorzClick
end
object mnuFlipVert: TMenuItem
Caption = 'Vertical'
OnClick = mnuFlipHorzClick
end
end
object mnuConvert: TMenuItem
Caption = 'Convert'
object mnuTo4Bits: TMenuItem
Caption = 'To 4 Bits'
OnClick = mnuFlipHorzClick
end
object mnuTo8Bits: TMenuItem
Caption = 'To 8 Bits'
OnClick = mnuFlipHorzClick
end
object mnuTo16Bits555: TMenuItem
Caption = 'To 16 Bits (555)'
OnClick = mnuFlipHorzClick
end
object mnuTo16Bits565: TMenuItem
Caption = 'To 16 Bits (565)'
OnClick = mnuFlipHorzClick
end
object mnuTo24Bits: TMenuItem
Caption = 'To 24 Bits'
OnClick = mnuFlipHorzClick
end
object mnuTo32Bits: TMenuItem
Caption = 'To 32 Bits'
OnClick = mnuFlipHorzClick
end
object mnuDither: TMenuItem
Caption = 'Dither'
OnClick = mnuFlipHorzClick
end
object mnuQuantize: TMenuItem
Caption = 'Quantize'
OnClick = mnuFlipHorzClick
end
object mnuGrayScale: TMenuItem
Caption = 'GrayScale'
OnClick = mnuFlipHorzClick
end
end
object mnuRotate: TMenuItem
Caption = 'Rotate'
object mnuClockwise: TMenuItem
Caption = 'Clockwise'
OnClick = mnuFlipHorzClick
end
object mnuAntiClockwise: TMenuItem
Caption = 'AntiClockwise'
OnClick = mnuFlipHorzClick
end
end
object mnuInvert: TMenuItem
Caption = 'Invert'
OnClick = mnuFlipHorzClick
end
object mnuClear: TMenuItem
Caption = 'Clear'
OnClick = mnuFlipHorzClick
end
end
end
object OD: TOpenDialog
Title = 'Open file ...'
Left = 152
Top = 48
end
object ImageList1: TImageList
Left = 184
Top = 48
Bitmap = {
494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000007088900060809000607880005070
8000506070004058600040485000303840002030300020203000101820001010
1000101020000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000080685000203040002030400020304000203040002030
4000203040002030400020304000203040000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DFE2F700EFF0FB0000000000000000007088900090A0B00070B0D0000090
D0000090D0000090D0000090C0001088C0001080B0001080B0002078A0002070
900020486000B9BEBE0000000000000000000000000000000000000000000000
00000000000000000000C0704000B0583000B0583000A0502000A05020009048
2000904820009040200080402000000000007086900060809000506070004050
6000304050002030400090706000F0E0D000B0A09000B0A09000B0A09000B0A0
9000B0A09000B0A09000B0A0900020304000000000000000000000000000EFF1
FF001F3BF100EFF1FF000000000000000000000000000000000000000000CFD3
F3001F2DB900CFD2F30000000000000000008088900080C0D00090A8B00080E0
FF0060D0FF0050C8FF0050C8FF0040C0F00030B0F00030A8F00020A0E0001090
D00020688000656A700000000000000000000000000000000000000000000000
00000000000000000000C0785000FFF8F000D0B0A000D0B0A000D0B0A000C0B0
A000C0A8A000C0A8900090402000000000007080900020B8F0000090D0000090
D0000090D0000090D00090786000F0E8E000F0D8D000E0D0C000E0C8C000D0C0
B000D0B8B000D0B8B000B0A09000203040000000000000000000F0F2FF00576F
FF001030FF001E34FF00EFF1FF00000000000000000000000000DFE2F7003F51
CF000018C0000F1EB400DFE2F700000000008090A00080D0F00090A8B00090C0
D00070D8FF0060D0FF0060D0FF0050C8FF0050C0FF0040B8F00030B0F00030A8
F0001088D00020486000E1E4E500000000000000000000000000000000000000
00000000000000000000D0886000FFFFFF00E0906000D0805000D0805000D080
5000D0805000C0A8A00090482000000000007088900070C8F00010B8F00010B0
F00000A8E0000098D000A0807000F0F0F000C0B0A000C0B0A000C0A8A000B0A0
9000D0C0B000B0A09000B0A0900020304000000000000000000000000000F1F2
FF002D52FF001030FF000028FF00CFD5FF0000000000CFD3F3001F34C7000018
D0000F25C300BFC5EF0000000000000000008090A00080D8F00080C8E00090A8
B00080E0FF0070D0FF0060D8FF0060D0FF0060D0FF0050C8FF0040C0F00040B8
F00030B0F000206880007897A50000000000B0A0900060483000604830006048
30006048300060483000D0907000FFFFFF00FFFFFF00FFF0F000F0E0D000F0D0
C000F0C0B000C0B0A00090482000000000008088900070D0F00030C0F00010B8
F00000A8F00000A0E000A0888000FFF8FF00F0F0F000F0E8E000F0D8D000E0D0
C000705850006050400050484000404040000000000000000000000000000000
0000F1F2FF002D52FF001030FF000F2DFF00CFD3F6001F34D5000020E0000F25
D200DFE2F7000000000000000000000000008098A00090E0F00090E0FF0090A8
B00090B8C00070D8FF0060D8FF0060D8FF0060D8FF0060D0FF0050D0FF0050C8
FF0040B8F00030A0E0004B697800DEE1E400B0A09000FFF0F000F0E0D000E0D8
D000E0D0C000E0C8C000E0A08000FFFFFF00F0A88000E0987000E0906000D080
5000D0805000D0B0A000A0482000000000008090A00080D8F00040C8F00030C0
F00010B8F00000A0E000B0908000FFFFFF00C0B0A000C0B0A000C0A8A000F0E0
D00080605000D0C8C00060504000000000000000000000000000000000000000
000000000000E3E6FF005669FF001038FF000020F0000F2DF0002F42D800DFE2
F700000000000000000000000000000000008098A00090E0F000A0E8FF0080C8
E00090A8B00080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0
FF0070D8FF0070D8FF0050A8D000919BA500B0A09000FFF8F000E0B08000E0A0
7000E0A07000D0987000E0A89000FFFFFF00FFFFFF00FFFFFF00FFF8F000F0E8
E000F0D0C000D0B0A000A0502000000000008098A00090E0F00060D8F00050C8
F00030C0F00010B0F000B0989000FFFFFF00FFFFFF00FFF8FF00F0F0F000F0E8
E000806850008060500000000000000000000000000000000000000000000000
00000000000000000000C3CAFF002048FF001030FF000F2DF000CFD3F6000000
00000000000000000000000000000000000090A0A000A0E8F000A0E8FF00A0E8
FF0090B0C00090B0C00090A8B00090A8B00080A0B00080A0B0008098A0008098
A0008090A0008090A0008088900070889000C0A89000FFFFFF00FFF8F000F0F0
F000F0E8E000F0E0D000E0B8A000FFFFFF00FFB09000FFB09000F0D8D000E090
6000B0583000B0583000A0502000000000008098A000A0E8F00080E0F00070D8
F00050D0F00010B0F000B0A09000B0989000B0908000A0888000A08070009078
6000907060000000000000000000000000000000000000000000000000000000
000000000000CFD7FF004060FF003050FF002D4BFF001038FF000020F000DFE3
FD000000000000000000000000000000000090A0B000A0E8F000A0F0FF00A0E8
FF00A0E8FF0080D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8
FF0070889000000000000000000000000000C0A8A000FFFFFF00FFC8A000F0B8
9000E0B08000E0A07000F0C0A000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F098
7000F0C8B000B0583000EBD5CB000000000090A0A000B0F0FF00A0E8FF0090E0
F00070D0F00010A0D00010A0D00010A0D0001098D0000090D0000090D0000090
D000303840000000000000000000000000000000000000000000000000000000
0000DBE1FF004060FF004058FF004B70FF00CFD5FF004B69FF002040FF000020
F000CFD5FC0000000000000000000000000090A0B000A0F0F000B0F0F000A0F0
FF00A0E8FF00A0E8FF0070D8FF0090A0A0008098A0008098A0008090A0008090
900070889000000000000000000000000000C0B0A000FFFFFF00FFFFFF00FFF8
FF00FFF0F000F0E8E000F0C8B000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F0A8
8000C0683000EFD9CB00000000000000000090A0B000B0F0FF00A0F0FF006080
9000607080005070800050687000506870005060700040587000207090000090
D00040486000000000000000000000000000000000000000000000000000E7EB
FF005070FF005078FF00708AFF00E7EBFF0000000000DBDFFF004B69FF003048
FF000020F000CFD5FC00000000000000000090A8B000A0D0E000B0F0F000B0F0
F000A0F0FF00A0E8FF0090A0B000B3C7CB000000000000000000000000000000
000000000000906850009068500090685000D0B8B000FFFFFF00FFD8C000FFD0
B000F0E0D000B0A09000F0C8B000F0C0B000F0C0B000F0B8A000F0B09000F0B0
9000F7E3D70000000000000000000000000090A8B000B0F0FF00B0F0FF006088
900090C8D00090E8F00080D8E00060C8E0005098B000405860002080A0000090
D000505870000000000000000000000000000000000000000000F3F5FF006078
FF006078FF00697FFF00F3F5FF00000000000000000000000000E7EAFF004B69
FF003050FF000028FF00DFE3FD0000000000DCE3E60090A8B00090A8B00090A8
B00090A8B00090A8B000AAB3B400000000000000000000000000000000000000
000000000000E1D4D2009068500090685000D0C0B000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00C0A89000D0C8C00090706000E1DCD80000000000000000000000
00000000000000000000000000000000000090A8B000B0F0F000B0F0FF00A0F0
F0007098A000A0F0F00060757C0080C8D000507080003060800060C0F00020B8
F00050607000000000000000000000000000000000000000000000000000E7EB
FF006987FF00F3F5FF000000000000000000000000000000000000000000E7EA
FF005773FF00E1E5FF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000090786000B7A498000000
0000F9F6F600A0908000E1D9D20090786000E0C0B000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00C0B0A000A0806000E1DCD8000000000000000000000000000000
000000000000000000000000000000000000CED8DC0090A8B00090A8B00090A8
B0006090A000A0E8F000A0E8F00090D8E0004068700070889000808890007088
9000D7DADC000000000000000000000000000000000000000000000000000000
0000F3F5FF000000000000000000000000000000000000000000000000000000
0000E7EAFF000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000D1CFC900A0908000A088
8000B0988000CFC7BF000000000000000000E0C0B000E0C0B000D0C0B000D0C0
B000D0B8B000D0B0A000E6DEDC00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000080B0C00080B0C00080A0B000DEE1E40000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000300000000100010000000000800100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000FFFFFFFFFFFFFFFF0007FFFFFC00FFF3
0003FC010000E3E30003FC010000C1C10001FC010000E083000100010000F007
000000010001F80F000000010003FC1F000000010007F80F000700010007F007
000700030007E08300F800070007C1C101F8007F0007E3E3FF9000FF0007F7F7
FF8301FFF87FFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000
000000000000}
end
end

View File

@@ -0,0 +1,227 @@
unit MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, FreeBitmap, ComCtrls, ImgList, ToolWin;
type
TfwbMainForm = class(TForm)
MainMenu: TMainMenu;
mnuFile: TMenuItem;
mnuFileOpen: TMenuItem;
mnuExit: TMenuItem;
OD: TOpenDialog;
StatusBar: TStatusBar;
mnuImage: TMenuItem;
mnuImageFlip: TMenuItem;
mnuFlipHorz: TMenuItem;
mnuFlipVert: TMenuItem;
mnuConvert: TMenuItem;
mnuTo8Bits: TMenuItem;
mnuTo16Bits555: TMenuItem;
mnuTo16Bits565: TMenuItem;
mnuTo24Bits: TMenuItem;
mnuTo32Bits: TMenuItem;
mnuDither: TMenuItem;
mnuQuantize: TMenuItem;
mnuGrayScale: TMenuItem;
mnuRotate: TMenuItem;
mnuClockwise: TMenuItem;
mnuAntiClockwise: TMenuItem;
mnuInvert: TMenuItem;
mnuClear: TMenuItem;
mnuTo4Bits: TMenuItem;
tbTools: TToolBar;
btnCopy: TToolButton;
ImageList1: TImageList;
ToolButton1: TToolButton;
btnPaste: TToolButton;
btnClear: TToolButton;
btnOpen: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure mnuExitClick(Sender: TObject);
procedure mnuFileOpenClick(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure mnuFlipHorzClick(Sender: TObject);
procedure btnCopyClick(Sender: TObject);
procedure btnClearClick(Sender: TObject);
procedure btnPasteClick(Sender: TObject);
private
FBitmap: TFreeWinBitmap;
procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND;
public
{ Public declarations }
end;
var
fwbMainForm: TfwbMainForm;
implementation
{$R *.dfm}
uses
FreeUtils, FreeImage, Math;
procedure TfwbMainForm.FormDestroy(Sender: TObject);
begin
if Assigned(FBitmap) then
FBitmap.Free;
end;
procedure TfwbMainForm.FormPaint(Sender: TObject);
var
dx, dy, w, h: Integer;
r1, r2: Double;
R: TRect;
begin
if FBitmap.IsValid then // draw the bitmap
begin
// determine paint rect
r1 := FBitmap.GetWidth / FBitmap.GetHeight;
r2 := ClientWidth / ClientHeight;
if r1 > r2 then // fit by width
begin
w := ClientWidth;
h := Floor(w / r1);
dx := 0;
dy := (ClientHeight - h) div 2;
end
else // fit by height
begin
h := ClientHeight;
w := Floor(h * r1);
dy := 0;
dx := (ClientWidth - w) div 2;
end;
with ClientRect do
R := Bounds(Left + dx, Top + dy, w, h);
FBitmap.Draw(Canvas.Handle, R);
// erase area around the image
Canvas.Brush.Color := Color;
if dx > 0 then
begin
with ClientRect do
R := Bounds(Left, Top, dx, ClientHeight);
Canvas.FillRect(R);
with ClientRect do
R := Bounds(Right - dx, Top, dx, ClientHeight);
Canvas.FillRect(R);
end else
if dy > 0 then
begin
with ClientRect do
R := Bounds(Left, Top, ClientWidth, dy);
Canvas.FillRect(R);
with ClientRect do
R := Bounds(Left, Bottom - dy, ClientWidth, dy);
Canvas.FillRect(R);
end
end
else // clear
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(ClientRect);
end
end;
procedure TfwbMainForm.FormCreate(Sender: TObject);
begin
FBitmap := TFreeWinBitmap.Create;
mnuImage.Enabled := FBitmap.IsValid;
OD.Filter := FIU_GetAllFilters;
end;
procedure TfwbMainForm.mnuExitClick(Sender: TObject);
begin
Close;
end;
procedure TfwbMainForm.mnuFileOpenClick(Sender: TObject);
var
t: Cardinal;
begin
if OD.Execute then
begin
t := GetTickCount;
FBitmap.Load(OD.FileName);
t := GetTickCount - t;
mnuImage.Enabled := FBitmap.IsValid;
StatusBar.Panels[0].Text := 'Loaded in ' + IntToStr(t) + ' msec.';
StatusBar.Panels[1].Text := Format('%dx%d', [FBitmap.GetWidth, FBitmap.GetHeight]);
Invalidate;
end;
end;
procedure TfwbMainForm.FormResize(Sender: TObject);
begin
Invalidate
end;
procedure TfwbMainForm.WMEraseBkgnd(var Message: TMessage);
begin
Message.Result := 1;
end;
procedure TfwbMainForm.mnuFlipHorzClick(Sender: TObject);
begin
with FBitmap do
if Sender = mnuFlipHorz then
FLipHorizontal else
if Sender = mnuFlipVert then
FlipVertical else
if Sender = mnuTo4Bits then
ConvertTo4Bits else
if Sender = mnuTo8Bits then
ConvertTo8Bits else
if Sender = mnuTo16Bits555 then
ConvertTo16Bits555 else
if Sender = mnuTo16Bits565 then
ConvertTo16Bits565 else
if Sender = mnuTo24Bits then
ConvertTo24Bits else
if Sender = mnuTo32Bits then
ConvertTo32Bits else
if Sender = mnuDither then
Dither(FID_FS) else
if Sender = mnuQuantize then
ColorQuantize(FIQ_WUQUANT) else
if Sender = mnuGrayScale then
ConvertToGrayscale else
if Sender = mnuClockwise then
Rotate(-90) else
if Sender = mnuAntiClockwise then
Rotate(90) else
if Sender = mnuInvert then
Invert else
if Sender = mnuClear then
Clear;
Invalidate;
end;
procedure TfwbMainForm.btnCopyClick(Sender: TObject);
begin
if FBitmap.IsValid then FBitmap.CopyToClipBoard(Handle);
end;
procedure TfwbMainForm.btnClearClick(Sender: TObject);
begin
FBitmap.Clear;
Invalidate;
end;
procedure TfwbMainForm.btnPasteClick(Sender: TObject);
begin
FBitmap.PasteFromClipBoard;
Invalidate;
end;
end.

View File

@@ -0,0 +1,3 @@
The contents of FreeImageDW package are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this package except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,186 @@
unit FreeUtils;
// ==========================================================
//
// Delphi wrapper for FreeImage 3
//
// Design and implementation by
// - Anatoliy Pulyaevskiy (xvel84@rambler.ru)
//
// Contributors:
// - Enzo Costantini (enzocostantini@libero.it)
// - Armindo (tech1.yxendis@wanadoo.fr)
// - Lorenzo Monti (LM) lomo74@gmail.com
//
// Revision history
// When Who What
// ----------- ----- -----------------------------------------------------------
// 2010-07-14 LM made RAD2010 compliant (unicode)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
//
// ==========================================================
interface
{$I 'Version.inc'}
uses
{$IFDEF DELPHI2010}AnsiStrings,{$ENDIF} SysUtils, Classes, FreeImage;
function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT;
// returns FIF (plugin) description string
function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString;
procedure FIU_GetAllDescriptions(var Descriptions: TStringList);
// returns file extentions for FIF (e.g. '*.tif;*.tiff)
function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString;
// returns file extentions for all plugins
function FIU_GetFullExtList: AnsiString;
// returns "Description + | + ExtList" for specified FIF
function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString;
// All supported formats + Full filter list for FIFs
function FIU_GetAllFilters: AnsiString;
//Filter for OpenDialogs
function FIU_GetAllOpenFilters: AnsiString;
//Filter for SaveDialogs
function FIU_GetAllSaveFilters: AnsiString;
implementation
const
FIF_START = FIF_UNKNOWN;
FIF_END = FIF_XPM;
function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT;
begin
Result := FreeImage_GetFileType(PAnsiChar(filename), 0);
end;
function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString;
begin
Result := FreeImage_GetFIFDescription(fif)
end;
procedure FIU_GetAllDescriptions(var Descriptions: TStringList);
var
fif: FREE_IMAGE_FORMAT;
begin
Descriptions.Clear;
for fif := FIF_START to FIF_END do
Descriptions.Add(string(FreeImage_GetFIFDescription(fif)) + ' (' +
string(FIu_GetFIFExtList(fif)) + ')');
end;
function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString;
var
ExtList: AnsiString;
I: Smallint;
C: AnsiChar;
begin
Result := '*.';
ExtList := FreeImage_GetFIFExtensionList(fif);
for I := 1 to Length(ExtList) do
begin
C := ExtList[i];
if C <> ',' then
Result := Result + C
else
Result := Result + ';*.';
end
end;
function FIU_GetFullExtList: AnsiString;
var
fif: FREE_IMAGE_FORMAT;
begin
Result := FIU_GetFIFExtList(FIF_START);
for fif := FIF_START to FIF_END do
Result := Result + ';' + FIU_GetFIFExtList(fif)
end;
function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString;
var
Text, ExtList: AnsiString;
begin
Result := '';
if fif <> FIF_UNKNOWN then
begin
Text := {$IFDEF DELPHI2010}AnsiStrings.{$ENDIF}Trim(FreeImage_GetFIFDescription(fif));
ExtList := FIU_GetFIFExtList(fif);
Result := Text + '(' + ExtList + ')' + '|' + ExtList
end
end;
function FIU_GetAllFilters: AnsiString;
var
fif: FREE_IMAGE_FORMAT;
begin
Result := 'All supported formats|' + FIU_GetFullExtList;
for fif := FIF_START to FIF_END do
begin
Result := Result + '|' + FIU_GetFIFFilter(fif)
end;
end;
function FIU_GetAllOpenFilters: AnsiString;
var
fif: FREE_IMAGE_FORMAT;
begin
Result := 'All supported formats|' + FIU_GetFullExtList;
for fif := FIF_START to FIF_END do
if FreeImage_FIFSupportsReading(fif) then
begin
Result := Result + '|' + FIU_GetFIFFilter(fif)
end;
end;
function FIU_GetAllSaveFilters: AnsiString;
var
ExtList: AnsiString;
I: Smallint;
C: AnsiChar;
fif: FREE_IMAGE_FORMAT;
s: AnsiString;
begin
result := '';
for fif := FIF_START to FIF_END do
if FreeImage_FIFSupportsWriting(fif) then
begin
ExtList := FreeImage_GetFIFExtensionList(fif);
s := '';
for I := 1 to Length(ExtList) do
begin
C := ExtList[i];
if C <> ',' then
S := S + C
else
begin
result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|';
s := '';
end;
end;
result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|';
end;
end;
end.

View File

@@ -0,0 +1,186 @@
// ==========================================================
// Delphi wrapper for FreeImage 3
//
// Design and implementation by
// - Simon Beavis
// - Peter Bystr<74>m
// - Anatoliy Pulyaevskiy (xvel84@rambler.ru)
//
// Contributors:
// - Lorenzo Monti (LM) lomo74@gmail.com
//
// Revision history
// When Who What
// ----------- ----- -----------------------------------------------------------
// 2010-07-29 LM Added Free Pascal / Lazarus 32 bit support
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
//some older Delphi version will define WIN32 but not MSWINDOWS
{$IFNDEF MSWINDOWS}
{$IFDEF WIN32}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
//test for compiler
{$IFDEF FPC}
//Free pascal
{$IFNDEF CPU32}
{$ERROR "64 bit platforms not tested yet. Remove this line if you feel brave."}
{$ENDIF}
{$IFNDEF ENDIAN_LITTLE}
{$ERROR "Big endian CPUs not tested yet. Remove this line if you feel brave."}
{$ENDIF}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$ELSE}
//Delphi
{$IFDEF VER80}
{$DEFINE DELPHI1}
{$ENDIF}
{$IFDEF VER90}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$ENDIF}
{$IFDEF VER100}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$ENDIF}
{$IFDEF VER120}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$ENDIF}
{$IFDEF VER130}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$ENDIF}
{$IFDEF VER140}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$ENDIF}
{$IFDEF VER150}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$ENDIF}
{$IFDEF VER160}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$ENDIF}
{$IFDEF VER170}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI2005}
{$ENDIF}
{$IFDEF VER180}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI2005}
{$DEFINE DELPHI2006}
{$ENDIF}
{$IFDEF VER185}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI2005}
{$DEFINE DELPHI2006}
{$DEFINE DELPHI2007}
{$ENDIF}
{$IFDEF VER200}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI2005}
{$DEFINE DELPHI2006}
{$DEFINE DELPHI2007}
{$DEFINE DELPHI2009}
{$ENDIF}
{$IFDEF VER210}
{$DEFINE DELPHI1}
{$DEFINE DELPHI2}
{$DEFINE DELPHI3}
{$DEFINE DELPHI4}
{$DEFINE DELPHI5}
{$DEFINE DELPHI6}
{$DEFINE DELPHI7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI2005}
{$DEFINE DELPHI2006}
{$DEFINE DELPHI2007}
{$DEFINE DELPHI2009}
{$DEFINE DELPHI2010}
{$ENDIF}
{$ENDIF}

View File

@@ -0,0 +1,58 @@
#include "stdafx.h"
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("")];
[assembly:AssemblyCopyrightAttribute("")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project directory.
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly:AssemblyDelaySignAttribute(false)];
[assembly:AssemblyKeyFileAttribute("")];
[assembly:AssemblyKeyNameAttribute("")];

View File

@@ -0,0 +1,69 @@
// ==========================================================
// FreeImageIO.Net
//
// Design and implementation by
// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
#include "stdafx.h"
#include "FreeImageIO.Net.h"
extern "C" static unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle)
{
int total_read = 0;
struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle;
gcroot<unsigned char __gc []> mbuffer = new unsigned char __gc[size];
try
{
total_read = puh->_stream->Read(mbuffer,0,size);
Marshal::Copy(mbuffer,0,buffer,total_read);
} __finally {
mbuffer=NULL;
}
return (unsigned)total_read;
}
extern "C" static unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle)
{
struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle;
gcroot<unsigned char __gc []> mbuffer = new unsigned char __gc[size*count];
try
{
unsigned char __pin* pbuffer = &mbuffer[0];
memcpy(pbuffer,buffer,size*count);
puh->_stream->Write(mbuffer,0,size);
} __finally {
mbuffer=NULL;
}
return count;
}
extern "C" static int __stdcall SeekProc (fi_handle handle, long offset, int origin)
{
struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle;
return (int)puh->_stream->Seek(offset,(SeekOrigin) origin);
}
extern "C" static long __stdcall TellProc(fi_handle handle)
{
struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle;
return (long)puh->_stream->Position;
}

View File

@@ -0,0 +1,83 @@
// ==========================================================
// FreeImageIO.Net
//
// Design and implementation by
// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
#pragma once
#include <vcclr.h>
#include "FreeImage.h"
using namespace System;
using namespace System::IO;
using namespace System::Runtime::InteropServices;
extern "C" {
// forward decls
unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle);
unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle);
int __stdcall SeekProc (fi_handle handle, long offset, int origin);
long __stdcall TellProc(fi_handle handle);
#pragma pack(push, 1)
__nogc struct UNMANAGED_HANDLER {
UNMANAGED_HANDLER() {
read_proc = &ReadProc;
write_proc = WriteProc;
seek_proc = SeekProc;
tell_proc = TellProc;
}
FI_ReadProc read_proc; // pointer to the function used to read data
FI_WriteProc write_proc; // pointer to the function used to write data
FI_SeekProc seek_proc; // pointer to the function used to seek
FI_TellProc tell_proc; // pointer to the function used to aquire the current position
gcroot<System::IO::Stream*> _stream;
};
#pragma pack(pop)
}
#define FREEIMAGE_DLL "freeimaged.dll"
namespace FreeImageIODotNet
{
__gc public class FreeImageStream
{
private:
struct UNMANAGED_HANDLER* _pUnmanaged;
public:
FreeImageStream(System::IO::Stream* stream)
{
FreeImage_SaveToHandle((FREE_IMAGE_FORMAT) 1,0,0,0,0);
_pUnmanaged = new struct UNMANAGED_HANDLER;
_pUnmanaged->_stream = stream;
}
~FreeImageStream()
{
_pUnmanaged->_stream = NULL;
delete _pUnmanaged;
}
bool SaveImage(FREE_IMAGE_FORMAT fif, unsigned int dib, int flags) {
return (bool)FreeImage_SaveToHandle(fif,(FIBITMAP*) dib,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags);
}
unsigned int LoadImage(FREE_IMAGE_FORMAT fif, int flags) {
return (unsigned int)FreeImage_LoadFromHandle(fif,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags);
}
};
}

View File

@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="FreeImageIO.Net"
ProjectGUID="{E87923FF-1FBD-450D-9287-539A90DE9776}"
RootNamespace="FreeImageIONet"
Keyword="ManagedCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="TRUE">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/Zl"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
WarningLevel="3"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/noentry"
AdditionalDependencies="nochkclr.obj mscoree.lib msvcrt.lib FreeImaged.lib"
OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
AssemblyDebug="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="TRUE">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/Zl"
PreprocessorDefinitions="WIN32;NDEBUG"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
UsePrecompiledHeader="3"
WarningLevel="3"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/noentry"
AdditionalDependencies="nochkclr.obj mscoree.lib msvcrt.lib FreeImage.lib"
OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="1"
GenerateDebugInformation="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="mscorlib.dll"/>
<AssemblyReference
RelativePath="System.dll"/>
<AssemblyReference
RelativePath="System.Data.dll"/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\AssemblyInfo.cpp">
</File>
<File
RelativePath=".\FreeImageIO.Net.cpp">
</File>
<File
RelativePath=".\Stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\FreeImageIO.Net.h">
</File>
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath=".\Stdafx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\app.ico">
</File>
<File
RelativePath=".\app.rc">
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageIO.Net", "FreeImageIO.Net.vcproj", "{E87923FF-1FBD-450D-9287-539A90DE9776}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.ActiveCfg = Debug|Win32
{E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.Build.0 = Debug|Win32
{E87923FF-1FBD-450D-9287-539A90DE9776}.Release.ActiveCfg = Release|Win32
{E87923FF-1FBD-450D-9287-539A90DE9776}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,27 @@
========================================================================
FreeImageIO.Net
Author: Marcos Pernambuco Motta (marcos.pernambuco@gmail.com)
========================================================================
This library allows programs that use FreeImage.Net to save images to or
to load images from .Net Streams.
The class FreeImageStream implements a FreeImageIO handler and routes
IO calls (read,write,tell and seek) to a wrapped System.IO.Stream.
Example:
using FreeImageAPI;
using FreeImageIODotNet;
uint dib = FreeImageAPI.FreeImage.Allocate(width,height,32,0,0,0);
// ... Image handling code goes here
System.IO.FileStream stream = new System.IO.FileStream(@"c:\sample.png",System.IO.FileMode.Create);
FreeImageStream imageStream = new FreeImageStream(stream);
imageStream.SaveImage((int)FREE_IMAGE_FORMAT.FIF_PNG,dib,0);
stream.Close();
Compile with VS2003.

View File

@@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// FreeImageIO.Net.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,6 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,52 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon placed first or with lowest ID value becomes application icon
LANGUAGE 9, 1
#pragma code_page(1252)
1 ICON "app.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,3 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
FreeImage .NET Wrapper Release Notes
The FreeImage .NET Wrapper included in the 3.14.1 release is still on version 3.13.1. It does not yet contain any new features or bug fixes. However, it is expected to work with the new FreeImage DLL with no problems.
The next version of FreeImage is expected to be released soon and will contain an updated .NET wrapper, including support for all new features, that have been introduced in this and the next version of FreeImage.
Regards, FreeImage .NET Wrapper Team

View File

@@ -0,0 +1,179 @@
using System;
using System.IO;
using FreeImageAPI;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
namespace Sample01
{
class Program
{
static void Main(string[] args)
{
// Check if FreeImage.dll is available (can be in %path%).
if (!FreeImage.IsAvailable())
{
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
return;
}
Sample sample = new Sample();
// This example shows the basic loading and saving operations offered by FreeImage.
sample.Example01();
// This example shows a more comfortable way offered by the .NET Wrapper.
sample.Example02();
// This example shows the FreeImage-Errormessage-Callback
sample.Example03();
}
}
public class Sample
{
const string fileName = @"Sample.jpg";
const string outFileName = @"Sample.tif";
FIBITMAP dib = new FIBITMAP();
string message = null;
public void Example01()
{
if (!File.Exists(fileName))
{
Console.WriteLine(fileName + " does not exist. Aborting.");
return;
}
// Try to unload the bitmap handle (in case it is not null).
// Always assert that a handle (like dib) is unloaded before it is reused, because
// on unmanaged side there is no garbage collector that will clean up unreferenced
// objects.
// The following code will produce a memory leak (in case the bitmap is loaded
// successfully) because the handle to the first bitmap is lost:
// dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE);
// dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE);
if (!dib.IsNull)
FreeImage.Unload(dib);
// Loading a sample bitmap. In this case it's a .jpg file. 'Load' requires the file
// format or the loading process will fail. An additional flag (the default value is
// 'DEFAULT') can be set to enable special loading options.
dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE);
// Check if the handle is null which means the bitmap could not be loaded.
if (dib.IsNull)
{
Console.WriteLine("Loading bitmap failed. Aborting.");
// Check whether there was an error message.
return;
}
// Try flipping the bitmap.
if (!FreeImage.FlipHorizontal(dib))
{
Console.WriteLine("Unable to flip bitmap.");
// Check whether there was an error message.
}
// Store the bitmap back to disk. Again the desired format is needed. In this case the format is 'TIFF'.
// An output filename has to be chosen (which will be overwritten without a warning).
// A flag can be provided to enable pluginfunctions (compression is this case).
FreeImage.Save(FREE_IMAGE_FORMAT.FIF_TIFF, dib, outFileName, FREE_IMAGE_SAVE_FLAGS.TIFF_DEFLATE);
// The bitmap was saved to disk but is still allocated in memory, so the handle has to be freed.
if (!dib.IsNull)
FreeImage.Unload(dib);
// Make sure to set the handle to null so that it is clear that the handle is not pointing to a bitmap.
dib.SetNull();
}
public void Example02()
{
// 'UnloadEx' is a comfortable way of unloading a bitmap. The coder can call 'UnloadEx' even
// when the handle is pointing to null (in this case nothing will happen). In case the handle
// is valid (valid means that it is NOT pointing to null) the bitmap will be unloaded and the
// handle will be set to null manually.
FreeImage.UnloadEx(ref dib);
// 'LoadEx' is a comfortable way of loading a bitmap. 'LoadEx' tries to find out the format of
// the file and will use this to load it. It will use DEFAULT loading values.
dib = FreeImage.LoadEx(fileName);
// Check if the handle is null which means the bitmap could not be loaded.
if (dib.IsNull)
{
Console.WriteLine("Loading bitmap failed. Aborting.");
return;
}
// 'SaveEx' (like 'LoadEx') will try to save the bitmap with default values.
// Before saving the bitmap, 'SaveEx' checks whether the extension is valid for the file type
// and if the plugin can use the colordepth of the bitmap. If not it will automatically convert
// the bitmap into the next best colordepth and save it.
if (!FreeImage.SaveEx(ref dib, @"Sample.gif", false))
{
Console.WriteLine("Saving bitmap failed.");
}
// The handle is still valid.
if (!FreeImage.SaveEx(
ref dib,
@"Sample", // No extension was selected so let 'SaveEx' decide.
FREE_IMAGE_FORMAT.FIF_PNG, // A format is needed this time.
FREE_IMAGE_SAVE_FLAGS.DEFAULT, // PNG has no options so use default.
FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP, // 4bpp as result color depth.
true)) // We're done so unload
{
// SaveEx will not unload the bitmap in case saving failed.
// This way possible operations done to the bitmaps aren't lost.
FreeImage.UnloadEx(ref dib);
}
}
public void Example03()
{
// Safely unload to prevent memory leak.
FreeImage.UnloadEx(ref dib);
// Load the example bitmap.
dib = FreeImage.LoadEx(fileName);
// Check whether loading succeeded.
if (dib.IsNull)
{
return;
}
// Add this class to the callback event.
FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message);
// Try to save the bitmap as a gif
if (!FreeImage.Save(FREE_IMAGE_FORMAT.FIF_GIF, dib, @"Sample_fail.gif", FREE_IMAGE_SAVE_FLAGS.DEFAULT))
{
// Saving failed
// Check whether there was an error callback
if (message != null)
{
// Print the message and delete it.
Console.WriteLine("Error message recieved: {0}", message);
message = null;
}
}
// Unload bitmap.
FreeImage.UnloadEx(ref dib);
// Remove this class from the callback event.
FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message);
}
void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
{
this.message = message;
}
}
}

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("ac0569fe-c021-4f40-bfe9-275baf0fd21a")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,103 @@
<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>{0D294AB6-FAD4-4364-AAB6-43C1796116A9}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample01</RootNamespace>
<AssemblyName>Sample01</AssemblyName>
<StartupObject>
</StartupObject>
</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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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

View File

@@ -0,0 +1,140 @@
using System;
using System.IO;
using FreeImageAPI;
namespace Sample02
{
class Program
{
static void Main(string[] args)
{
// Check if FreeImage.dll is available (can be in %path%).
if (!FreeImage.IsAvailable())
{
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
return;
}
Sample sample = new Sample();
sample.Example();
}
}
public class Sample
{
const string fileName = @"multipaged.tif";
FIMULTIBITMAP dib = new FIMULTIBITMAP();
Random rand = new Random();
public void Example()
{
if (!File.Exists(fileName))
{
Console.WriteLine("File not found. Aborting.");
return;
}
// Load the multipaged bitmap.
// 'OpenMultiBitmapEx' tries to find the correct file format, loads the bitmap
// with default options, with write support and does not use caching.
dib = FreeImage.OpenMultiBitmapEx(fileName);
// Check whether loading succeeded.
if (dib.IsNull)
{
Console.WriteLine("File could not be loaded. Aborting.");
return;
}
// Get the number of bitmaps the multipaged bitmap contains.
int count = FreeImage.GetPageCount(dib);
// Multipaged bitmaps consist of multiple single FIBITMAPs
FIBITMAP page = new FIBITMAP();
// There are bitmaps we can work with.
if (count > 0)
{
// Lock a random bitmap to work with.
page = FreeImage.LockPage(dib, rand.Next(0, count));
}
// Check whether locking succeeded.
if (page.IsNull)
{
// Locking failed. Unload the bitmap and return.
FreeImage.CloseMultiBitmapEx(ref dib);
return;
}
// Get a list of locked pages. This can be usefull to check whether a page has already been locked.
int[] lockedPages = FreeImage.GetLockedPages(dib);
// Lets modify the page.
if (FreeImage.AdjustGamma(page, 2d))
{
Console.WriteLine("Successfully changed gamma of page {0}.", lockedPages[0]);
}
else
{
Console.WriteLine("Failed to adjust gamma ...");
}
// Print out the list of locked pages
foreach (int i in lockedPages)
Console.WriteLine("Page {0} is locked.", i);
// Use 'UnlockPage' instead of 'Unload' to free the page. Set the third parameter to 'true'
// so that FreeImage can store the changed page within the multipaged bitmap.
FreeImage.UnlockPage(dib, page, true);
// Retieve the list again to see whether unlocking succeeded.
lockedPages = FreeImage.GetLockedPages(dib);
// No output should be produced here.
foreach (int i in lockedPages)
Console.WriteLine("Page {0} is still locked.", i);
// If there are more than one page we can swap them
if (count > 1)
{
if (!FreeImage.MovePage(dib, 1, 0))
{
Console.WriteLine("Swapping pages failed.");
}
}
if (count > 2)
{
// Lock page 2
page = FreeImage.LockPage(dib, 2);
if (!page.IsNull)
{
// Clone the page for later appending
FIBITMAP temp = FreeImage.Clone(page);
// Unlock the page again
FreeImage.UnlockPage(dib, page, false);
// Delete the page form the multipaged bitmap
FreeImage.DeletePage(dib, 2);
// Append the clone again
FreeImage.AppendPage(dib, temp);
// Check whether the number of pages is still the same
Console.WriteLine("Pages before: {0}. Pages after: {1}", count, FreeImage.GetPageCount(dib));
// Unload clone to prevent memory leak
FreeImage.UnloadEx(ref temp);
}
}
// We are done and close the multipaged bitmap.
if (!FreeImage.CloseMultiBitmapEx(ref dib))
{
Console.WriteLine("Closing bitmap failed!");
}
}
}
}

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("35960522-c01a-40d2-a86b-37b9839b131c")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,95 @@
<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>{AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample02</RootNamespace>
<AssemblyName>Sample02</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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="multipaged.tif">
<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>

View File

@@ -0,0 +1,74 @@
using System;
using System.IO;
using FreeImageAPI;
namespace Sample03
{
class Program
{
static void Main(string[] args)
{
// Check if FreeImage.dll is available (can be in %path%).
if (!FreeImage.IsAvailable())
{
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
return;
}
// Add this class to the message event
FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message);
Sample sample = new Sample();
sample.Example();
// Remove this class from the message event
FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message);
}
static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
{
Console.WriteLine("Error for {0}: {1}", fif.ToString(), message);
}
}
public class Sample
{
FIBITMAP dib = new FIBITMAP();
public void Example()
{
// Allocating a new bitmap with 99x99 pixels, 16-bit color depth and an allocation of 5 bits for each color.
dib = FreeImage.Allocate(99, 99, 16, FreeImage.FI16_555_RED_MASK, FreeImage.FI16_555_GREEN_MASK, FreeImage.FI16_555_BLUE_MASK);
// Saving bitmap.
if (!FreeImage.SaveEx(ref dib, "example01.bmp", true))
{
Console.WriteLine("Saving 'example.bmp' failed.");
FreeImage.UnloadEx(ref dib);
}
// Allocation a new bitmap with 71x33 pixels, 4-bit color depth. Bitmaps below 16-bit have paletts.
// Each pixel references an index within the palette wich contains the true color.
// Therefor no bit-masks are needed and can be set to 0.
dib = FreeImage.Allocate(71, 33, 4, 0, 0, 0);
// Saving bitmap.
if (!FreeImage.SaveEx(ref dib, "example02.tif", true))
{
Console.WriteLine("Saving 'example02.tif' failed.");
FreeImage.UnloadEx(ref dib);
}
// Allocation a new bitmap. This time 'AllocateT' is used because 'Allocate' can only create standard bitmaps.
// In this case a RGBF bitmap is created. Red, green and blue are represented by a float-value so no bit-masks are needed.
dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_RGBF, 50, 75, 9, 0, 0, 0);
// Saving bitmap.
if (!FreeImage.SaveEx(ref dib, "example03.hdr", true))
{
Console.WriteLine("Saving 'example03.hdr' failed.");
FreeImage.UnloadEx(ref dib);
}
}
}
}

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("7139f1dc-3312-4c76-aeb3-891f869409b3")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,89 @@
<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>{A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample03</RootNamespace>
<AssemblyName>Sample03</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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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>

View File

@@ -0,0 +1,205 @@
namespace Sample04
{
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.ofd = new System.Windows.Forms.OpenFileDialog();
this.bOpenFile = new System.Windows.Forms.Button();
this.lWidth = new System.Windows.Forms.Label();
this.lHeight = new System.Windows.Forms.Label();
this.lBPP = new System.Windows.Forms.Label();
this.lRedMask = new System.Windows.Forms.Label();
this.lGreenMask = new System.Windows.Forms.Label();
this.lBlueMask = new System.Windows.Forms.Label();
this.lImageType = new System.Windows.Forms.Label();
this.lDPIY = new System.Windows.Forms.Label();
this.lDPIX = new System.Windows.Forms.Label();
this.lFormat = new System.Windows.Forms.Label();
this.lHeader = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// ofd
//
this.ofd.Filter = "All files (*.*)|*.*";
//
// bOpenFile
//
this.bOpenFile.Location = new System.Drawing.Point(12, 358);
this.bOpenFile.Name = "bOpenFile";
this.bOpenFile.Size = new System.Drawing.Size(75, 23);
this.bOpenFile.TabIndex = 4;
this.bOpenFile.Text = "Open file";
this.bOpenFile.UseVisualStyleBackColor = true;
this.bOpenFile.Click += new System.EventHandler(this.bOpenFile_Click);
//
// lWidth
//
this.lWidth.AutoSize = true;
this.lWidth.Location = new System.Drawing.Point(9, 51);
this.lWidth.Name = "lWidth";
this.lWidth.Size = new System.Drawing.Size(46, 16);
this.lWidth.TabIndex = 0;
this.lWidth.Text = "Width:";
//
// lHeight
//
this.lHeight.AutoSize = true;
this.lHeight.Location = new System.Drawing.Point(9, 76);
this.lHeight.Name = "lHeight";
this.lHeight.Size = new System.Drawing.Size(53, 16);
this.lHeight.TabIndex = 1;
this.lHeight.Text = "Height: ";
//
// lBPP
//
this.lBPP.AutoSize = true;
this.lBPP.Location = new System.Drawing.Point(9, 101);
this.lBPP.Name = "lBPP";
this.lBPP.Size = new System.Drawing.Size(80, 16);
this.lBPP.TabIndex = 2;
this.lBPP.Text = "Color Depth:";
//
// lRedMask
//
this.lRedMask.AutoSize = true;
this.lRedMask.Location = new System.Drawing.Point(9, 129);
this.lRedMask.Name = "lRedMask";
this.lRedMask.Size = new System.Drawing.Size(68, 16);
this.lRedMask.TabIndex = 3;
this.lRedMask.Text = "Red Mask:";
//
// lGreenMask
//
this.lGreenMask.AutoSize = true;
this.lGreenMask.Location = new System.Drawing.Point(9, 188);
this.lGreenMask.Name = "lGreenMask";
this.lGreenMask.Size = new System.Drawing.Size(80, 16);
this.lGreenMask.TabIndex = 5;
this.lGreenMask.Text = "Green Mask:";
//
// lBlueMask
//
this.lBlueMask.AutoSize = true;
this.lBlueMask.Location = new System.Drawing.Point(9, 158);
this.lBlueMask.Name = "lBlueMask";
this.lBlueMask.Size = new System.Drawing.Size(70, 16);
this.lBlueMask.TabIndex = 6;
this.lBlueMask.Text = "Blue Mask:";
//
// lImageType
//
this.lImageType.AutoSize = true;
this.lImageType.Location = new System.Drawing.Point(9, 215);
this.lImageType.Name = "lImageType";
this.lImageType.Size = new System.Drawing.Size(81, 16);
this.lImageType.TabIndex = 7;
this.lImageType.Text = "Image Type:";
//
// lDPIY
//
this.lDPIY.AutoSize = true;
this.lDPIY.Location = new System.Drawing.Point(9, 244);
this.lDPIY.Name = "lDPIY";
this.lDPIY.Size = new System.Drawing.Size(43, 16);
this.lDPIY.TabIndex = 8;
this.lDPIY.Text = "DPI Y:";
//
// lDPIX
//
this.lDPIX.AutoSize = true;
this.lDPIX.Location = new System.Drawing.Point(9, 273);
this.lDPIX.Name = "lDPIX";
this.lDPIX.Size = new System.Drawing.Size(44, 16);
this.lDPIX.TabIndex = 9;
this.lDPIX.Text = "DPI X:";
//
// lFormat
//
this.lFormat.AutoSize = true;
this.lFormat.Location = new System.Drawing.Point(9, 302);
this.lFormat.Name = "lFormat";
this.lFormat.Size = new System.Drawing.Size(78, 16);
this.lFormat.TabIndex = 10;
this.lFormat.Text = "File Format:";
//
// lHeader
//
this.lHeader.AutoSize = true;
this.lHeader.Location = new System.Drawing.Point(117, 19);
this.lHeader.Name = "lHeader";
this.lHeader.Size = new System.Drawing.Size(162, 16);
this.lHeader.TabIndex = 11;
this.lHeader.Text = "Bitmap-Information Viewer";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(400, 393);
this.Controls.Add(this.lHeader);
this.Controls.Add(this.lFormat);
this.Controls.Add(this.lDPIX);
this.Controls.Add(this.lDPIY);
this.Controls.Add(this.lImageType);
this.Controls.Add(this.lBlueMask);
this.Controls.Add(this.lGreenMask);
this.Controls.Add(this.bOpenFile);
this.Controls.Add(this.lRedMask);
this.Controls.Add(this.lBPP);
this.Controls.Add(this.lHeight);
this.Controls.Add(this.lWidth);
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 = "Sample04";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.Button bOpenFile;
private System.Windows.Forms.Label lWidth;
private System.Windows.Forms.Label lHeight;
private System.Windows.Forms.Label lBPP;
private System.Windows.Forms.Label lRedMask;
private System.Windows.Forms.Label lGreenMask;
private System.Windows.Forms.Label lBlueMask;
private System.Windows.Forms.Label lImageType;
private System.Windows.Forms.Label lDPIY;
private System.Windows.Forms.Label lDPIX;
private System.Windows.Forms.Label lFormat;
private System.Windows.Forms.Label lHeader;
}
}

View File

@@ -0,0 +1,120 @@
using System;
using System.Windows.Forms;
using FreeImageAPI;
namespace Sample04
{
public partial class MainForm : Form
{
string message = null;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public MainForm()
{
InitializeComponent();
FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message);
}
~MainForm()
{
FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message);
}
void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
{
if (this.message == null)
{
this.message = message;
}
else
{
this.message += "\n" + message;
}
}
private void bOpenFile_Click(object sender, EventArgs e)
{
// Resetting filename
ofd.FileName = "";
// Was a file selected
if (ofd.ShowDialog() == DialogResult.OK)
{
// Format is stored in 'format' on successfull load.
FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN;
// Try loading the file
FIBITMAP dib = FreeImage.LoadEx(ofd.FileName, ref format);
try
{
// Error handling
if (dib.IsNull)
{
// Chech whether FreeImage generated an error messe
if (message != null)
{
MessageBox.Show("File could not be loaded!\nError:{0}", message);
}
else
{
MessageBox.Show("File could not be loaded!", message);
}
return;
}
// Read width
lWidth.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib));
// Read height
lHeight.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib));
// Read color depth
lBPP.Text = String.Format("Color Depth: {0}", FreeImage.GetBPP(dib));
// Read red bitmask (16 - 32 bpp)
lRedMask.Text = String.Format("Red Mask: 0x{0:X8}", FreeImage.GetRedMask(dib));
// Read green bitmask (16 - 32 bpp)
lBlueMask.Text = String.Format("Green Mask: 0x{0:X8}", FreeImage.GetGreenMask(dib));
// Read blue bitmask (16 - 32 bpp)
lGreenMask.Text = String.Format("Blue Mask: 0x{0:X8}", FreeImage.GetBlueMask(dib));
// Read image type (FI_BITMAP, FIT_RGB16, FIT_COMPLEX ect)
lImageType.Text = String.Format("Image Type: {0}", FreeImage.GetImageType(dib));
// Read x-axis dpi
lDPIX.Text = String.Format("DPI X: {0}", FreeImage.GetResolutionX(dib));
// Read y-axis dpi
lDPIY.Text = String.Format("DPI Y: {0}", FreeImage.GetResolutionY(dib));
// Read file format
lFormat.Text = String.Format("File Format: {0}", FreeImage.GetFormatFromFIF(format));
}
catch
{
}
// Always unload bitmap
FreeImage.UnloadEx(ref dib);
// Reset the error massage buffer
message = null;
}
// No file was selected
else
{
MessageBox.Show("No file loaded.", "Error");
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</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("7c8fdc9a-a8f9-4996-99c8-9df47513edeb")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,102 @@
<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>{1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample04</RootNamespace>
<AssemblyName>Sample04</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>
<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>

View File

@@ -0,0 +1,213 @@
using System;
using FreeImageAPI;
using System.Drawing;
namespace Sample05
{
class Program
{
static void Main(string[] args)
{
// Check if FreeImage.dll is available (can be in %path%).
if (!FreeImage.IsAvailable())
{
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
return;
}
Sample sample = new Sample();
// The example will flip the bitmap by manually accessing the
// bitmaps scanlines and swapping them
sample.Example01();
// The example will access each pixel of the bitmap manually
// and change its color intensity to 3/4 of the original value
// which will have a darker bitmap as result.
sample.Example02();
// The example will access and swap the bitmaps palette from
// 'FIC_MINISBLACK' to 'FIC_MINISWHITE'. Then it will swap each pixels
// palette index so that each pixel is assigned to the its old value
// so that the bitmaps "pixeldata" stays the same.
sample.Example03();
}
}
public class Sample
{
FIBITMAP dib = new FIBITMAP();
public void Example01()
{
// Load sample file
dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE);
// Check whether loading succeeded
if (dib.IsNull)
{
Console.WriteLine("Sample.jpg could not be loaded. Aborting.");
return;
}
// Check whether the bitmap has 24 bpp color depth to ensure
// using RGBTRIPPLE is correct.
if (FreeImage.GetBPP(dib) != 24)
{
Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting.");
FreeImage.UnloadEx(ref dib);
return;
}
// Store height of the bitmap
int height = (int)FreeImage.GetHeight(dib);
// Iterate over half of the bitmaps scanlines and swap
// line[1] with line[height], line[2] with line[height-1] etc which will
// flip the image.
for (int i = 0; i < (height / 2); i++)
{
// Get scanline from the bottom part of the bitmap
Scanline<RGBTRIPLE> scanlineBottom = new Scanline<RGBTRIPLE>(dib, i);
// Get scanline from the top part of the bitmap
Scanline<RGBTRIPLE> scanlineTop = new Scanline<RGBTRIPLE>(dib, height - 1 - i);
// Get arrays of RGBTRIPPLEs that contain the bitmaps real pixel data
// of the two scanlines.
RGBTRIPLE[] rgbtBottom = scanlineBottom.Data;
RGBTRIPLE[] rgbtTop = scanlineTop.Data;
// Restore the scanline across to switch the bitmaps lines.
scanlineBottom.Data = rgbtTop;
scanlineTop.Data = rgbtBottom;
}
// Store the bitmap to disk
if (!FreeImage.SaveEx(ref dib, "SampleOut01.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true))
{
Console.WriteLine("Error while saving 'SampleOut01.jpg'");
FreeImage.UnloadEx(ref dib);
}
}
public void Example02()
{
dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE);
// Check whether loading succeeded
if (dib.IsNull)
{
Console.WriteLine("Sample.jpg could not be loaded. Aborting.");
return;
}
// Check whether the bitmap has 24 bpp color depth to ensure
// using RGBTRIPPLE is correct.
if (FreeImage.GetBPP(dib) != 24)
{
Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting.");
FreeImage.UnloadEx(ref dib);
return;
}
// Iterate over all scanlines
for (int i = 0; i < FreeImage.GetHeight(dib); i++)
{
// Get scanline
Scanline<RGBTRIPLE> scanline = new Scanline<RGBTRIPLE>(dib, i);
// Get pixeldata from scanline
RGBTRIPLE[] rgbt = scanline.Data;
// Iterate over each pixel reducing the colors intensity to 3/4 which
// will darken the bitmap.
for (int j = 0; j < rgbt.Length; j++)
{
rgbt[j].rgbtBlue = (byte)((int)rgbt[j].rgbtBlue * 3 / 4);
rgbt[j].rgbtGreen = (byte)((int)rgbt[j].rgbtGreen * 3 / 4);
rgbt[j].rgbtRed = (byte)((int)rgbt[j].rgbtRed * 3 / 4);
// In case no direct access to the data is implemented
// the following way is equivalent:
//
// Color color = rgbt[j].color;
// rgbt[j].color = Color.FromArgb(color.R * 3 / 4, color.G * 3 / 4, color.B * 3 / 4);
}
// Write the darkened scanline back to memory
scanline.Data = rgbt;
}
// Store the bitmap to disk
if (!FreeImage.SaveEx(ref dib, "SampleOut02.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true))
{
Console.WriteLine("Error while saving 'SampleOut02.jpg'");
FreeImage.UnloadEx(ref dib);
}
}
public void Example03()
{
dib = FreeImage.LoadEx("Sample.tif");
// Check whether loading succeeded
if (dib.IsNull)
{
Console.WriteLine("Sample.tif could not be loaded. Aborting.");
return;
}
// Check whether the bitmap has 4 bpp color depth to ensure
// using FI4B is correct.
if (FreeImage.GetBPP(dib) != 4)
{
Console.WriteLine("Sample.tif is no 4 bpp bitmap. Aborting.");
FreeImage.UnloadEx(ref dib);
return;
}
// Get the bitmaps palette
Palette palette = FreeImage.GetPaletteEx(dib);
int size = (int)palette.Length;
// Check whether the palette has a color (is valid)
if (size == 0)
{
Console.WriteLine("Sample.tif has no valid palette. Aborting.");
FreeImage.UnloadEx(ref dib);
return;
}
// Swapping the palette
for (int i = 0; i < size / 2; i++)
{
RGBQUAD temp = palette[i];
palette[i] = palette[size - 1 - i];
palette[size - 1 - i] = temp;
}
// Iterate over each scanline
for (int i = 0; i < FreeImage.GetHeight(dib); i++)
{
// Get scanline
Scanline<FI4BIT> scanline = new Scanline<FI4BIT>(dib, i);
// Iterate over all pixels swapping the palette index
// so that the color will stay the same
for (int j = 0; j < scanline.Length; j++)
{
scanline[j] = (byte)(size - 1 - scanline[j]);
}
}
// Save the bitmap to disk
if (!FreeImage.SaveEx(ref dib, "SampleOut03.tif", FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, true))
{
Console.WriteLine("Error while saving 'SampleOut03.tif'");
FreeImage.UnloadEx(ref dib);
}
}
}
}

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("fd43331d-5ea4-40f8-86d5-8f820d606912")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,98 @@
<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>{A501F134-8FB6-460B-AFE9-884A696C1C07}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample05</RootNamespace>
<AssemblyName>Sample05</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>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<None Include="Sample.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Sample.tif">
<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: 22 KiB

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

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using FreeImageAPI;
namespace Sample07
{
class Program
{
static void Main(string[] args)
{
// Check if FreeImage.dll is available (can be in %path%).
if (!FreeImage.IsAvailable())
{
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
return;
}
Sample sample = new Sample();
// This example shows how to work with ICC-Profiles.
sample.Example();
}
}
public class Sample
{
public void Example()
{
// Load the sample bitmap.
FIBITMAP dib = FreeImage.LoadEx("Sample.jpg");
// Check success
if (dib.IsNull)
{
Console.WriteLine("Sample.jpg could not be loaded. Aborting.");
return;
}
// Get the bitmaps ICC-Profile.
FIICCPROFILE icc = FreeImage.GetICCProfileEx(dib);
// Print the profiles address.
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
// Print the profiles size
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
// Create data for a new profile.
byte[] data = new byte[256];
for (int i = 0; i < data.Length; i++)
data[i] = (byte)i;
// Create the new profile
icc = new FIICCPROFILE(dib, data);
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
// Create the new profile but only use the first 64 bytes
icc = new FIICCPROFILE(dib, data, 64);
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
// CreateICCProfileEx(...) does the same as above
icc = FreeImage.CreateICCProfileEx(dib, data, 16);
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
FreeImage.UnloadEx(ref dib);
}
}
}

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("c9991d1d-684a-4736-b088-369a216b35b6")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,94 @@
<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>{3B1BB976-64A7-41FD-B7E2-59104161AF7E}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample07</RootNamespace>
<AssemblyName>Sample07</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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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: 44 KiB

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("dc891ffc-ab5c-451f-97da-2c0d5d90edcc")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,108 @@
<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>{491042DB-495B-420C-A3BE-5D13019707C5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample08</RootNamespace>
<AssemblyName>Sample08</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="Properties\AssemblyInfo.cs" />
<Compile Include="SampleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SampleForm.Designer.cs">
<DependentUpon>SampleForm.cs</DependentUpon>
</Compile>
<Compile Include="SerializationPlugin.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Sample.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SampleForm.resx">
<DependentUpon>SampleForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</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

View File

@@ -0,0 +1,119 @@
namespace Sample08
{
partial class SampleForm
{
/// <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.pictureBox = new System.Windows.Forms.PictureBox();
this.bLoad = new System.Windows.Forms.Button();
this.SaveToSer = new System.Windows.Forms.Button();
this.LoadSerBitmap = new System.Windows.Forms.Button();
this.bClearBitmap = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// pictureBox
//
this.pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox.Location = new System.Drawing.Point(12, 12);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(600, 400);
this.pictureBox.TabIndex = 0;
this.pictureBox.TabStop = false;
//
// bLoad
//
this.bLoad.Location = new System.Drawing.Point(12, 418);
this.bLoad.Name = "bLoad";
this.bLoad.Size = new System.Drawing.Size(98, 23);
this.bLoad.TabIndex = 1;
this.bLoad.Text = "Load any bitmap";
this.bLoad.UseVisualStyleBackColor = true;
this.bLoad.Click += new System.EventHandler(this.bLoad_Click);
//
// SaveToSer
//
this.SaveToSer.Location = new System.Drawing.Point(324, 418);
this.SaveToSer.Name = "SaveToSer";
this.SaveToSer.Size = new System.Drawing.Size(98, 23);
this.SaveToSer.TabIndex = 2;
this.SaveToSer.Text = "Save as .ser";
this.SaveToSer.UseVisualStyleBackColor = true;
this.SaveToSer.Click += new System.EventHandler(this.SaveToSer_Click);
//
// LoadSerBitmap
//
this.LoadSerBitmap.Location = new System.Drawing.Point(220, 418);
this.LoadSerBitmap.Name = "LoadSerBitmap";
this.LoadSerBitmap.Size = new System.Drawing.Size(98, 23);
this.LoadSerBitmap.TabIndex = 3;
this.LoadSerBitmap.Text = "Load .ser bitmap";
this.LoadSerBitmap.UseVisualStyleBackColor = true;
this.LoadSerBitmap.Click += new System.EventHandler(this.LoadSerBitmap_Click);
//
// bClearBitmap
//
this.bClearBitmap.Location = new System.Drawing.Point(116, 418);
this.bClearBitmap.Name = "bClearBitmap";
this.bClearBitmap.Size = new System.Drawing.Size(98, 23);
this.bClearBitmap.TabIndex = 4;
this.bClearBitmap.Text = "Clear screen";
this.bClearBitmap.UseVisualStyleBackColor = true;
this.bClearBitmap.Click += new System.EventHandler(this.bClearBitmap_Click);
//
// SampleForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(627, 448);
this.Controls.Add(this.bClearBitmap);
this.Controls.Add(this.LoadSerBitmap);
this.Controls.Add(this.SaveToSer);
this.Controls.Add(this.bLoad);
this.Controls.Add(this.pictureBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SampleForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sample 08";
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.Button bLoad;
private System.Windows.Forms.Button SaveToSer;
private System.Windows.Forms.Button LoadSerBitmap;
private System.Windows.Forms.Button bClearBitmap;
}
}

View File

@@ -0,0 +1,217 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FreeImageAPI;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace Sample08
{
public partial class SampleForm : Form
{
SerializationPlugin serialPlugin;
[STAThread]
static void Main()
{
// Check if FreeImage is available
if (!FreeImage.IsAvailable())
{
throw new Exception("FreeImage is not available!");
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SampleForm());
}
public SampleForm()
{
InitializeComponent();
FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message);
// Creating a new instance of the plugin will register it automatically.
serialPlugin = new SerializationPlugin();
}
void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
{
// Show the message
MessageBox.Show(String.Format("Format: {0}\nMessage: {1}", fif, message), "FreeImage Message");
}
private void bLoad_Click(object sender, EventArgs e)
{
// Create a new dialog instance
OpenFileDialog ofd = new OpenFileDialog();
try
{
// Apply settings
ofd.CheckPathExists = true;
ofd.CheckFileExists = true;
ofd.RestoreDirectory = true;
ofd.Filter = "All files (*.*)|*.*";
// Get filename
if (ofd.ShowDialog(this) == DialogResult.OK)
{
Bitmap bitmap = null;
try
{
// Try loading the selected file
// a ser-file will create an exception
bitmap = (Bitmap)Bitmap.FromFile(ofd.FileName);
}
catch
{
MessageBox.Show("Unable to load bitmap from file.", "Error");
return;
}
// Unload old bitmap
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
}
// Set new bitmap
pictureBox.Image = bitmap;
MessageBox.Show("Bitmap loaded successfully", "Success");
}
else
{
MessageBox.Show("Action aborted.");
}
}
finally
{
// Unload dialog
ofd.Dispose();
}
}
private void LoadSerBitmap_Click(object sender, EventArgs e)
{
// Creat a new dialog
OpenFileDialog ofd = new OpenFileDialog();
FIBITMAP dib = new FIBITMAP();
try
{
// Apply settings
ofd.CheckPathExists = true;
ofd.CheckFileExists = true;
ofd.RestoreDirectory = true;
ofd.Filter = "Serialized bitmap (*.ser)|*.ser";
// Get filename
if (ofd.ShowDialog() == DialogResult.OK)
{
// Try loading the file forcing the new format
dib = FreeImage.Load(serialPlugin.Format, ofd.FileName, FREE_IMAGE_LOAD_FLAGS.DEFAULT);
if (dib.IsNull)
{
MessageBox.Show("Loading bitmap failed", "Error");
return;
}
// Convert the loaded bitmap into a .NET bitmap
Bitmap bitmap = FreeImage.GetBitmap(dib);
if (bitmap == null)
{
MessageBox.Show("Converting bitmap failed.", "Error");
return;
}
// Unload the picturebox
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
}
// Apply the loaded bitmap
pictureBox.Image = bitmap;
MessageBox.Show("Bitmap loaded successfully", "Success");
}
else
{
MessageBox.Show("Action aborted.");
}
}
finally
{
// Unload bitmap
FreeImage.UnloadEx(ref dib);
// Unload dialog
ofd.Dispose();
}
}
private void SaveToSer_Click(object sender, EventArgs e)
{
// Create a new dialog
SaveFileDialog sfd = new SaveFileDialog();
FIBITMAP dib = new FIBITMAP();
try
{
// Check if the picture box contains a bitmap that can be saved.
if (pictureBox.Image == null)
{
MessageBox.Show("No bitmap loaded.", "Error");
return;
}
// Convert the picture-boxes bitmap into a FreeImage bitmap.
dib = FreeImage.CreateFromBitmap((Bitmap)pictureBox.Image);
if (dib.IsNull)
{
MessageBox.Show("Unable to convert bitmap to FIBITMAP.", "Error");
return;
}
// Apply settings
sfd.Filter = "Serialized bitmap (*.ser)|*.ser";
sfd.FileName = "Bitmap.ser";
sfd.OverwritePrompt = true;
sfd.RestoreDirectory = true;
// Get filename
if (sfd.ShowDialog() == DialogResult.OK)
{
// Save bitmap in the new format
if (FreeImage.SaveEx(dib, sfd.FileName, serialPlugin.Format))
MessageBox.Show("Bitmap saved successfully.", "Success");
else
MessageBox.Show("Saving bitmap failed.", "Failure");
}
else
{
MessageBox.Show("Action aborted.");
}
}
finally
{
// Unload bitmap
FreeImage.UnloadEx(ref dib);
// Unload dialog
sfd.Dispose();
}
}
private void bClearBitmap_Click(object sender, EventArgs e)
{
// Unload the picture-box
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
pictureBox.Image = null;
}
}
}
}

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,222 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.IO.Compression;
using FreeImageAPI;
using FreeImageAPI.IO;
using FreeImageAPI.Plugins;
namespace Sample08
{
public sealed class SerializationPlugin : LocalPlugin
{
// Header for the file
private byte[] header = new byte[] { 0xff, 0x12, 0x0f, 0xff, 0x01, 0x00 };
// Structure that will store all bitmap data.
[Serializable]
private struct SerialDib
{
public uint width;
public uint height;
public int pitch;
public uint bpp;
public uint red_mask;
public uint green_mask;
public uint blue_mask;
public byte[] data;
}
// Implementation of 'GetImplementedMethods()'
// All implemented methods are listed.
protected override LocalPlugin.MethodFlags GetImplementedMethods()
{
return
MethodFlags.DescriptionProc |
MethodFlags.SupportsExportBPPProc |
MethodFlags.SupportsExportTypeProc |
MethodFlags.SupportsICCProfilesProc |
MethodFlags.LoadProc |
MethodFlags.SaveProc |
MethodFlags.ValidateProc |
MethodFlags.ExtensionListProc;
}
// Returns a format string.
protected override string FormatProc()
{
return "Serialization";
}
// Returns a more specific description
protected override string DescriptionProc()
{
return "Serializes bitmaps for .NET";
}
// Returns whether a color depth is supported.
protected override bool SupportsExportBPPProc(int bpp)
{
return ((bpp == 1) ||
(bpp == 4) ||
(bpp == 8) ||
(bpp == 16) ||
(bpp == 24) ||
(bpp == 32));
}
// This plugin can only export standard bitmaps
protected override bool SupportsExportTypeProc(FREE_IMAGE_TYPE type)
{
return (type == FREE_IMAGE_TYPE.FIT_BITMAP);
}
// This plugin does not support icc profiles
protected override bool SupportsICCProfilesProc()
{
return false;
}
// The function reads the first bytes of the file and compares it
// with the predefined header.
protected override bool ValidateProc(ref FreeImageIO io, fi_handle handle)
{
for (int i = 0; i < header.Length; i++)
if (ReadByte(io, handle) != header[i])
return false;
return true;
}
// Loading function
protected override FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data)
{
// Check if the data has the correct format
if (!ValidateProc(ref io, handle))
{
// Create a free-image message
FreeImage.OutputMessageProc(format, "Invalid format.");
// return 0 (operation failed)
return FIBITMAP.Zero;
}
SerialDib sdib;
int read = 0;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
byte[] buffer = new byte[1024];
do
{
// Use the helper function 'Read' to read from the source
read = Read(io, handle, 1, 1024, ref buffer);
// Store the data in a temporary buffer
stream.Write(buffer, 0, read);
}
while (read != 0);
// Set the memory stream back to the beginning.
stream.Position = 0;
// Unzip the stream
GZipStream zipStream = new GZipStream(stream, CompressionMode.Decompress);
// Create a serializer
BinaryFormatter formatter = new BinaryFormatter();
// Deserialize the stream
sdib = (SerialDib)formatter.Deserialize(zipStream);
// Unload the stream
zipStream.Dispose();
// Use 'ConvertFromRawBits and the deserialized struct to recreate the bitmap
// In this case the marshaller is used to create the needed IntPtr to the data
// array.
FIBITMAP dib = FreeImage.ConvertFromRawBits(
Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0),
(int)sdib.width, (int)sdib.height, sdib.pitch, sdib.bpp,
sdib.red_mask, sdib.green_mask, sdib.blue_mask,
false);
// Unload the temporary stream
stream.Dispose();
// Return the created bitmap
return dib;
}
// Saving function
protected override bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data)
{
SerialDib sdib;
uint size = FreeImage.GetDIBSize(dib);
// Store all data needed to recreate the bitmap
sdib.width = FreeImage.GetWidth(dib);
sdib.height = FreeImage.GetHeight(dib);
sdib.pitch = (int)FreeImage.GetPitch(dib);
sdib.bpp = FreeImage.GetBPP(dib);
sdib.red_mask = FreeImage.GetRedMask(dib);
sdib.green_mask = FreeImage.GetGreenMask(dib);
sdib.blue_mask = FreeImage.GetBlueMask(dib);
sdib.data = new byte[size];
// Copy the bitmaps data into the structures byte-array
// The marshaller is used to create an IntPtr for using
// 'ConvertToRawBits'.
FreeImage.ConvertToRawBits(Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0),
dib, sdib.pitch, sdib.bpp,
sdib.red_mask, sdib.green_mask, sdib.blue_mask,
false);
// Use the healper function to write the header to the destination
if (Write(io, handle, (uint)header.Length, 1, ref header) != 1)
return false;
// Create a serializer
BinaryFormatter formatter = new BinaryFormatter();
// Create a temporary stream
MemoryStream stream = new MemoryStream();
// Create a compression stream
GZipStream zipStream = new GZipStream(stream, CompressionMode.Compress);
// Serialize the structure into the compression stream
formatter.Serialize(zipStream, sdib);
// Unload the compression stream
zipStream.Dispose();
// Get the result data
byte[] buffer = stream.GetBuffer();
// Use the healper function 'Write' to write the data to the destination
if (Write(io, handle, 1, (uint)buffer.Length, ref buffer) != buffer.Length)
{
// Unload the temporary stream
stream.Dispose();
return false;
}
// Unload the temporary stream
stream.Dispose();
return true;
}
// Return a list of supported file extensions (comma seperated)
protected override string ExtensionListProc()
{
return "ser";
}
// Implementation of 'ToString()'
public override string ToString()
{
return DescriptionProc();
}
}
}

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("7f29fbaa-d2b3-4011-b34f-5a109bc282af")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,103 @@
<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>{92A454B2-67EF-4B70-99C9-F22B83B6FBFF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample09</RootNamespace>
<AssemblyName>Sample09</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.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SampleForm.Designer.cs">
<DependentUpon>SampleForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SampleForm.resx">
<SubType>Designer</SubType>
<DependentUpon>SampleForm.cs</DependentUpon>
</EmbeddedResource>
</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>

View File

@@ -0,0 +1,115 @@
namespace Sample09
{
partial class SampleForm
{
/// <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.tbURL = new System.Windows.Forms.TextBox();
this.lUrl = new System.Windows.Forms.Label();
this.bLoadUrl = new System.Windows.Forms.Button();
this.bSave = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit();
this.SuspendLayout();
//
// picBox
//
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(536, 299);
this.picBox.TabIndex = 0;
this.picBox.TabStop = false;
//
// tbURL
//
this.tbURL.Location = new System.Drawing.Point(155, 317);
this.tbURL.Name = "tbURL";
this.tbURL.Size = new System.Drawing.Size(393, 20);
this.tbURL.TabIndex = 1;
this.tbURL.Text = "http://freeimage.sourceforge.net/images/logo.jpg";
//
// lUrl
//
this.lUrl.AutoSize = true;
this.lUrl.Location = new System.Drawing.Point(9, 320);
this.lUrl.Name = "lUrl";
this.lUrl.Size = new System.Drawing.Size(137, 13);
this.lUrl.TabIndex = 2;
this.lUrl.Text = "Enter the URL of an Image:";
//
// bLoadUrl
//
this.bLoadUrl.Location = new System.Drawing.Point(12, 344);
this.bLoadUrl.Name = "bLoadUrl";
this.bLoadUrl.Size = new System.Drawing.Size(75, 23);
this.bLoadUrl.TabIndex = 3;
this.bLoadUrl.Text = "Load URL";
this.bLoadUrl.UseVisualStyleBackColor = true;
this.bLoadUrl.Click += new System.EventHandler(this.bLoadUrl_Click);
//
// bSave
//
this.bSave.Location = new System.Drawing.Point(93, 344);
this.bSave.Name = "bSave";
this.bSave.Size = new System.Drawing.Size(75, 23);
this.bSave.TabIndex = 4;
this.bSave.Text = "Save to disk";
this.bSave.UseVisualStyleBackColor = true;
this.bSave.Click += new System.EventHandler(this.bSave_Click);
//
// SampleForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(560, 379);
this.Controls.Add(this.bSave);
this.Controls.Add(this.bLoadUrl);
this.Controls.Add(this.lUrl);
this.Controls.Add(this.tbURL);
this.Controls.Add(this.picBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SampleForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sample09";
((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox picBox;
private System.Windows.Forms.TextBox tbURL;
private System.Windows.Forms.Label lUrl;
private System.Windows.Forms.Button bLoadUrl;
private System.Windows.Forms.Button bSave;
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FreeImageAPI;
using System.Net;
using System.IO;
namespace Sample09
{
public partial class SampleForm : Form
{
[STAThread]
static void Main()
{
// Check if FreeImage is available
if (!FreeImage.IsAvailable())
{
throw new Exception("FreeImage is not available!");
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SampleForm());
}
public SampleForm()
{
InitializeComponent();
}
private void bLoadUrl_Click(object sender, EventArgs e)
{
// Verify url
if (String.IsNullOrEmpty(tbURL.Text))
{
MessageBox.Show("Please enter a valid URL.", "Error");
return;
}
FIBITMAP dib = new FIBITMAP();
Stream sourceStream = null;
try
{
// Build a stream to read from
WebRequest request = (WebRequest)HttpWebRequest.Create(tbURL.Text);
WebResponse response = request.GetResponse();
sourceStream = response.GetResponseStream();
if (sourceStream == null)
{
throw new Exception();
}
// Load the image from stream
dib = FreeImage.LoadFromStream(sourceStream);
// Check success
if (dib.IsNull)
{
throw new Exception();
}
// Convert the bitmap into a .NET bitmap
Bitmap bitmap = FreeImage.GetBitmap(dib);
if (bitmap == null)
{
throw new Exception();
}
// Show the bitmap
if (picBox.Image != null)
{
picBox.Image.Dispose();
}
picBox.Image = bitmap;
}
catch
{
// Error handling
MessageBox.Show("Error loading URL.", "Error");
}
finally
{
// Clean up memory
FreeImage.UnloadEx(ref dib);
if (sourceStream != null) sourceStream.Dispose();
}
}
private void bSave_Click(object sender, EventArgs e)
{
// Check if there is a loaded bitmap
if (picBox.Image == null)
{
MessageBox.Show("No image loaded.", "Error");
return;
}
SaveFileDialog sfd = null;
FileStream fStream = null;
FIBITMAP dib = new FIBITMAP();
try
{
sfd = new SaveFileDialog();
sfd.CreatePrompt = false;
sfd.FileName = "";
sfd.Filter = "TIF (*tif)|*.tif";
sfd.OverwritePrompt = true;
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == DialogResult.OK)
{
// Convert the .NET bitmap into a FreeImage-Bitmap
dib = FreeImage.CreateFromBitmap((Bitmap)picBox.Image);
if (dib.IsNull)
{
throw new Exception();
}
// Create a filestream to write to
fStream = new FileStream(sfd.FileName, FileMode.Create);
if (!FreeImage.SaveToStream(
ref dib,
fStream,
FREE_IMAGE_FORMAT.FIF_TIFF,
FREE_IMAGE_SAVE_FLAGS.TIFF_LZW,
FREE_IMAGE_COLOR_DEPTH.FICD_AUTO,
false))
{
throw new Exception();
}
MessageBox.Show("Image saved successfully.", "Success");
}
else
{
MessageBox.Show("Operation aborted.", "Aborted");
}
}
catch
{
MessageBox.Show("Error saving image.", "Error");
}
finally
{
// Clean up
if (sfd != null) sfd.Dispose();
if (fStream != null) fStream.Dispose();
FreeImage.UnloadEx(ref dib);
}
}
}
}

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,87 @@
namespace Sample10
{
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.bLoad = new System.Windows.Forms.Button();
this.bQuit = new System.Windows.Forms.Button();
this.tvMetadata = new System.Windows.Forms.TreeView();
this.SuspendLayout();
//
// bLoad
//
this.bLoad.Location = new System.Drawing.Point(12, 336);
this.bLoad.Name = "bLoad";
this.bLoad.Size = new System.Drawing.Size(75, 23);
this.bLoad.TabIndex = 0;
this.bLoad.Text = "Load Image";
this.bLoad.UseVisualStyleBackColor = true;
this.bLoad.Click += new System.EventHandler(this.bLoad_Click);
//
// bQuit
//
this.bQuit.Location = new System.Drawing.Point(328, 336);
this.bQuit.Name = "bQuit";
this.bQuit.Size = new System.Drawing.Size(75, 23);
this.bQuit.TabIndex = 1;
this.bQuit.Text = "Quit";
this.bQuit.UseVisualStyleBackColor = true;
this.bQuit.Click += new System.EventHandler(this.bQuit_Click);
//
// tvMetadata
//
this.tvMetadata.Location = new System.Drawing.Point(12, 12);
this.tvMetadata.Name = "tvMetadata";
this.tvMetadata.Size = new System.Drawing.Size(389, 318);
this.tvMetadata.TabIndex = 2;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(415, 371);
this.Controls.Add(this.tvMetadata);
this.Controls.Add(this.bQuit);
this.Controls.Add(this.bLoad);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button bLoad;
private System.Windows.Forms.Button bQuit;
private System.Windows.Forms.TreeView tvMetadata;
}
}

View File

@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using FreeImageAPI;
using FreeImageAPI.Metadata;
namespace Sample10
{
public partial class MainForm : Form
{
[STAThread]
static void Main()
{
// Check if FreeImage.dll is available
if (!FreeImage.IsAvailable())
{
MessageBox.Show("FreeImage is not available. Aborting.", "Error");
}
// Add this class to the FreeImage-Message-Callback
FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
{
// Display the data
MessageBox.Show(
String.Format("FreeImage-Message:\n{1}\nFormat:{0}", fif.ToString(), message),
"FreeImage-Message");
}
public MainForm()
{
InitializeComponent();
}
private void bQuit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void bLoad_Click(object sender, EventArgs e)
{
// Create variables
OpenFileDialog ofd = new OpenFileDialog();
FIBITMAP dib = new FIBITMAP();
try
{
// Apply settings
ofd.CheckFileExists = true;
ofd.CheckPathExists = true;
ofd.FileName = "";
ofd.Filter = "All files (*.*)|*.*";
ofd.Multiselect = false;
ofd.RestoreDirectory = true;
// Get image filename
if (ofd.ShowDialog() == DialogResult.OK)
{
// Load the image
dib = FreeImage.LoadEx(ofd.FileName);
// Check if image was loaded successfully
if (dib.IsNull) throw new Exception("Failed to load image.");
// Clear the treeview
tvMetadata.Nodes.Clear();
// Create a wrapper for all metadata the image contains
ImageMetadata iMetadata = new ImageMetadata(dib);
// Get each metadata model
foreach (MetadataModel metadataModel in iMetadata)
{
// Create a new node for each model
TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString());
// Get each metadata tag and create a subnode for it
foreach (MetadataTag metadataTag in metadataModel)
{
modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString());
}
}
}
else
{
MessageBox.Show("Operation aborted.", "Aborted");
}
}
// Display error message
catch (Exception ex)
{
while (ex.InnerException != null)
ex = ex.InnerException;
MessageBox.Show(ex.ToString(), "Exception caught");
}
// Clean up
finally
{
ofd.Dispose();
FreeImage.UnloadEx(ref dib);
}
}
}
}

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("e8da4fa8-cc15-4b0e-8c57-d55ceb771559")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,101 @@
<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>{55DCC37A-E56C-44D9-9C44-8DAB10CD3003}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample10</RootNamespace>
<AssemblyName>Sample10</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>
</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>
<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>
<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.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</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>
<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>

View File

@@ -0,0 +1,382 @@
namespace Sample11
{
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.pictureBox = new System.Windows.Forms.PictureBox();
this.bLoadImage = new System.Windows.Forms.Button();
this.bSaveImage = new System.Windows.Forms.Button();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.sfd = new System.Windows.Forms.SaveFileDialog();
this.lWidth = new System.Windows.Forms.Label();
this.lHeight = new System.Windows.Forms.Label();
this.lBpp = new System.Windows.Forms.Label();
this.lMetadataCount = new System.Windows.Forms.Label();
this.bGreyscale = new System.Windows.Forms.Button();
this.cbSelectFrame = new System.Windows.Forms.ComboBox();
this.lComment = new System.Windows.Forms.Label();
this.bAdjustGamma = new System.Windows.Forms.Button();
this.vGamma = new System.Windows.Forms.NumericUpDown();
this.bRedChannelOnly = new System.Windows.Forms.Button();
this.bBlueChannel = new System.Windows.Forms.Button();
this.bGreenChannel = new System.Windows.Forms.Button();
this.bAllChannels = new System.Windows.Forms.Button();
this.lSelectFrame = new System.Windows.Forms.Label();
this.lImageFormat = new System.Windows.Forms.Label();
this.bRotate = new System.Windows.Forms.Button();
this.vRotate = new System.Windows.Forms.TrackBar();
this.lRotate = new System.Windows.Forms.Label();
this.lColors = new System.Windows.Forms.Label();
this.nShowMetadata = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.vGamma)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.vRotate)).BeginInit();
this.SuspendLayout();
//
// pictureBox
//
this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox.Location = new System.Drawing.Point(14, 15);
this.pictureBox.Margin = new System.Windows.Forms.Padding(4);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(542, 395);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox.TabIndex = 0;
this.pictureBox.TabStop = false;
//
// bLoadImage
//
this.bLoadImage.Location = new System.Drawing.Point(564, 15);
this.bLoadImage.Margin = new System.Windows.Forms.Padding(4);
this.bLoadImage.Name = "bLoadImage";
this.bLoadImage.Size = new System.Drawing.Size(125, 28);
this.bLoadImage.TabIndex = 1;
this.bLoadImage.Text = "Load image";
this.bLoadImage.UseVisualStyleBackColor = true;
this.bLoadImage.Click += new System.EventHandler(this.bLoadImage_Click);
//
// bSaveImage
//
this.bSaveImage.Location = new System.Drawing.Point(564, 51);
this.bSaveImage.Margin = new System.Windows.Forms.Padding(4);
this.bSaveImage.Name = "bSaveImage";
this.bSaveImage.Size = new System.Drawing.Size(125, 28);
this.bSaveImage.TabIndex = 2;
this.bSaveImage.Text = "Save image";
this.bSaveImage.UseVisualStyleBackColor = true;
this.bSaveImage.Click += new System.EventHandler(this.bSaveImage_Click);
//
// ofd
//
this.ofd.AddExtension = false;
this.ofd.AutoUpgradeEnabled = false;
this.ofd.Filter = "All files|*.*";
this.ofd.RestoreDirectory = true;
this.ofd.SupportMultiDottedExtensions = true;
//
// sfd
//
this.sfd.AddExtension = false;
this.sfd.Filter = "All files|*.*";
this.sfd.RestoreDirectory = true;
this.sfd.SupportMultiDottedExtensions = true;
//
// lWidth
//
this.lWidth.AutoSize = true;
this.lWidth.Location = new System.Drawing.Point(563, 350);
this.lWidth.Name = "lWidth";
this.lWidth.Size = new System.Drawing.Size(57, 16);
this.lWidth.TabIndex = 6;
this.lWidth.Text = "Width: 0";
//
// lHeight
//
this.lHeight.AutoSize = true;
this.lHeight.Location = new System.Drawing.Point(649, 350);
this.lHeight.Name = "lHeight";
this.lHeight.Size = new System.Drawing.Size(60, 16);
this.lHeight.TabIndex = 7;
this.lHeight.Text = "Height: 0";
//
// lBpp
//
this.lBpp.AutoSize = true;
this.lBpp.Location = new System.Drawing.Point(740, 350);
this.lBpp.Name = "lBpp";
this.lBpp.Size = new System.Drawing.Size(45, 16);
this.lBpp.TabIndex = 8;
this.lBpp.Text = "Bpp: 0";
//
// lMetadataCount
//
this.lMetadataCount.AutoSize = true;
this.lMetadataCount.Location = new System.Drawing.Point(809, 350);
this.lMetadataCount.Name = "lMetadataCount";
this.lMetadataCount.Size = new System.Drawing.Size(77, 16);
this.lMetadataCount.TabIndex = 9;
this.lMetadataCount.Text = "Metadata: 0";
//
// bGreyscale
//
this.bGreyscale.Location = new System.Drawing.Point(564, 121);
this.bGreyscale.Name = "bGreyscale";
this.bGreyscale.Size = new System.Drawing.Size(125, 28);
this.bGreyscale.TabIndex = 10;
this.bGreyscale.Text = "Conv to greyscale";
this.bGreyscale.UseVisualStyleBackColor = true;
this.bGreyscale.Click += new System.EventHandler(this.bGreyscale_Click);
//
// cbSelectFrame
//
this.cbSelectFrame.FormattingEnabled = true;
this.cbSelectFrame.Location = new System.Drawing.Point(695, 156);
this.cbSelectFrame.Name = "cbSelectFrame";
this.cbSelectFrame.Size = new System.Drawing.Size(121, 24);
this.cbSelectFrame.TabIndex = 11;
this.cbSelectFrame.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// lComment
//
this.lComment.AutoSize = true;
this.lComment.Location = new System.Drawing.Point(563, 373);
this.lComment.Name = "lComment";
this.lComment.Size = new System.Drawing.Size(107, 16);
this.lComment.TabIndex = 12;
this.lComment.Text = "Image-comment:";
//
// bAdjustGamma
//
this.bAdjustGamma.Location = new System.Drawing.Point(564, 185);
this.bAdjustGamma.Name = "bAdjustGamma";
this.bAdjustGamma.Size = new System.Drawing.Size(125, 28);
this.bAdjustGamma.TabIndex = 13;
this.bAdjustGamma.Text = "Adjust gamma";
this.bAdjustGamma.UseVisualStyleBackColor = true;
this.bAdjustGamma.Click += new System.EventHandler(this.bAdjustGamma_Click);
//
// vGamma
//
this.vGamma.DecimalPlaces = 2;
this.vGamma.Increment = new decimal(new int[] {
0,
0,
0,
0});
this.vGamma.Location = new System.Drawing.Point(695, 189);
this.vGamma.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.vGamma.Name = "vGamma";
this.vGamma.Size = new System.Drawing.Size(121, 23);
this.vGamma.TabIndex = 14;
//
// bRedChannelOnly
//
this.bRedChannelOnly.Location = new System.Drawing.Point(564, 219);
this.bRedChannelOnly.Name = "bRedChannelOnly";
this.bRedChannelOnly.Size = new System.Drawing.Size(125, 28);
this.bRedChannelOnly.TabIndex = 15;
this.bRedChannelOnly.Text = "Red channel";
this.bRedChannelOnly.UseVisualStyleBackColor = true;
this.bRedChannelOnly.Click += new System.EventHandler(this.bRedChannelOnly_Click);
//
// bBlueChannel
//
this.bBlueChannel.Location = new System.Drawing.Point(564, 287);
this.bBlueChannel.Name = "bBlueChannel";
this.bBlueChannel.Size = new System.Drawing.Size(125, 28);
this.bBlueChannel.TabIndex = 16;
this.bBlueChannel.Text = "Blue channel";
this.bBlueChannel.UseVisualStyleBackColor = true;
this.bBlueChannel.Click += new System.EventHandler(this.bBlueChannel_Click);
//
// bGreenChannel
//
this.bGreenChannel.Location = new System.Drawing.Point(564, 253);
this.bGreenChannel.Name = "bGreenChannel";
this.bGreenChannel.Size = new System.Drawing.Size(125, 28);
this.bGreenChannel.TabIndex = 17;
this.bGreenChannel.Text = "Green channel";
this.bGreenChannel.UseVisualStyleBackColor = true;
this.bGreenChannel.Click += new System.EventHandler(this.bGreenChannel_Click);
//
// bAllChannels
//
this.bAllChannels.Location = new System.Drawing.Point(563, 321);
this.bAllChannels.Name = "bAllChannels";
this.bAllChannels.Size = new System.Drawing.Size(126, 28);
this.bAllChannels.TabIndex = 18;
this.bAllChannels.Text = "All channels";
this.bAllChannels.UseVisualStyleBackColor = true;
this.bAllChannels.Click += new System.EventHandler(this.bAllChannels_Click);
//
// lSelectFrame
//
this.lSelectFrame.AutoSize = true;
this.lSelectFrame.Location = new System.Drawing.Point(563, 159);
this.lSelectFrame.Name = "lSelectFrame";
this.lSelectFrame.Size = new System.Drawing.Size(86, 16);
this.lSelectFrame.TabIndex = 19;
this.lSelectFrame.Text = "Select frame:";
//
// lImageFormat
//
this.lImageFormat.AutoSize = true;
this.lImageFormat.Location = new System.Drawing.Point(563, 395);
this.lImageFormat.Name = "lImageFormat";
this.lImageFormat.Size = new System.Drawing.Size(92, 16);
this.lImageFormat.TabIndex = 20;
this.lImageFormat.Text = "Image-format:";
//
// bRotate
//
this.bRotate.Location = new System.Drawing.Point(564, 86);
this.bRotate.Name = "bRotate";
this.bRotate.Size = new System.Drawing.Size(125, 28);
this.bRotate.TabIndex = 21;
this.bRotate.Text = "Rotate";
this.bRotate.UseVisualStyleBackColor = true;
this.bRotate.Click += new System.EventHandler(this.bRotate_Click);
//
// vRotate
//
this.vRotate.Location = new System.Drawing.Point(695, 80);
this.vRotate.Maximum = 360;
this.vRotate.Name = "vRotate";
this.vRotate.Size = new System.Drawing.Size(170, 45);
this.vRotate.TabIndex = 22;
this.vRotate.TickFrequency = 10;
this.vRotate.TickStyle = System.Windows.Forms.TickStyle.Both;
this.vRotate.Scroll += new System.EventHandler(this.vRotate_Scroll);
//
// lRotate
//
this.lRotate.AutoSize = true;
this.lRotate.Location = new System.Drawing.Point(871, 92);
this.lRotate.Name = "lRotate";
this.lRotate.Size = new System.Drawing.Size(15, 16);
this.lRotate.TabIndex = 23;
this.lRotate.Text = "0";
//
// lColors
//
this.lColors.AutoSize = true;
this.lColors.Location = new System.Drawing.Point(740, 394);
this.lColors.Name = "lColors";
this.lColors.Size = new System.Drawing.Size(60, 16);
this.lColors.TabIndex = 24;
this.lColors.Text = "Colors: 0";
//
// nShowMetadata
//
this.nShowMetadata.Location = new System.Drawing.Point(696, 15);
this.nShowMetadata.Name = "nShowMetadata";
this.nShowMetadata.Size = new System.Drawing.Size(125, 28);
this.nShowMetadata.TabIndex = 25;
this.nShowMetadata.Text = "Show metadata";
this.nShowMetadata.UseVisualStyleBackColor = true;
this.nShowMetadata.Click += new System.EventHandler(this.nShowMetadata_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(908, 423);
this.Controls.Add(this.nShowMetadata);
this.Controls.Add(this.lColors);
this.Controls.Add(this.lRotate);
this.Controls.Add(this.vRotate);
this.Controls.Add(this.bRotate);
this.Controls.Add(this.lImageFormat);
this.Controls.Add(this.lSelectFrame);
this.Controls.Add(this.bAllChannels);
this.Controls.Add(this.bGreenChannel);
this.Controls.Add(this.bBlueChannel);
this.Controls.Add(this.bRedChannelOnly);
this.Controls.Add(this.vGamma);
this.Controls.Add(this.bAdjustGamma);
this.Controls.Add(this.lComment);
this.Controls.Add(this.cbSelectFrame);
this.Controls.Add(this.bGreyscale);
this.Controls.Add(this.lMetadataCount);
this.Controls.Add(this.lBpp);
this.Controls.Add(this.lHeight);
this.Controls.Add(this.lWidth);
this.Controls.Add(this.bSaveImage);
this.Controls.Add(this.bLoadImage);
this.Controls.Add(this.pictureBox);
this.DoubleBuffered = true;
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(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sample 11";
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.vGamma)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.vRotate)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.Button bLoadImage;
private System.Windows.Forms.Button bSaveImage;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.SaveFileDialog sfd;
private System.Windows.Forms.Label lWidth;
private System.Windows.Forms.Label lHeight;
private System.Windows.Forms.Label lBpp;
private System.Windows.Forms.Label lMetadataCount;
private System.Windows.Forms.Button bGreyscale;
private System.Windows.Forms.ComboBox cbSelectFrame;
private System.Windows.Forms.Label lComment;
private System.Windows.Forms.Button bAdjustGamma;
private System.Windows.Forms.NumericUpDown vGamma;
private System.Windows.Forms.Button bRedChannelOnly;
private System.Windows.Forms.Button bBlueChannel;
private System.Windows.Forms.Button bGreenChannel;
private System.Windows.Forms.Button bAllChannels;
private System.Windows.Forms.Label lSelectFrame;
private System.Windows.Forms.Label lImageFormat;
private System.Windows.Forms.Button bRotate;
private System.Windows.Forms.TrackBar vRotate;
private System.Windows.Forms.Label lRotate;
private System.Windows.Forms.Label lColors;
private System.Windows.Forms.Button nShowMetadata;
}
}

View File

@@ -0,0 +1,412 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using FreeImageAPI;
using FreeImageAPI.Metadata;
using FreeImageAPI.Plugins;
namespace Sample11
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
// Capture messages generated by FreeImage
FreeImageEngine.Message += new OutputMessageFunction(FreeImageEngine_Message);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
static void FreeImageEngine_Message(FREE_IMAGE_FORMAT fif, string message)
{
// Display the message
// FreeImage continues code executing when all
// addes subscribers of 'Message' finished returned.
MessageBox.Show(message, "FreeImage-Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
// The FreeImageBitmap this sample will work with.
FreeImageBitmap bitmap = null;
// Replaces the current bitmap with the given one.
private void ReplaceBitmap(FreeImageBitmap newBitmap)
{
// Checks whether the bitmap is usable
if (newBitmap == null || newBitmap.IsDisposed)
{
MessageBox.Show(
"Unexpected error.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
// Check whether the image type of the new bitmap is 'FIT_BITMAP'.
// If not convert to 'FIT_BITMAP'.
if (newBitmap.ImageType != FREE_IMAGE_TYPE.FIT_BITMAP)
{
if (!newBitmap.ConvertType(FREE_IMAGE_TYPE.FIT_BITMAP, true))
{
MessageBox.Show(
"Error converting bitmap to standard type.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
}
// Dispose the old bitmap only in case it exists and
// the old instance is another than the new one.
if ((bitmap != null) && !object.ReferenceEquals(bitmap, newBitmap))
{
bitmap.Dispose();
}
// Dispose the picturebox's bitmap in case it exists.
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
}
// Set the new bitmap.
pictureBox.Image = (Bitmap)(bitmap = newBitmap);
// Update gui.
UpdateBitmapInformations();
UpdateFrameSelection();
}
// Get bitmap properties and display them in the gui.
private void UpdateBitmapInformations()
{
if (Bitmap)
{
// Get width
lWidth.Text = String.Format("Width: {0}", bitmap.Width);
// Get Height
lHeight.Text = String.Format("Height: {0}", bitmap.Height);
// Get color depth
lBpp.Text = String.Format("Bpp: {0}", bitmap.ColorDepth);
// Get number of metadata
ImageMetadata mData = bitmap.Metadata;
mData.HideEmptyModels = true;
int mCnt = 0;
foreach (MetadataModel model in mData.List)
{
mCnt += model.Count;
}
lMetadataCount.Text = String.Format("Metadata: {0}", mCnt);
// Get image comment
lComment.Text = String.Format("Image-comment: {0}", bitmap.Comment != null ? bitmap.Comment : String.Empty);
// Get the number of real colors in the image
lColors.Text = String.Format("Colors: {0}", bitmap.UniqueColors);
}
else
{
// Reset all values
lWidth.Text = String.Format("Width: {0}", 0);
lHeight.Text = String.Format("Height: {0}", 0);
lBpp.Text = String.Format("Bpp: {0}", 0);
lMetadataCount.Text = String.Format("Metadata: {0}", 0);
lComment.Text = String.Format("Image-comment: {0}", String.Empty);
lColors.Text = String.Format("Colors: {0}", 0);
}
}
// Update combobox for frame selection.
private void UpdateFrameSelection()
{
cbSelectFrame.Items.Clear();
if (Bitmap)
{
// Get number of frames in the bitmap
if (bitmap.FrameCount > 1)
{
// Add an entry for each frame to the combobox
for (int i = 0; i < bitmap.FrameCount; i++)
{
cbSelectFrame.Items.Add(String.Format("Frame {0}", i + 1));
}
}
}
}
// Returns true in case the variable 'bitmap'
// is set and not disposed.
private bool Bitmap
{
get { return ((bitmap != null) && (!bitmap.IsDisposed)); }
}
private void bLoadImage_Click(object sender, EventArgs e)
{
if (ofd.ShowDialog() == DialogResult.OK)
{
try
{
// Load the file using autodetection
FreeImageBitmap fib = new FreeImageBitmap(ofd.FileName);
// Rescale the image so that it fits the picturebox
// Get the plugin that was used to load the bitmap
FreeImagePlugin plug = PluginRepository.Plugin(fib.ImageFormat);
lImageFormat.Text = String.Format("Image-format: {0}", plug.Format);
// Replace the existing bitmap with the new one
ReplaceBitmap(fib);
}
catch
{
}
}
}
private void bSaveImage_Click(object sender, EventArgs e)
{
if (pictureBox.Image != null)
{
try
{
if (sfd.ShowDialog() == DialogResult.OK)
{
// Save the bitmap using autodetection
using (FreeImageBitmap temp = new FreeImageBitmap(pictureBox.Image))
{
temp.Save(sfd.FileName);
}
}
}
catch
{
}
}
}
private void bRotate_Click(object sender, EventArgs e)
{
if (Bitmap)
{
// Create a temporary rescaled bitmap
using (FreeImageBitmap temp = bitmap.GetScaledInstance(
pictureBox.DisplayRectangle.Width, pictureBox.DisplayRectangle.Height,
FREE_IMAGE_FILTER.FILTER_CATMULLROM))
{
if (temp != null)
{
// Rotate the bitmap
temp.Rotate((double)vRotate.Value);
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
}
// Display the result
pictureBox.Image = (Bitmap)temp;
}
}
}
}
private void bGreyscale_Click(object sender, EventArgs e)
{
if (Bitmap)
{
// Convert the bitmap to 8bpp and greyscale
ReplaceBitmap(bitmap.GetColorConvertedInstance(
FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP |
FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE));
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cb = sender as ComboBox;
if ((cb != null) && (cb.Items.Count > 0))
{
if (Bitmap)
{
try
{
// Switch the selected frame
bitmap.SelectActiveFrame(cb.SelectedIndex);
ReplaceBitmap(bitmap);
}
catch (ArgumentOutOfRangeException)
{
MessageBox.Show("Error changing frame.", "Error");
}
}
}
}
private void bAdjustGamma_Click(object sender, EventArgs e)
{
if (Bitmap)
{
// Adjust the gamma value
bitmap.AdjustGamma((double)vGamma.Value);
ReplaceBitmap(bitmap);
}
}
private void bRedChannelOnly_Click(object sender, EventArgs e)
{
// Mask out green and blue
SetColorChannels(0xFF, 0x00, 0x00);
}
private void bGreenChannel_Click(object sender, EventArgs e)
{
// Mask out red and blue
SetColorChannels(0x00, 0xFF, 0x00);
}
private void bBlueChannel_Click(object sender, EventArgs e)
{
// Mask out red and green
SetColorChannels(0x00, 0x00, 0xFF);
}
private void bAllChannels_Click(object sender, EventArgs e)
{
if (Bitmap)
{
// Restore the bitmap using the original
ReplaceBitmap(bitmap);
}
}
private void SetColorChannels(int redmask, int greenmask, int bluemask)
{
if (Bitmap)
{
// Create a temporary clone.
using (FreeImageBitmap bitmap = (FreeImageBitmap)this.bitmap.Clone())
{
if (bitmap != null)
{
// Check whether the bitmap has a palette
if (bitmap.HasPalette)
{
// Use the Palette class to handle the bitmap's
// palette. A palette always consist of RGBQUADs.
Palette palette = bitmap.Palette;
// Apply the new values for all three color components.
for (int i = 0; i < palette.Length; i++)
{
RGBQUAD rgbq = palette[i];
rgbq.rgbRed = (byte)(rgbq.rgbRed & redmask);
rgbq.rgbGreen = (byte)(rgbq.rgbGreen & greenmask);
rgbq.rgbBlue = (byte)(rgbq.rgbBlue & bluemask);
palette[i] = rgbq;
}
}
// In case the bitmap has no palette it must have a color depth
// of 16, 24 or 32. Each color depth needs a different wrapping
// structure for the bitmaps data. These structures can be accessed
// by using the foreach clause.
else if (bitmap.ColorDepth == 16)
{
// Iterate over each scanline
// For 16bpp use either Scanline<FI16RGB555> or Scanline<FI16RGB565>
if (bitmap.IsRGB555)
{
foreach (Scanline<FI16RGB555> scanline in bitmap)
{
for (int x = 0; x < scanline.Length; x++)
{
FI16RGB555 pixel = scanline[x];
pixel.Red = (byte)(pixel.Red & redmask);
pixel.Green = (byte)(pixel.Green & greenmask);
pixel.Blue = (byte)(pixel.Blue & bluemask);
scanline[x] = pixel;
}
}
}
else if (bitmap.IsRGB565)
{
foreach (Scanline<FI16RGB565> scanline in bitmap)
{
for (int x = 0; x < scanline.Length; x++)
{
FI16RGB565 pixel = scanline[x];
pixel.Red = (byte)(pixel.Red & redmask);
pixel.Green = (byte)(pixel.Green & greenmask);
pixel.Blue = (byte)(pixel.Blue & bluemask);
scanline[x] = pixel;
}
}
}
}
else if (bitmap.ColorDepth == 24)
{
// Iterate over each scanline
// For 24bpp Scanline<RGBTRIPLE> must be used
foreach (Scanline<RGBTRIPLE> scanline in bitmap)
{
for (int x = 0; x < scanline.Length; x++)
{
RGBTRIPLE pixel = scanline[x];
pixel.rgbtRed = (byte)(pixel.rgbtRed & redmask);
pixel.rgbtGreen = (byte)(pixel.rgbtGreen & greenmask);
pixel.rgbtBlue = (byte)(pixel.rgbtBlue & bluemask);
scanline[x] = pixel;
}
}
}
else if (bitmap.ColorDepth == 32)
{
// Iterate over each scanline
// For 32bpp Scanline<RGBQUAD> must be used
foreach (Scanline<RGBQUAD> scanline in bitmap)
{
for (int x = 0; x < scanline.Length; x++)
{
RGBQUAD pixel = scanline[x];
pixel.rgbRed = (byte)(pixel.rgbRed & redmask);
pixel.rgbGreen = (byte)(pixel.rgbGreen & greenmask);
pixel.rgbBlue = (byte)(pixel.rgbBlue & bluemask);
scanline[x] = pixel;
}
}
}
// Dispose only the picturebox's bitmap
if (pictureBox.Image != null)
{
pictureBox.Image.Dispose();
}
pictureBox.Image = (Bitmap)bitmap;
}
}
}
}
private void vRotate_Scroll(object sender, EventArgs e)
{
TrackBar bar = sender as TrackBar;
if (bar != null)
{
lRotate.Text = bar.Value.ToString();
}
}
private void nShowMetadata_Click(object sender, EventArgs e)
{
if (Bitmap)
{
MetaDataFrame mFrame = new MetaDataFrame();
mFrame.Tag = bitmap.Metadata;
mFrame.ShowDialog(this);
}
}
}
}

View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="sfd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>84, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,63 @@
namespace Sample11
{
partial class MetaDataFrame
{
/// <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.tvMetadata = new System.Windows.Forms.TreeView();
this.SuspendLayout();
//
// tvMetadata
//
this.tvMetadata.Location = new System.Drawing.Point(12, 12);
this.tvMetadata.Name = "tvMetadata";
this.tvMetadata.Size = new System.Drawing.Size(389, 318);
this.tvMetadata.TabIndex = 3;
//
// MetaDataFrame
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(417, 349);
this.Controls.Add(this.tvMetadata);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MetaDataFrame";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Metadata";
this.Load += new System.EventHandler(this.MetaDataFrame_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TreeView tvMetadata;
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using FreeImageAPI;
using FreeImageAPI.Metadata;
namespace Sample11
{
public partial class MetaDataFrame : Form
{
public MetaDataFrame()
{
InitializeComponent();
}
private void MetaDataFrame_Load(object sender, EventArgs e)
{
ImageMetadata iMetadata = this.Tag as ImageMetadata;
if (iMetadata != null)
{
bool backup = iMetadata.HideEmptyModels;
iMetadata.HideEmptyModels = false;
try
{
// Get each metadata model
foreach (MetadataModel metadataModel in iMetadata)
{
// Create a new node for each model
TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString());
// Get each metadata tag and create a subnode for it
foreach (MetadataTag metadataTag in metadataModel)
{
modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString());
}
}
}
// Display error message
catch (Exception ex)
{
while (ex.InnerException != null)
ex = ex.InnerException;
MessageBox.Show(ex.ToString(), "Exception caught");
}
iMetadata.HideEmptyModels = backup;
}
}
}
}

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("219019e1-9a57-46c7-b9d7-3928a9277fd6")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,113 @@
<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>{996068CD-D07A-42E0-856F-ACC71E8565EF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample11</RootNamespace>
<AssemblyName>Sample11</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>none</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>none</ErrorReport>
<WarningLevel>4</WarningLevel>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<FileAlignment>512</FileAlignment>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>none</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<FileAlignment>512</FileAlignment>
<DebugType>
</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>none</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<FileAlignment>512</FileAlignment>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>none</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<FileAlignment>512</FileAlignment>
<DebugType>
</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>none</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="MetaDataFrame.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MetaDataFrame.Designer.cs">
<DependentUpon>MetaDataFrame.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MetaDataFrame.resx">
<SubType>Designer</SubType>
<DependentUpon>MetaDataFrame.cs</DependentUpon>
</EmbeddedResource>
</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>

View File

@@ -0,0 +1,114 @@
What's New for FreeImage.NET
* : fixed
- : removed
! : changed
+ : added
December 21, 2009 - 3.13.1.1
* [Carsten Klein] Fixed a threading bug in OpenMultiBitmapFromStream and CloseMultiBitmap. Access to the streamHandles Dictionary is now thread safe.
September 15, 2009 - 3.13.0.1
+ [Jean-Philippe Goerke] Added PFM, PICT and RAW file formats.
+ [Jean-Philippe Goerke] Added loading flag JPEG_EXIFROTATE.
+ [Jean-Philippe Goerke] Added method GetNativeVersion() to the FreeImage class.
! [Jean-Philippe Goerke] Changed FreeImage.IsAvailable() now returning false in case the native library is out of date or unusable.
- [Jean-Philippe Goerke] Removed FREEIMAGE_MAJOR_VERSION, FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL constants from class FreeImage.
+ [Jean-Philippe Goerke] Added enumeration FREE_IMAGE_COLOR_OPTIONS.
+ [Jean-Philippe Goerke] Added new overloads for FreeImage.Allocate() and FreeImage.AllocateT().
+ [Jean-Philippe Goerke] Added methods AllocateEx(), AllocateExT(), FillBackground() and EnlargeCanvas() to class FreeImage.
+ [Jean-Philippe Goerke] Added methods FillBackground(), EnlargeCanvas() and GetEnlargedInstance() to class FreeImageBitmap.
- [Jean-Philippe Goerke] Removed unused ConvertLineXtoY() methods.
* [kruno13] Fixed a bug in the FreeImageBitmap constructors.
- [Jean-Philippe Goerke] Removed unneeded GCHandles used with delegates.
+ [Jean-Philippe Goerke] Added overloaded method OpenMultiBitmapFromStream to class FreeImage.
+ [Jean-Philippe Goerke] FreeImageBitmap now supports loading multipage bitmaps from streams. Warning: The stream must remain open for the bitmap's lifetime.
* [mshanke] Fixed some IPTC metadata incorrect namings.
! [Jean-Philippe Goerke] Method FreeImage.RotateClassic is now deprecated.
+ [Jean-Philippe Goerke] Added method Rotate() to the FreeImage class.
! [Jean-Philippe Goerke] FreeImageBitmap now uses the method Rotate instead of RotateClassic.
April 20, 2009 - 1.10
! [Jean-Philippe Goerke] Updated wrapper-version to 1.10 including some minor changes.
February 27, 2009 - 1.09
+ [Jean-Philippe Goerke] Help file creation now uses the Version Builder plugin of Sandcastle Help File Builder to generate an MSDN-like Version Information paragraph in the help file.
+ [Jean-Philippe Goerke] Added new metadata model class MDM_EXIF_MAIN to replace MDM_MAIN. Class MDM_MAIN still exists but is marked obsolete and will be removed in a future release.
+ [Jean-Philippe Goerke] Added various properties to access the value of metadata tags directly to all MDM_* classes expect MDM_CUSTOM, MDM_NODATA and MDM_MAKERNOTE.
! [Jean-Philippe Goerke] Now classes deriving from MetadataModel, expect obsoltete class MDM_MAIN, are no longer sealed.
! [Jean-Philippe Goerke] Class GifInformation now derives from MDM_ANIMATION. Moved properties into base class MDM_ANIMATION.
+ [Jean-Philippe Goerke] Added enumerations AltitudeType, DirectionReference, InteroperabilityMode, LatitudeType, LongitudeType, ImageOrientation and VelocityUnit to class MetadataModel.
* [Jean-Philippe Goerke] Fixed a bug in MetadataTag.Count, MetadataTag.Length and MetadataTag.Value.
+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to some protected and private fields.
February 23, 2009 - 1.08
! [Jean-Philippe Goerke] FreeImage.NET now uses Sandcastle Help File Builder 1.8.0.1
+ [Jean-Philippe Goerke] Added new Sandcastle Help File Builder project file FreeImage.NET.shfbproj.
* [headkaze] Fixed a bug in FreeImage.CreateFromBitmap, which now incorporates any transparency information from palletized .NET Bitmaps.
+ [Jean-Philippe Goerke] Added new overloaded method CreateGlobalPalette() to class GifInformation to create global palettes from local palettes.
! [Jean-Philippe Goerke] Renamed internal method FreeImage.SetTransparencyTable_ to FreeImage.SetTransparencyTable.
+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to many protected and private fields.
February 20, 2009 - 1.07
* [Jean-Philippe Goerke] Fixed a bug in FreeImage.IsFilenameValidForFIF and FreeImage.IsExtensionValidForFIF.
* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx that could prevent saving supported non-bitmap types.
* [Jean-Philippe Goerke] Fixed a small bug in FreeImage.CompareData.
+ [Jean-Philippe Goerke] Added two overloads of ColorQuantizeEx() in class FreeImage to return images with a color depth smaller than 8.
! [Jean-Philippe Goerke] Updated FreeImage.ConvertColorDepth to support 1- and 4-bpp color conversions (FreeImage_ConvertTo4Bits only creates grayscale results).
* [headkaze] Fixed a bug in FreeImage.GetBitmap, which now adds any transparency information to palletized .NET Bitmaps.
* [headkaze] Fixed a bug in FreeImage.GetBitmap and FreeImage.CreateFromBitmap to support palettes with sizes different from 2, 16 and 256 entries.
! [Jean-Philippe Goerke] Improved handling of multipage bitmaps in FreeImageBitmap class.
+ [Jean-Philippe Goerke] Added new overloads for FreeImageBitmap.SaveAdd() to allow inserting frames at a specified page index.
+ [Jean-Philippe Goerke] Added new class GifInformation which provides access to GIF format specific metadata (GlobalPalette, Animation, etc.).
+ [Jean-Philippe Goerke] Added enumeration DisposalMethodType.
! [Jean-Philippe Goerke] Updated class MemoryArray<T>, which now is Disposable and has a new static constructor.
! [Jean-Philippe Goerke] Removed code using reflection from class ImageMetadata.
+ [Jean-Philippe Goerke] Added new ctor(FITAG) and ctor(MetadataTag) to class Palette to support palettes stored in metadata tags.
+ [Jean-Philippe Goerke] Added new ctor(RGBQUAD[]), ctor(Color[]) and ctor(int) to create new stand-alone palettes to class Palette.
+ [Jean-Philippe Goerke] Added overloaded CreateGrayscalePalette(), Reverse() and CopyFrom() to class Palette.
! [Jean-Philippe Goerke] Changed the behavior of MetadataTag.Value. byte and byte[] are now stored as FREE_IMAGE_MDTYPE.FIDT_BYTE instead of FREE_IMAGE_MDTYPE.FIDT_UNDEFINED.
+ [Jean-Philippe Goerke] Added a type check to MetadataTag.SetValue(object), MetadataTag.SetValue(object, FREE_IMAGE_MDTYPE) and the setter of MetadataTag.Value.
November 18, 2008 - 1.06
* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx.
! [Jean-Philippe Goerke] Improved method FreeImage.IsFilenameValidForFIF.
November 5, 2008 - 1.05
! [Jean-Philippe Goerke] Updated documentation of FreeImage.ConvertFromRawBits and FreeImage.ConvertToRawBits.
+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],int,int,int,uint,uint,uint,uint,bool) to the FreeImage class.
+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],FREE_IMAGE_TYPE,int,int,int,uint,uint,uint,uint bool) to the FreeImage class.
+ [Jean-Philippe Goerke] Added new overload ConvertToRawBits(byte[],FIBITMAP,int,uint,uint,uint,uint,bool) to the FreeImage class.
! [Jean-Philippe Goerke] Improved method FreeImage.CreatePropertyItem.
+ [Jean-Philippe Goerke] Added overloads for CopyMemory to class FreeImage which support direct usage of arrays.
! [Jean-Philippe Goerke] Replaced calls to FreeImage.MoveMemory with FreeImage.CopyMemory.
! [Jean-Philippe Goerke] Class FreeImageBitmap now derives from MarshalByRefObject.
+ [Jean-Philippe Goerke] Added new ctor(int,int,int,PixelFormat,byte[]) and ctor(int,int,int,int,FREE_IMAGE_TYPE,byte[]) to the FreeImageBitmap class.
August 29, 2008 - 1.04
+ [Jean-Philippe Goerke] Added new target architectures x86 and x64 to the Visual Studio 2005 solution and project files.
+ [Jean-Philippe Goerke] Added static readonly field Zero to FIBITMAP, FIMEMORY, FIMETADATA, FIMULTIBITMAP and FITAG.
! [Jean-Philippe Goerke] Changed CreateFromBitmap to handle all formats contained by System.Drawing.Imaging.PixelFormat.
+ [Jean-Philippe Goerke] Added overload for ConvertFromRawBits to class FreeImage which supports creating images of any FREE_IMAGE_TYPE from raw bits.
+ [Jean-Philippe Goerke] Added method GetTypeParameters to class FreeImage.
! [Jean-Philippe Goerke] Both constructors FreeImageBitmap.ctor(int,int,PixelFormat) and FreeImageBitmap.ctor(int,int,int,PixelFormat,IntPtr) now work with all formats defined in PixelFormat.
+ [Jean-Philippe Goerke] Added new constructor FreeImageBitmap.ctor(int,int,int,int,FREE_IMAGE_TYPE,IntPtr) to FreeImageBitmap class.
August 18, 2008 - 1.03
* [Eric T. Wilson] Added GC.AddMemoryPressure and GC.RemoveMemoryPressure to FreeImageBitmap class.
+ [Eric T. Wilson] Added ToBitmap method to FreeImageBitmap class.
! [Eric T. Wilson] Changed implicit conversion operators to and from System.Drawing.Bitmap to explicit operators.
- [Eric T. Wilson] Removed Message event from FreeImage class. Use event FreeImageEngine.Message instead.
- [Eric T. Wilson] Removed contructors ctor(int) and ctor(IntPtr) from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG.
- [Eric T. Wilson] Removed implicit conversion operators from and to int and IntPtr from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG.
+ [Jean-Philippe Goerke] Added SetNull method to FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG.
! [Jean-Philippe Goerke] Changed handling of multipage images in FreeImageBitmap: As with System.Drawing.Bitmap, any changes applied to an active frame are no longer written back to the multipage image loaded.
* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveToStream(ref FIBITMAP, Stream, FREE_IMAGE_FORMAT, FREE_IMAGE_SAVE_FLAGS, FREE_IMAGE_COLOR_DEPTH, bool): changed catch block into a finally block.
July 25, 2008 - 1.02
+ [Jean-Philippe Goerke] Improved handling of XMP metadata in MetadataTag.cs: Key is now set to "XMLPacket" not changeable if Model is FREE_IMAGE_MDMODEL.FIMD_XMP.
July 01, 2008 - 1.01
+ [Jean-Philippe Goerke] Added methods Quantize and GetQuantizedInstance to the FreeImageBitmap class.
November 12, 2007 - 1.00
+ [Jean-Philippe Goerke] Initial release.

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2003.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug.ActiveCfg = Debug|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug.Build.0 = Debug|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release.ActiveCfg = Release|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="FreeImagePlus"
ProjectGUID="{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_SECURE_NO_DEPRECATE"
StringPooling="TRUE"
RuntimeLibrary="0"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/FreeImagePlus.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImage.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/FreeImagePlus.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/FreeImagePlus.pdb"
ImportLibrary=".\Release/FreeImagePlus.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/FreeImagePlus.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Release\FreeImagePlus.lib dist\
copy Release\FreeImagePlus.dll dist\
copy FreeImagePlus.h dist\
"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_SECURE_NO_DEPRECATE"
StringPooling="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/FreeImagePlus.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImaged.lib odbc32.lib odbccp32.lib"
OutputFile="Debug/FreeImagePlusd.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/FreeImagePlusd.pdb"
ImportLibrary=".\Debug/FreeImagePlusd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/FreeImagePlus.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Debug\FreeImagePlusd.lib dist\
copy Debug\FreeImagePlusd.dll dist\
copy FreeImagePlus.h dist\
"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="src\fipImage.cpp">
</File>
<File
RelativePath="src\fipMemoryIO.cpp">
</File>
<File
RelativePath="src\fipMetadataFind.cpp">
</File>
<File
RelativePath="src\fipMultiPage.cpp">
</File>
<File
RelativePath="src\fipTag.cpp">
</File>
<File
RelativePath="src\fipWinImage.cpp">
</File>
<File
RelativePath="src\FreeImagePlus.cpp">
</File>
<File
RelativePath="FreeImagePlus.rc">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="FreeImagePlus.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="WhatsNew_FIP.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2005.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32
{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,480 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="FreeImagePlus"
ProjectGUID="{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
RootNamespace="FreeImagePlus"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/FreeImagePlus.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/FreeImagePlus.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImage.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/FreeImagePlus.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/FreeImagePlus.pdb"
ImportLibrary=".\Release/FreeImagePlus.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Release\FreeImagePlus.lib dist\&#x0D;&#x0A;&#x0D;&#x0A;copy Release\FreeImagePlus.dll dist\&#x0D;&#x0A;&#x0D;&#x0A;copy FreeImagePlus.h dist\&#x0D;&#x0A;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/FreeImagePlus.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/FreeImagePlus.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImaged.lib odbc32.lib odbccp32.lib"
OutputFile="Debug/FreeImagePlusd.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/FreeImagePlusd.pdb"
ImportLibrary=".\Debug/FreeImagePlusd.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Debug\FreeImagePlusd.lib dist\&#x0D;&#x0A;&#x0D;&#x0A;copy Debug\FreeImagePlusd.dll dist\&#x0D;&#x0A;&#x0D;&#x0A;copy FreeImagePlus.h dist\&#x0D;&#x0A;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Release/FreeImagePlus.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/FreeImagePlus.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImage.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/FreeImagePlus.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/FreeImagePlus.pdb"
ImportLibrary=".\Release/FreeImagePlus.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Release\FreeImagePlus.lib dist\&#x0D;&#x0A;&#x0D;&#x0A;copy Release\FreeImagePlus.dll dist\&#x0D;&#x0A;&#x0D;&#x0A;copy FreeImagePlus.h dist\&#x0D;&#x0A;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Debug/FreeImagePlus.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".,../../Source"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/FreeImagePlus.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../../Dist/FreeImaged.lib odbc32.lib odbccp32.lib"
OutputFile="Debug/FreeImagePlusd.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/FreeImagePlusd.pdb"
ImportLibrary=".\Debug/FreeImagePlusd.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Debug\FreeImagePlusd.lib dist\&#x0D;&#x0A;&#x0D;&#x0A;copy Debug\FreeImagePlusd.dll dist\&#x0D;&#x0A;&#x0D;&#x0A;copy FreeImagePlus.h dist\&#x0D;&#x0A;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="src\fipImage.cpp"
>
</File>
<File
RelativePath="src\fipMemoryIO.cpp"
>
</File>
<File
RelativePath="src\fipMetadataFind.cpp"
>
</File>
<File
RelativePath="src\fipMultiPage.cpp"
>
</File>
<File
RelativePath="src\fipTag.cpp"
>
</File>
<File
RelativePath="src\fipWinImage.cpp"
>
</File>
<File
RelativePath="src\FreeImagePlus.cpp"
>
</File>
<File
RelativePath="FreeImagePlus.rc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="FreeImagePlus.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
<File
RelativePath="WhatsNew_FIP.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Some files were not shown because too many files have changed in this diff Show More