AGB  ·  Datenschutz  ·  Impressum  







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

[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
480 Beiträge
 
Delphi XE6 Professional
 
#1

[GR32] How to resize TBitmap32?

  Alt 12. Mär 2010, 11: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
27.541 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: [GR32] How to resize TBitmap32?

  Alt 12. Mär 2010, 12: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
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Antwort Antwort


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 · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:56 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz