AGB  ·  Datenschutz  ·  Impressum  







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

Blending

Ein Thema von Peter666 · begonnen am 30. Mär 2017 · letzter Beitrag vom 31. Mär 2017
Antwort Antwort
Benutzerbild von stahli
stahli

Registriert seit: 26. Nov 2003
Ort: Halle/Saale
4.352 Beiträge
 
Delphi 11 Alexandria
 
#1

AW: Blending

  Alt 30. Mär 2017, 10:15
Such mal in der DP nach AlphaBlend, ob Dir da etwas hilft (das bezieht sich aber dann direkt auf Canvas-Bearbeitungen).

Ansonsten beschreib mal noch kurz, was Du mit der Funktion erreichen willst.
Stahli
http://www.StahliSoft.de
---
"Jetzt muss ich seh´n, dass ich kein Denkfehler mach...!?" Dittsche (2004)
  Mit Zitat antworten Zitat
Peter666

Registriert seit: 11. Aug 2007
357 Beiträge
 
#2

AW: Blending

  Alt 30. Mär 2017, 12:41
Danke, Alphablending ist etwas anderes.

Delphi-Quellcode:
function Scale32(const scale: Byte; const p: cardinal): cardinal;
var
  ag, rb: cardinal;
  sag, srb: cardinal;
begin
  ag := (p and $FF00FF00) shr 8;
  rb := p and $00FF00FF;

  sag := scale * ag;
  srb := scale * rb;

  sag := sag and $FF00FF00;
  srb := srb shr 8 and $00FF00FF;

  result := sag or srb;
end;

function blend_alpha(src, tgt: cardinal): cardinal;
var
  alpha, invalpha: Byte;
begin
  alpha := (tgt shr 24) and $FF;
  invalpha := $FF - alpha;

  result := Scale32(alpha, tgt) + Scale32(invalpha, src);
end;
Das ist nicht das Problem. Additive ist etwas anderes: http://www.learnopengles.com/tag/additive-blending/
  Mit Zitat antworten Zitat
Benutzerbild von Neutral General
Neutral General

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

AW: Blending

  Alt 30. Mär 2017, 12:56
Ich bin alles andere als ein Profi was OpenGL oder Blending angeht aber kann mans nicht so machen?
Delphi-Quellcode:
// Nur RGB, ohne Alpha (lässt sich aber erweitern bei Bedarf)
function AdditiveBlend(A,B: Cardinal): Cardinal;
begin
  Result := Min((A and $FF) + (B and $FF), $FF) or (Min(((A shr 8) and $FF) + ((B shr 8) and $FF), $FF) shl 8) or (Min(((A shr 16) and $FF) + ((B shr 16) and $FF), $FF) shl 16);
end;
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
EWeiss
(Gast)

n/a Beiträge
 
#4

AW: Blending

  Alt 30. Mär 2017, 14:18
Das was du vermutlich machen möchtest ist fast\gleiche wie mit GDI+
Wenn dem so ist dann geht das über eine ColorMatrix oder mit Compositing Mode.

Delphi-Quellcode:
  // Initialize the color matrix.
  // Notice the value 0.8 in row 4, column 4.
  ColorMatrix: TColorMatrix =
   ((1.0, 0.0, 0.0, 0.0, 0.0),
    (0.0, 1.0, 0.0, 0.0, 0.0),
    (0.0, 0.0, 1.0, 0.0, 0.0),
    (0.0, 0.0, 0.0, 0.5, 0.0),
    (0.0, 0.0, 0.0, 0.0, 1.0));
Vielleicht kannst du dir dort etwas abschauen.

gruss

Geändert von EWeiss (11. Jul 2019 um 15:47 Uhr)
  Mit Zitat antworten Zitat
bra

Registriert seit: 20. Jan 2015
711 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#5

AW: Blending

  Alt 30. Mär 2017, 15:04
Der Kommentar passt aber auch nicht ganz zum Inhalt

// Initialize the color matrix.
// Notice the value 0.8 in row 4, column 4.
ColorMatrix: TColorMatrix =
((1.0, 0.0, 0.0, 0.0, 0.0),
(0.0, 1.0, 0.0, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0, 0.0),
(0.0, 0.0, 0.0, 0.5, 0.0),
(0.0, 0.0, 0.0, 0.0, 1.0));
  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 03:37 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