AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Alphablend bei Farben
Thema durchsuchen
Ansicht
Themen-Optionen

Alphablend bei Farben

Ein Thema von Neutral General · begonnen am 23. Feb 2007 · letzter Beitrag vom 24. Feb 2007
 
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#9

Re: Alphablend bei Farben

  Alt 23. Feb 2007, 15:34
Zitat von SirThornberry:
Dann ist dein A nicht vom Type Byte
ups

Delphi-Quellcode:
const
  COLOR_GROUND = TColor($00004080);
  COLOR_GROUND_R = Byte(COLOR_GROUND);
  COLOR_GROUND_G = Byte(COLOR_GROUND shr 8);
  COLOR_GROUND_B = Byte(COLOR_GROUND shr 16);

function TTile.GetAlphaColorValue(Current,Max: Word): TColor;
var p: Single;
    r,g,b: Byte;
    i: Byte;
begin
  p:= Current / Max;
  p:= p*255;
  i:= round(p);

  r:= GetRValue(FBColor);
  g:= GetGValue(FBColor);
  b:= GetBValue(FBColor);

  RGB((i*R+(not i)*COLOR_GROUND_R) div 255,
      (i*G+(not i)*COLOR_GROUND_G) div 255,
      (i*B+(not i)*COLOR_GROUND_B) div 255);
end;
So. Das ist im Moment meine Function. Die funktioniert auch, ABER das muss schneller!

Weil:

Delphi-Quellcode:
procedure TForm1.PaintMap;
var x,y: Integer;
    P: PRGBTriple;
begin
    for y:= 0 to High(FMap) do
    begin
      P := FBitmap.ScanLine[y];
      for x:= 0 to High(FMap[y]) do
      begin
        P^.rgbtRed := GetRValue(FMap[y,x].Color); // Der Setter von Color ruft GetAlphaColorValue auf
        P^.rgbtGreen := GetGValue(FMap[y,x].Color);
        P^.rgbtBlue := GetBValue(FMap[y,x].Color);
        inc(P);
      end;
    end;
    Image1.Picture.Bitmap.Assign(FBitmap);
end;
Und wenn ich so ein 1024*768 Bild male dann dauert das (fast) ne halbe Sekunde.. aber ich will das Bild mindestens jede halbe Sekunde malen *g*. Wie kann man das ganze am besten optimieren?

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  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 09:23 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