AGB  ·  Datenschutz  ·  Impressum  







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

Abgerundete Ecken

Ein Thema von Moony · begonnen am 21. Feb 2008 · letzter Beitrag vom 5. Mai 2008
 
Moony

Registriert seit: 29. Jul 2003
Ort: Essen
454 Beiträge
 
Delphi 2010 Professional
 
#10

Re: Abgerundete Ecken

  Alt 5. Mai 2008, 09:36
Hallo,

ich habe das jetzt so gemacht:

Delphi-Quellcode:
procedure DoItRound;
var bmp_mask,
      bmp_tmp : TBitmap;

const cl_trans_tmp = clWhite;
      cl_trans = clFuchsia;
begin
  bmp_mask := TBitmap.create;
  bmp_tmp := TBitmap.create;
  try
     //load bitmap
     bmp_tmp.Assign(Form1.image1.picture.bitmap);
     //resize mask
     bmp_mask.width := bmp_tmp.width;
     bmp_mask.height := bmp_tmp.height;
     //create the mask;
     bmp_mask.canvas.brush.color := cl_trans;
     bmp_mask.canvas.Pen.color := cl_trans;
     bmp_mask.Canvas.FillRect(rect(0,0,bmp_mask.width,bmp_mask.height));
     bmp_mask.canvas.brush.color := cl_trans_tmp;
     bmp_mask.canvas.Pen.color := cl_trans_tmp;
     bmp_mask.canvas.RoundRect(0,0,bmp_mask.width,bmp_mask.height, 10,10);
     bmp_mask.TransparentColor := cl_trans_tmp;
     bmp_mask.Transparent := true;

     //merging the mask with original bitmap
     bmp_tmp.Canvas.Draw(0,0,bmp_mask);
     bmp_tmp.TransparentColor := cl_trans;
     bmp_tmp.Transparent := true;

     //Draw masked bitmap
     Form1.Image2.canvas.draw(0,0,bmp_tmp);
  finally
     //free Objects
     bmp_tmp.free;
     bmp_mask.free;
  end;
end;
Leider wird hier nur das Bild reingezeichnet ohne jegliche runde Ecken.
Zeichne ich das Ganze anstatt auf das Image2 auf mein Canvas der Form1, dann funktioniert das.

In meinem Programm zeichne ich aber auf das Canvas eines Imageobjektes und nicht auf das Canvas der Form.

Gruß, Moony
Ich weiß, daß ich nichts weiß! Sokrates
  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 13:10 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