AGB  ·  Datenschutz  ·  Impressum  







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

[GR32] How to blend two TBitmap32s

Ein Thema von WojTec · begonnen am 19. Sep 2010 · letzter Beitrag vom 19. Sep 2010
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

[GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 15:45
I don't know how to blend two bitmaps if these bitmaps are not layers. For layers I'm using OnPixelCombine with assigned procedures like this:

procedure Multiply(F: TColor32; var B: TColor32; M: TColor32);

I tried this:
Delphi-Quellcode:
function ColorAlgebra(F, B, M: TColor32): TColor32;
begin
  BlendMode.Multiply(F, B, M); // the same procedure for OnPixelCombine
  Result := BlendRegEx(F, B, M);
end;

BlendTransfer(Blended, 0, 0, Blended.BoundsRect, ImageMap, ImageMap.BoundsRect,
  ShapeMap, ShapeMap.BoundsRect, ColorAlgebra, 200
);
but MasterAlpha parasm work diffrent than master alpha in top layer (opacity). This param decide which bitmap should be more visible (0 = first, 255 = second). How to blend bitmaps like layers?
  Mit Zitat antworten Zitat
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#2

AW: [GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 15:52
Why so complicated? I've always simply done it like this:
Delphi-Quellcode:
var
  A,B: TBitmap32;
begin
  [...]
  A.MasterAlpha := 127; // 50%
  A.DrawMode := dmBlend;
  A.DrawTo(B, 0, 0);
  // B now contains the blended image
  [...]
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#3

Re: [GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 16:08
Delphi-Quellcode:
    ImageMap.DrawMode := dmBlend;
    ImageMap.OnPixelCombine := BlendMode.Multiply;
    ImageMap.MasterAlpha := 0;
    ImageMap.DrawTo(ShapeMap, 0, 0);

    Image321.Bitmap.Assign(ShapeMap);
I tried and effect is identical.
  Mit Zitat antworten Zitat
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#4

AW: [GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 16:20
What effect is identical? It'd really help if you were more specific about what you want to achieve and what is happening instead.
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.875 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: [GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 16:26
Perhaps show a screenshot or similar
Markus Kinzler
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#6

Re: [GR32] How to blend two TBitmap32s

  Alt 19. Sep 2010, 17:14
Ok guys, please look at attached picture:

I want to blend 2 with 1 and get 5. In my method I got 3, in @NamenLozer's method I got 4. In my program that suppots layers I got 5 and this is valid effct (opacity is 100%, white is not visible). Are you understand what I mean? I want to get 5 effect without layers.

@mkinzler, thanks for advise
Angehängte Grafiken
Dateityp: jpg i.jpg (78,7 KB, 56x aufgerufen)
  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 09:50 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