AGB  ·  Datenschutz  ·  Impressum  







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

Pixelmanipulation

Ein Thema von Hazardos · begonnen am 20. Sep 2004 · letzter Beitrag vom 18. Sep 2005
 
Gothicware

Registriert seit: 25. Aug 2005
Ort: Dresden
7 Beiträge
 
#10

Re: Pixelmanipulation

  Alt 17. Sep 2005, 19:59
Schön meine alte Unit mal im Netz wieder zufinden !

Hier mal zwei einfache Lösung:

Delphi-Quellcode:
.
.
.
procedure _SemiOpaque(src:Tbitmap; Color:TColor);
var x,y:Integer;
    p:PInteger;
begin
  src.PixelFormat:=pf32bit;
  p:= src.Scanline[Pred(src.Height)];
  for y:=1 to src.Height do
  for x:=1 to src.Width do
    begin
      if ((x+0 mod 2) = 0) and ((y mod 2) = 0) then p^:= Color;
      if ((x+1 mod 2) = 0) and ((y mod 2) <> 0) then p^:= Color;
      Inc(p);
    end;
end;

procedure _GridOpaque(src:Tbitmap; Color:TColor);
var x,y:Integer;
    p:PInteger;
begin
  src.PixelFormat:=pf32bit;
  p:= src.Scanline[Pred(src.Height)];
  for y:=1 to src.Height do
  for x:=1 to src.Width do
    begin
      if ((x+0 mod 2) = 0) and ((y mod 2) = 0) then p^:= p^ else
      if ((x+1 mod 2) = 0) and ((y mod 2) <> 0) then p^:= p^ else
      p^:= Color;
      Inc(p);
    end;
end;

procedure TGW_ImagePlus.doSemiOpaque(Color: TColor);
var tmpBmp: TBitmap;
    oldPf: TPixelFormat;
begin
  tmpBmp:= TBitmap.Create;
  tmpBmp.Assign(Picture.Bitmap);
  oldPf:= tmpBmp.PixelFormat;
  _SemiOpaque(tmpBmp, Color);
  tmpBmp.PixelFormat:= oldPf;
  Picture.Bitmap.Assign(tmpBmp);
  Picture.Bitmap.TransparentColor:= Color;
  Picture.Bitmap.TransparentMode:= tmFixed;
  Transparent:= true;
  tmpBmp.Free;
  Invalidate;
end;

procedure TGW_ImagePlus.doGridOpaque(Color: TColor);
var tmpBmp: TBitmap;
    oldPf: TPixelFormat;
begin
  tmpBmp:= TBitmap.Create;
  tmpBmp.Assign(Picture.Bitmap);
  oldPf:= tmpBmp.PixelFormat;
  _GridOpaque(tmpBmp, Color);
  tmpBmp.PixelFormat:= oldPf;
  Picture.Bitmap.Assign(tmpBmp);
  Picture.Bitmap.TransparentColor:= Color;
  Picture.Bitmap.TransparentMode:= tmFixed;
  Transparent:= true;
  tmpBmp.Free;
  Invalidate;
end;
.
.
.
Diese zwei Proceduren sind aus meiner neuen Unit, und setzen dann gleich das TImage halb Transparent,
aber das Grundprinzip ist gut zu erkennen.

MfG Gothicware.
Sometimes i think there must be a dolphin in delphi!?
  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 00:27 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