AGB  ·  Datenschutz  ·  Impressum  







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

Farbkreis

Ein Thema von antipanni · begonnen am 21. Okt 2007 · letzter Beitrag vom 21. Okt 2007
Antwort Antwort
antipanni

Registriert seit: 2. Okt 2007
9 Beiträge
 
#1

Farbkreis

  Alt 21. Okt 2007, 14:47
Hallo allerseits!
wie kann ich in delphi einen farbkreis zeichnen?
  Mit Zitat antworten Zitat
kalmi01
(Gast)

n/a Beiträge
 
#2

Re: Farbkreis

  Alt 21. Okt 2007, 15:01
Meinst Du so einen mit Farbverlauf, wie hier unter Vorschau-Bildern zu sehen ist ?
  Mit Zitat antworten Zitat
antipanni

Registriert seit: 2. Okt 2007
9 Beiträge
 
#3

Re: Farbkreis

  Alt 21. Okt 2007, 15:20
ja genau so einen meine ich! weißt du wie das geht?
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

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

Re: Farbkreis

  Alt 21. Okt 2007, 15:22
http://www.torry.net/quicksearchd.ph...cker&Title=Yes
Markus Kinzler
  Mit Zitat antworten Zitat
antipanni

Registriert seit: 2. Okt 2007
9 Beiträge
 
#5

Re: Farbkreis

  Alt 21. Okt 2007, 15:43
alles schön und gut aber das bringt mir nix!
ich muss mit hilfe des quelltextes und einigen objekten, die ich ins formblatt einfügen kann, diesen farbkreis erstellen!
  Mit Zitat antworten Zitat
kalmi01
(Gast)

n/a Beiträge
 
#6

Re: Farbkreis

  Alt 21. Okt 2007, 15:58
Zitat von antipanni:
ja genau so einen meine ich! weißt du wie das geht?
so z.B.:
Delphi-Quellcode:
    procedure TInsertCodeForm.DrawColorCircle(const Size, HueLevel, SaturationLevel, ValueLevel : integer;
                                              const BackgroundColor : TColor;
                                              var BMP : TBitmap);
      function RGBtoRGBTriple(const red, green, blue : byte) : TRGBTriple;
        begin
          with Result
          do begin
               rgbtRed := red;
               rgbtGreen := green;
               rgbtBlue := blue
             end;
        end;
      function HSVtoRGBTriple (const H, S, V : integer ) : TRGBTriple;
        const
          divisor : integer = 255*60;
        var
          f,
          hTemp,
          p, q, t,
          VS : integer;
        begin
          if (S = 0)
          then Result := RGBtoRGBTriple(V, V, V) // achromatic: shades of gray
          else begin // chromatic color
                 if (H = 360)
                 then hTemp := 0
                 else hTemp := H;

                 f := hTemp mod 60; // f is IN [0, 59]
                 hTemp := hTemp div 60; // h is now IN [0,6)

                 VS := V*S;
                 p := V - VS div 255; // p = v * (1 - s)
                 q := V - (VS*f) div divisor; // q = v * (1 - s*f)
                 t := V - (VS*(60 - f)) div divisor; // t = v * (1 - s * (1 - f))

                 case hTemp of
                   0: Result := RGBtoRGBTriple(V, t, p);
                   1: Result := RGBtoRGBTriple(q, V, p);
                   2: Result := RGBtoRGBTriple(p, V, t);
                   3: Result := RGBtoRGBTriple(p, q, V);
                   4: Result := RGBtoRGBTriple(t, p, V);
                   5: Result := RGBtoRGBTriple(V, p, q);
                 else Result := RGBtoRGBTriple(0, 0, 0);
                 end;
               end;
        end;

      var
        dSquared,
        H, S, V,
        i, j,
        Radius,
        RadiusSquared,
        X, Y : integer;
        row : pRGBTripleArray;
      begin
        BMP.PixelFormat := pf24bit;
        BMP.Width := Size;
        BMP.Height := Size;

        // Fill with background color
        BMP.Canvas.Brush.Color := BackGroundColor;
        BMP.Canvas.FillRect(bmp.Canvas.ClipRect);

        Radius := size div 2;
        RadiusSquared := Radius*Radius;

        V := ValueLevel;
        for j := 0 to bmp.Height-1
        do begin
             Y := Size - 1 - j - Radius; {Center is Radius offset}
             row := BMP.Scanline[Size - 1 - j];

             for i := 0 to BMP.Width - 1
             do begin
                  X := i - Radius;
                  dSquared := (X * X) + (Y * Y);

                  if dSquared <= RadiusSquared
                  then begin
                         S := Round((255 * Sqrt(dSquared)) / Radius);
                         H := Round(180 * (1 + ArcTan2(X, Y) / PI)); // 0..360 degrees

                         // Shift 90 degrees so H=0 (red) occurs along "X" axis
                         H := H + 90;
                         if (H > 360)
                         then H := H - 360;

                         row[i] := HSVtoRGBTriple(H, S, V);
                       end;
                end;
           end;
      end;
fand ich lustiger, als die ganzen Bitmap-Lösungen.

Quellenangabe: aus diversen fremden Quellen zusammengebastelt und mit eigenem Mist verfeinert
Nur damit keiner behauptet, ich würde mich mit fremden Federn schmücken
  Mit Zitat antworten Zitat
antipanni

Registriert seit: 2. Okt 2007
9 Beiträge
 
#7

Re: Farbkreis

  Alt 21. Okt 2007, 16:18
Thank you very much englisch sprechen ist quatsch
  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 01:03 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