AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Image2Icon

Ein Thema von bernhard_LA · begonnen am 1. Feb 2013 · letzter Beitrag vom 1. Feb 2013
 
Popov
(Gast)

n/a Beiträge
 
#2

AW: Image2Icon

  Alt 1. Feb 2013, 21:25
Ja, ihr skaliert wahrscheinlich hart satt weich, da geht u. U. viel verloren.

Teste das mal. Noch kein Icon, aber weiches skalieren:

Delphi-Quellcode:
procedure StretchBitmap(BmpQ, BmpZ: TBitmap; f: Double);
var
  TmpBmpQ, TmpBmpZ: TBitmap;
begin
  TmpBmpQ := TBitmap.Create;
  try
    TmpBmpQ.PixelFormat := pf24Bit;
    TmpBmpQ.Assign(BmpQ);

    TmpBmpZ := TBitmap.Create;
    try
      TmpBmpZ.Width := Round(TmpBmpQ.Width * f);
      TmpBmpZ.Height := Round(TmpBmpQ.Height * f);

      SetStretchBltMode(TmpBmpZ.Canvas.Handle, Halftone);

      StretchBlt(
        TmpBmpZ.Canvas.Handle, 0, 0, TmpBmpZ.Width, TmpBmpZ.Height,
        TmpBmpQ.Canvas.Handle, 0, 0, TmpBmpQ.Width, TmpBmpQ.Height,
        SRCCOPY);

      BmpZ.Assign(TmpBmpZ);
    finally
      TmpBmpZ.Free;
    end;
  finally
    TmpBmpQ.Free;
  end;
end;

function GetScreenShot: TBitmap;
var
  Desktop: HDC;
begin
  Result := TBitmap.Create;
  Desktop := GetDC(0);
  try
    try
      Result.PixelFormat := pf32bit;
      Result.Width := Screen.Width;
      Result.Height := Screen.Height;
      BitBlt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, Desktop, 0, 0, SRCCOPY);
      Result.Modified := True;
    finally
      ReleaseDC(0, Desktop);
    end;
  except
    Result.Free;
    Result := nil;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Bmp: TBitmap;
begin
  try
    Bmp := GetScreenShot;
    StretchBitmap(Bmp, Bmp, 0.05);
    Canvas.Draw(0,0,Bmp);
  finally
    Bmp.Free;
  end;
end;
  Mit Zitat antworten Zitat
 


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 06:16 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz