AGB  ·  Datenschutz  ·  Impressum  







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

Color mixer

Ein Thema von WojTec · begonnen am 27. Dez 2011 · letzter Beitrag vom 17. Aug 2012
Antwort Antwort
Medium

Registriert seit: 23. Jan 2008
3.688 Beiträge
 
Delphi 2007 Enterprise
 
#1

AW: Color mixer

  Alt 26. Mai 2012, 20:26
Internal color calculation should always be done in floating point, unless for realtime purposes. Usually channels (regardless of the color model) are considered to range from 0 to 1 (exception: YCC, where chroma is -.5 to .5). Only when performing the actual drawing, the float colors are scaled into the target image's color format. That way you would not have the problem, and also minimize quantization errors across the entire application, that are quite prone to emerge when doing multiple and different processes on the same image.

I do not however understand your issue with the (C)CW gradients. CCW -> blend Color1 to Color2. CW -> blend Color2 to Color1, and reverse the resulting list of colors.
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)
  Mit Zitat antworten Zitat
freeway

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

AW: Color mixer

  Alt 26. Mai 2012, 21:32
what you call gradient is the result from HSL wheel reduced to 100

if you add the colors and the result goes over 100 what will you get then ?

100 - actual value = new value
  Mit Zitat antworten Zitat
WojTec

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

Re: Color mixer

  Alt 16. Aug 2012, 17:21
I'm trying and nothing

For blend in HSL I have this. Please, how to get what I'm talking about
  Mit Zitat antworten Zitat
WojTec

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

Re: Color mixer

  Alt 17. Aug 2012, 13:35
Delphi-Quellcode:
var
  RGB: array [0..2] of Byte;
  HSL1, HSL2: array [0..2] of Integer;
  H, S, L: Integer;
begin
  // get values here

  // Max* vars are = 256
  H := Round((MaxHue / ARange) * AValue) * (HSL2[0] - HSL1[0]) shr 8 + HSL1[0];
  S := Round((MaxSat / ARange) * AValue) * (HSL2[1] - HSL1[1]) shr 8 + HSL1[1];
  L := Round((MaxLum / ARange) * AValue) * (HSL2[2] - HSL1[2]) shr 8 + HSL1[2];

  /// set color here
end;

SetLength(A, Round(edtSteps.Value) + 2);
A[0] := Color1;
A[High(A)] := Color2;

N := 255 div (Round(edtSteps.Value) + 1);
X := 0;
Caption := IntToStr(N);
for I := 1 to High(A) - 1 do
begin
  Inc(X, N);
  A[I] := BlendColorsHueCW(Color1, Color2, Byte(X), 255);
end;
F1

Geändert von WojTec (17. Aug 2012 um 13:46 Uhr)
  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 16:57 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