AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi About B&W film filter

About B&W film filter

Ein Thema von WojTec · begonnen am 23. Apr 2011 · letzter Beitrag vom 5. Mai 2011
Antwort Antwort
WojTec

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

About B&W film filter

  Alt 23. Apr 2011, 15:55
Paint Shop Photo -> Effects -> Photo effects -> Black and White Film

I have already this filter (without this nice circle), but don't have Suggest Color option. I don't have idea how it can work, do you have some ideas? I tried grey average color.

Miniaturansicht angehängter Grafiken
8c1cdb03867748077aece0e09242de3f.jpg  
  Mit Zitat antworten Zitat
freeway

Registriert seit: 11. Jul 2009
57 Beiträge
 
Delphi XE Professional
 
#2

AW: About B&W film filter

  Alt 3. Mai 2011, 20:31
this code should help you

Delphi-Quellcode:
type TRGBArray = array[0..10000] of TRGBTriple;
      PRGBArray = ^TRGBArray;

var R,G,B : integer; //range 0 to 100
    x,y : integer;
    d1,d2,d3 : double;
    grey : integer;
    Row : PRGBArray;

begin
  d1 := R / 100; //calc percent
  d2 := G / 100;
  d3 := B / 100;

  for y := 0 to bmp1.Height - 1 do
    begin
      row := BMP1.scanline[y];
      for x := 0 to BMP1.Width - 1 do
        with row[x] do
          begin
            grey := round((d1 * rgbtRed) + (d2 * rgbtGreen) + (d3 * rgbtBlue)); //calculate
            if grey > 255 then grey := 255; //check range
            rgbtRed := grey; //set values
            rgbtGreen := grey;
            rgbtBlue := grey;
          end;
    end;
end;
  Mit Zitat antworten Zitat
WojTec

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

Re: About B&W film filter

  Alt 4. Mai 2011, 20:16
Thanks, but could you tell me, what values are for R, G and B (calc % part)?
  Mit Zitat antworten Zitat
Benutzerbild von Aphton
Aphton

Registriert seit: 31. Mai 2009
1.198 Beiträge
 
Turbo Delphi für Win32
 
#4

AW: About B&W film filter

  Alt 4. Mai 2011, 20:52
Try using 128 for each one of them!
das Erkennen beginnt, wenn der Erkennende vom zu Erkennenden Abstand nimmt
MfG
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#5

Re: About B&W film filter

  Alt 5. Mai 2011, 09:44
Why, I don't understand?

Maybe it's average brightness (eh, nope I think) or color which is the most (or the least) in image?
  Mit Zitat antworten Zitat
freeway

Registriert seit: 11. Jul 2009
57 Beiträge
 
Delphi XE Professional
 
#6

AW: About B&W film filter

  Alt 5. Mai 2011, 17:45
if the sum from the addition (d1+d2+d3) bigger than 100 then the result is a brighter picture
for brighter colors (yellow) the result is a brighter image
you can limit the RGB values out from yellow (<100) but then you move all RGB to lower due
you can get the same result (brightness) with a darker color, the limit is 100

here with color and expanded up to 255
Delphi-Quellcode:
type TRGBArray = array[0..10000] of TRGBTriple;
     PRGBArray = ^TRGBArray;

var your_color : Tcolor; //your selected color
    R,G,B : integer;
    x,y : integer;
    d1,d2,d3 : double;
    grey : integer; //grey values
    Row : PRGBArray;

begin
  R := GetRValue(your_color); //get RGB colors
  G := GetGValue(your_color);
  B := GetBValue(your_color);
  d1 := R / 255; //convert to due
  d2 := G / 255;
  d3 := B / 255;

  for y := 0 to bmp1.Height - 1 do
    begin
      row := BMP1.scanline[y];
      for x := 0 to BMP1.Width - 1 do
        with row[x] do
          begin
            grey := round((d1 * rgbtRed) + (d2 * rgbtGreen) + (d3 * rgbtBlue)); //calculate grey due (from RGB values)
            if grey > 255 then grey := 255; //check range
            rgbtRed := grey; //set values
            rgbtGreen := grey;
            rgbtBlue := grey;
          end;
    end;
end;
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

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 11:46 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz