Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

[GR32] How to resize TBitmap32?

  Alt 12. Mär 2010, 12:50
Hi, I have problem with TBitmap32 resizing Here is my code:

Delphi-Quellcode:
const
  RESAMPLER: array [0..2] of TBitmap32ResamplerClass = (TNearestResampler,
    TLinearResampler, TDraftResampler
  );
var
  B: TBitmap32;
begin
  with TResamplingSettings.Create(Image32.Bitmap.Width, Image32.Bitmap.Height) do
  begin
    if Execute then
    begin
      B := TBitmap32.Create;
      try
        RESAMPLER[2].Create(Image32.Bitmap);

        B.Resampler := Image32.Bitmap.Resampler;
        B.SetSizeFrom(Image32.Bitmap);
        B.Assign(Image32.Bitmap);

        Image32.Bitmap.SetSize(ImageWidth, ImageHeight);
        Image32.Bitmap.Draw(Rect(0, 0, Image32.Bitmap.Width, Image32.Bitmap.Height),
          Image32.Bitmap.BoundsRect, B
        );
      finally
        B.Free;
      end;
    end;
  end;
end;

// TResamplingSettings - window, where can set new size
// Image32 - component where is bitmap
// ImageWidth, ImageHeight - properties from TResamplingSettings
So, this only do well new size, can't correctly repaint old bitmap in new size and causes memory leak (large blocks). I have GR32 1.83. Could you help?
  Mit Zitat antworten Zitat