http://www.jbox.dk/sanos/index.htm
http://docwiki.embarcadero.com/CodeExamples/XE2/en/FMXTBitmapScanLine_(Delphi)
http://www.marcocantu.com/delphipowerbook/GraphicsinDelphi_md6.pdf
https://www.swissdelphicenter.ch/en/showcode.php?id=2403
http://delphidabbler.com/tips/147
https://www.swissdelphicenter.ch/en/showcode.php?id=1896
http://www.efg2.com/Lab/ImageProcessing/Scanline.htm
https://www.cnblogs.com/shangdawei/archive/2013/05/06/3063750.html
http://edn.embarcadero.com/article/29173
http://delphi.xcjc.net/viewthread.php?tid=48929
http://wiki.lazarus.freepascal.org/Fast_direct_pixel_access
http://www.delphiforfun.org/Programs/Delphi_Techniques/BitmapChunks.htm
https://www.slusalica.net/blokatori.html
http://www.daniel-schwamm.de/index.php?pg=delphi-tutorials/picofpics
https://www.tek-tips.com/viewthread.cfm?qid=1626211
http://www.intitec.com/varios/Delphi_al_limite.pdf
procedure TForm1.Button1Click(Sender: TObject);
var
bmp: TBitmap;
jpg: TJpegImage;
scale: Double;
begin
if opendialog1.execute then
begin
jpg := TJpegImage.Create;
try
jpg.Loadfromfile(opendialog1.filename);
if jpg.Height > jpg.Width then
scale := 50 / jpg.Height
else
scale := 50 / jpg.Width;
bmp := TBitmap.Create;
try
{Create thumbnail bitmap, keep pictures aspect ratio}
bmp.Width := Round(jpg.Width * scale);
bmp.Height:= Round(jpg.Height * scale);
bmp.Canvas.StretchDraw(bmp.Canvas.Cliprect, jpg);
{Draw thumbnail as control}
Self.Canvas.Draw(100, 10, bmp);
{Convert back to JPEG and save to file}
jpg.Assign(bmp);
jpg.SaveToFile(
ChangeFileext(opendialog1.filename, '_thumb.JPG')
);
finally
bmp.free;
end;
finally
jpg.free;
end;
end;
end;
//-------------------------------------------------------------------------//
http://mc-computing.com/languages/delphi/images.html
http://www.swissdelphicenter.ch/de/demodownload.php?id=1945
procedure TForm1.btnBrowseClick(Sender: TObject);
var
jpg: TJPEGImage;
bmp: TBitmap;
begin
OpenPicturedialog1.InitialDir := FindImageFolder(true);
if OpenPictureDialog1.Execute then
begin
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
if Image1.Picture.Graphic is TJPEGImage then
begin
if TJPEGImage(Image1.Picture.Graphic).Grayscale then
begin
Image2.Picture.Assign(Image1.Picture.Graphic);
end else
begin
jpg := TJPEGImage.Create;
try
jpg.Assign(Image1.Picture.Graphic);
jpg.Grayscale := True;
Image2.Picture.Assign(jpg);
finally
jpg.Free;
end;
end;
end else
begin
bmp := TBitmap.Create;
try
bmp.PixelFormat := pf32bit;
bmp.Assign(Image1.Picture.Graphic);
...
Image2.Picture.Assign(bmp);
finally
bmp.Free;
end;
end;
end;
end;
//----------------------------------------------------------//
http://edn.embarcadero.com/article/40052
http://delphidabbler.com/tips/21
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Graphics_TBitmap_ScanLine.html
//----------------------------------------------------------------------//
http://docwiki.embarcadero.com/CodeExamples/XE2/en/FMXTBitmapScanLine_(Delphi)
http://www.marcocantu.com/delphipowerbook/GraphicsinDelphi_md6.pdf
https://www.swissdelphicenter.ch/en/showcode.php?id=2403
http://delphidabbler.com/tips/147
https://www.swissdelphicenter.ch/en/showcode.php?id=1896
http://www.efg2.com/Lab/ImageProcessing/Scanline.htm
https://www.cnblogs.com/shangdawei/archive/2013/05/06/3063750.html
http://edn.embarcadero.com/article/29173
http://delphi.xcjc.net/viewthread.php?tid=48929
http://wiki.lazarus.freepascal.org/Fast_direct_pixel_access
http://www.delphiforfun.org/Programs/Delphi_Techniques/BitmapChunks.htm
https://www.slusalica.net/blokatori.html
http://www.daniel-schwamm.de/index.php?pg=delphi-tutorials/picofpics
https://www.tek-tips.com/viewthread.cfm?qid=1626211
http://www.intitec.com/varios/Delphi_al_limite.pdf
procedure TForm1.Button1Click(Sender: TObject);
var
bmp: TBitmap;
jpg: TJpegImage;
scale: Double;
begin
if opendialog1.execute then
begin
jpg := TJpegImage.Create;
try
jpg.Loadfromfile(opendialog1.filename);
if jpg.Height > jpg.Width then
scale := 50 / jpg.Height
else
scale := 50 / jpg.Width;
bmp := TBitmap.Create;
try
{Create thumbnail bitmap, keep pictures aspect ratio}
bmp.Width := Round(jpg.Width * scale);
bmp.Height:= Round(jpg.Height * scale);
bmp.Canvas.StretchDraw(bmp.Canvas.Cliprect, jpg);
{Draw thumbnail as control}
Self.Canvas.Draw(100, 10, bmp);
{Convert back to JPEG and save to file}
jpg.Assign(bmp);
jpg.SaveToFile(
ChangeFileext(opendialog1.filename, '_thumb.JPG')
);
finally
bmp.free;
end;
finally
jpg.free;
end;
end;
end;
//-------------------------------------------------------------------------//
http://mc-computing.com/languages/delphi/images.html
http://www.swissdelphicenter.ch/de/demodownload.php?id=1945
procedure TForm1.btnBrowseClick(Sender: TObject);
var
jpg: TJPEGImage;
bmp: TBitmap;
begin
OpenPicturedialog1.InitialDir := FindImageFolder(true);
if OpenPictureDialog1.Execute then
begin
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
if Image1.Picture.Graphic is TJPEGImage then
begin
if TJPEGImage(Image1.Picture.Graphic).Grayscale then
begin
Image2.Picture.Assign(Image1.Picture.Graphic);
end else
begin
jpg := TJPEGImage.Create;
try
jpg.Assign(Image1.Picture.Graphic);
jpg.Grayscale := True;
Image2.Picture.Assign(jpg);
finally
jpg.Free;
end;
end;
end else
begin
bmp := TBitmap.Create;
try
bmp.PixelFormat := pf32bit;
bmp.Assign(Image1.Picture.Graphic);
...
Image2.Picture.Assign(bmp);
finally
bmp.Free;
end;
end;
end;
end;
//----------------------------------------------------------//
http://edn.embarcadero.com/article/40052
http://delphidabbler.com/tips/21
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Graphics_TBitmap_ScanLine.html
//----------------------------------------------------------------------//
{ This example shows how to draw directly to a Bitmap. It loads a bitmap from a file and then copies it to another bitmap twice it's size. Then the two bitmaps are displayed on the form canvas. } procedure TForm1.Button1Click(Sender: TObject); type TRGBTripleArray = ARRAY[Word] of TRGBTriple; pRGBTripleArray = ^TRGBTripleArray; // use a PByteArray for pf8bit color var x,y : Integer; bx, by : Integer; BitMap, BigBitMap : TBitMap; P, bigP : pRGBTripleArray; pixForm, bigpixForm : TPixelFormat; begin BitMap := TBitMap.create; BigBitMap := TBitMap.create; try BitMap.LoadFromFile('littlefac.bmp'); pixForm := BitMap.PixelFormat; bigpixForm := BigBitMap.PixelFormat; BitMap.PixelFormat := pf24bit; BigBitMap.PixelFormat := pf24bit; BigBitMap.Height := BitMap.Height * 2; BigBitMap.Width := BitMap.Width * 2; for y := 0 to BitMap.Height - 1 do begin P := BitMap.ScanLine[y]; for x := 0 to BitMap.Width - 1 do begin bx := x * 2; by := y * 2; bigP := BigBitMap.ScanLine[by]; bigP[bx] := P[x]; bigP[bx + 1] := P[x]; bigP := BigBitMap.ScanLine[by + 1]; bigP[bx] := P[x]; bigP[bx + 1] := P[x]; end; end; Canvas.Draw(0, 0, BitMap); Canvas.Draw(200, 200, BigBitMap); finally BitMap.Free; BigBitMap.Free; end; end;
//-------------------------------------------//
procedure Jpeg2Bmp(const BmpFileName, JpgFileName: string); // helloacm.com
var
Bmp: TBitmap;
Jpg: TJPEGImage;
begin
Bmp := TBitmap.Create;
Bmp.PixelFormat := pf32bit;
Jpg := TJPEGImage.Create;
try
Jpg.LoadFromFile(JpgFileName);
Bmp.Assign(Jpg);
Bmp.SaveToFile(BmpFileName);
finally
Jpg.Free;
Bmp.Free;
end;
end;
procedure Bmp2Jpeg(const BmpFileName, JpgFileName: string); // helloacm.com
var
Bmp: TBitmap;
Jpg: TJPEGImage;
begin
Bmp := TBitmap.Create;
Bmp.PixelFormat := pf32bit;
Jpg := TJPEGImage.Create;
try
Bmp.LoadFromFile(BmpFileName);
Jpg.Assign(Bmp);
Jpg.SaveToFile(JpgFileName);
finally
Jpg.Free;
Bmp.Free;
end;
end;
//-------------------------------------------------//
https://www.swissdelphicenter.ch/en/showcode.php?id=1812
http://www.davdata.nl/math/drawing1.html
procedure SZRotateBmp90(Src, Dest: TBitmap);
var
x, y : integer;
dY : array of PDWORD; // Array for destination scanline
sH, dH: integer; // Height variables
P : PDWORD; // Source pointer
begin
if Src.PixelFormat<>pf32bit then
Src.PixelFormat := pf32bit;
if Dest.PixelFormat<>pf32bit then
Dest.PixelFormat := pf32bit;
try
Dest.Width := Src.Height;
Dest.Height := Src.Width;
sH:=Src.Height-1;
dH:=Dest.Height-1;
// Initialize dynamic array
SetLength(DY,dH+1);
// Save pointers to array for acceleration
for y := 0 to dH do
DY[y] := Dest.ScanLine[y];
// Copy Src horizontal lines to be Dest vertical by +90 degree
for y := 0 to sH do
begin
P:=Src.ScanLine[y];
for x := dH downto 0 do
begin
Dy[x]^:=P^;
inc(Dy[x]);
inc(P);
end;
end;
finally
SetLength(DY,0);
end;
end;
procedure SZRotateBmp270(Src, Dest: TBitmap);
var
x, y : integer;
dY : array of PDWORD; // Array for destination scanline
sH, dH: integer; // Height variables
P : PDWORD; // Source pixel pointer
begin
if Src.PixelFormat<>pf32bit then
Src.PixelFormat := pf32bit;
if Dest.PixelFormat<>pf32bit then
Dest.PixelFormat := pf32bit;
try
Dest.Width := Src.Height;
Dest.Height := Src.Width;
sH:=Src.Height-1;
dH:=Dest.Height-1;
// Initialize dynamic array
SetLength(DY,dH+1);
// Save pointers to array for acceleration
for y := 0 to dH do
DY[y] := Dest.ScanLine[y];
// Copy Src horizontal lines to be Dest vertical by +270 degree
for y := sh downto 0 do
begin
P:=Src.ScanLine[y];
for x := 0 to dH do
begin
Dy[x]^:=P^;
inc(Dy[x]);
inc(P);
end;
end;
finally
SetLength(DY,0);
end;
end;
//---------------------------------------------//
http://www.daniel-schwamm.de/index.php?pg=delphi-tutorials/picofpics
http://www.intitec.com/varios/Delphi_al_limite.pdf
No comments:
Post a Comment
Beogradsko programiranje=