AGB  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi [GR32] How to resize TBitmap32?

[GR32] How to resize TBitmap32?

Ein Thema von WojTec · begonnen am 12. Mär 2010 · letzter Beitrag vom 12. Mär 2010
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
243 Beiträge
 
Delphi 2010 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
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
20.257 Beiträge
 
Delphi XE Professional
 
#2

Re: [GR32] How to resize TBitmap32?

  Alt 12. Mär 2010, 13:22
I am not familiar with TBitmap32, but when is this object being freed?
Zitat:
RESAMPLER[2].Create(Image32.Bitmap);
I guess this is the reason for the memory leak, you should store it in a variable which you can free when it is no longer needed.
Detlef
Wenn Dein Programm nicht macht, was es soll, nenn es einfach "Version 1.0"

Delphi programming is cool
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:38 Uhr.
Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2012 by Daniel R. Wolf