|
From: Andr? S. <asn...@us...> - 2004-01-27 05:42:25
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30271/JVCL3/run Modified Files: JvJVCLUtils.pas Log Message: fix, source text layout GradientFillRect Index: JvJVCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJVCLUtils.pas,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** JvJVCLUtils.pas 25 Jan 2004 21:41:36 -0000 1.69 --- JvJVCLUtils.pas 25 Jan 2004 21:50:52 -0000 1.70 *************** *** 2504,2531 **** RGBDelta[2] := GetBValue(StartColor) - StartRGB[2]; end; ! end; ! { Calculate the color band's coordinates } ! ColorBand := ARect; ! if Direction in [fdTopToBottom, fdBottomToTop] then ! begin ! Colors := Max(2, Min(Colors, RectHeight(ARect))); ! Delta := RectHeight(ARect) div Colors; ! end ! else ! begin ! Colors := Max(2, Min(Colors, RectWidth(ARect))); ! Delta := RectWidth(ARect) div Colors; ! end; ! with Canvas.Pen do ! begin { Set the pen style and mode } ! Style := psSolid; ! Mode := pmCopy; ! end; ! { Perform the fill } ! if Delta > 0 then ! begin ! for i := 0 to Colors do begin ! case Direction of { Calculate the color band's top and bottom coordinates } fdTopToBottom, fdBottomToTop: --- 2504,2531 ---- RGBDelta[2] := GetBValue(StartColor) - StartRGB[2]; end; ! end; ! { Calculate the color band's coordinates } ! ColorBand := ARect; ! if Direction in [fdTopToBottom, fdBottomToTop] then begin ! Colors := Max(2, Min(Colors, RectHeight(ARect))); ! Delta := RectHeight(ARect) div Colors; ! end ! else ! begin ! Colors := Max(2, Min(Colors, RectWidth(ARect))); ! Delta := RectWidth(ARect) div Colors; ! end; ! with Canvas.Pen do ! begin { Set the pen style and mode } ! Style := psSolid; ! Mode := pmCopy; ! end; ! { Perform the fill } ! if Delta > 0 then ! begin ! for i := 0 to Colors do ! begin ! case Direction of { Calculate the color band's top and bottom coordinates } fdTopToBottom, fdBottomToTop: *************** *** 2540,2560 **** ColorBand.Right := ColorBand.Left + Delta; end; ! end; { Calculate the color band's color } ! Brush := CreateSolidBrush(RGB( ! StartRGB[0] + MulDiv(i, RGBDelta[0], Colors - 1), ! StartRGB[1] + MulDiv(i, RGBDelta[1], Colors - 1), ! StartRGB[2] + MulDiv(i, RGBDelta[2], Colors - 1))); ! FillRect(Canvas.Handle, ColorBand, Brush); ! DeleteObject(Brush); end; ! end; ! if Direction in [fdTopToBottom, fdBottomToTop] then ! Delta := RectHeight(ARect) mod Colors ! else ! Delta := RectWidth(ARect) mod Colors; ! if Delta > 0 then ! begin ! case Direction of { Calculate the color band's top and bottom coordinates } fdTopToBottom, fdBottomToTop: --- 2540,2560 ---- ColorBand.Right := ColorBand.Left + Delta; end; ! end; { Calculate the color band's color } ! Brush := CreateSolidBrush(RGB( ! StartRGB[0] + MulDiv(i, RGBDelta[0], Colors - 1), ! StartRGB[1] + MulDiv(i, RGBDelta[1], Colors - 1), ! StartRGB[2] + MulDiv(i, RGBDelta[2], Colors - 1))); ! FillRect(Canvas.Handle, ColorBand, Brush); ! DeleteObject(Brush); ! end; end; ! if Direction in [fdTopToBottom, fdBottomToTop] then ! Delta := RectHeight(ARect) mod Colors ! else ! Delta := RectWidth(ARect) mod Colors; ! if Delta > 0 then ! begin ! case Direction of { Calculate the color band's top and bottom coordinates } fdTopToBottom, fdBottomToTop: *************** *** 2569,2584 **** ColorBand.Right := ColorBand.Left + Delta; end; ! end; ! case Direction of fdTopToBottom, fdLeftToRight: ! Brush := CreateSolidBrush(EndColor); ! else {fdBottomToTop, fdRightToLeft } ! Brush := CreateSolidBrush(StartColor); end; ! FillRect(Canvas.Handle, ColorBand, Brush); ! DeleteObject(Brush); ! end; {$IFDEF VisualCLX} - end; // if Not (IsRectEmpty(ARect) and ... finally Canvas.Stop; --- 2569,2584 ---- ColorBand.Right := ColorBand.Left + Delta; end; ! end; ! case Direction of fdTopToBottom, fdLeftToRight: ! Brush := CreateSolidBrush(EndColor); ! else {fdBottomToTop, fdRightToLeft } ! Brush := CreateSolidBrush(StartColor); ! end; ! FillRect(Canvas.Handle, ColorBand, Brush); ! DeleteObject(Brush); end; ! end; // if Not (IsRectEmpty(ARect) and ... {$IFDEF VisualCLX} finally Canvas.Stop; |