|
@@ -20,9 +20,9 @@ type
|
|
|
type
|
|
|
TBorderAndBackground = class
|
|
|
public
|
|
|
- BorderLeft, BorderTop, BorderRight, BorderBottom: TFresnelLength;
|
|
|
+ BorderWidth: array[TFresnelCSSFourSides] of TFresnelLength;
|
|
|
BackgroundColorFP: TFPColor;
|
|
|
- BorderColorFP: TFPColor;
|
|
|
+ BorderColor: array[TFresnelCSSFourSides] of TFPColor;
|
|
|
end;
|
|
|
protected
|
|
|
FOrigin: TFresnelPoint;
|
|
@@ -66,35 +66,30 @@ procedure TFresnelRenderer.DrawElBorder(El: TFresnelElement;
|
|
|
var
|
|
|
BorderBox: TFresnelRect;
|
|
|
i: Integer;
|
|
|
+ s: TFresnelCSSFourSides;
|
|
|
+ c: TFPColor;
|
|
|
begin
|
|
|
- if (Params.BackgroundColorFP.Alpha=alphaTransparent)
|
|
|
- and (Params.BorderColorFP.Alpha=alphaTransparent) then
|
|
|
- exit;
|
|
|
-
|
|
|
BorderBox:=El.RenderedBorderBox;
|
|
|
if not SubPixel then
|
|
|
MathRoundRect(BorderBox);
|
|
|
|
|
|
if Params.BackgroundColorFP.Alpha<>alphaTransparent then
|
|
|
begin
|
|
|
- FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing background %s',[El.GetPath]);
|
|
|
+ //FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing background %s',[El.GetPath]);
|
|
|
FillRect(Params.BackgroundColorFP,BorderBox);
|
|
|
end;
|
|
|
- if Params.BorderColorFP.Alpha<>alphaTransparent then
|
|
|
+ //FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing border %s',[El.GetPath]);
|
|
|
+ for s in TFresnelCSSFourSides do
|
|
|
begin
|
|
|
- FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing border %s',[El.GetPath]);
|
|
|
- // left border
|
|
|
- for i:=0 to Ceil(Params.BorderLeft)-1 do
|
|
|
- Line(Params.BorderColorFP,BorderBox.Left+i,BorderBox.Top,BorderBox.Left+i,BorderBox.Bottom);
|
|
|
- // right border
|
|
|
- for i:=0 to ceil(Params.BorderRight)-1 do
|
|
|
- Line(Params.BorderColorFP,BorderBox.Right-i,BorderBox.Top,BorderBox.Right-i,BorderBox.Bottom);
|
|
|
- // top border
|
|
|
- for i:=0 to ceil(Params.BorderTop)-1 do
|
|
|
- Line(Params.BorderColorFP,BorderBox.Left,BorderBox.Top+i,BorderBox.Right,BorderBox.Top+i);
|
|
|
- // bottom border
|
|
|
- for i:=0 to ceil(Params.BorderBottom)-1 do
|
|
|
- Line(Params.BorderColorFP,BorderBox.Left,BorderBox.Bottom-i,BorderBox.Right,BorderBox.Bottom-i);
|
|
|
+ c:=Params.BorderColor[s];
|
|
|
+ if c.Alpha=alphaTransparent then continue;
|
|
|
+ for i:=0 to ceil(Params.BorderWidth[s])-1 do
|
|
|
+ case s of
|
|
|
+ ffsLeft: Line(c,BorderBox.Left+i,BorderBox.Top,BorderBox.Left+i,BorderBox.Bottom);
|
|
|
+ ffsTop: Line(c,BorderBox.Left,BorderBox.Top+i,BorderBox.Right,BorderBox.Top+i);
|
|
|
+ ffsRight: Line(c,BorderBox.Right-i,BorderBox.Top,BorderBox.Right-i,BorderBox.Bottom);
|
|
|
+ ffsBottom: Line(c,BorderBox.Left,BorderBox.Bottom-i,BorderBox.Right,BorderBox.Bottom-i);
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -109,6 +104,7 @@ var
|
|
|
aBorderBox, aContentBox: TFresnelRect;
|
|
|
BorderParams: TBorderAndBackground;
|
|
|
aRenderable : IFresnelRenderable;
|
|
|
+ s: TFresnelCSSFourSides;
|
|
|
|
|
|
begin
|
|
|
FLLog(etDebug,'TFresnelRenderer.DrawElement %s Origin=%s',[El.GetPath,Origin.ToString]);
|
|
@@ -153,18 +149,21 @@ begin
|
|
|
|
|
|
BorderParams:=TBorderAndBackground.Create;
|
|
|
try
|
|
|
- BorderParams.BorderLeft:=aBorderLeft;
|
|
|
- BorderParams.BorderTop:=aBorderTop;
|
|
|
- BorderParams.BorderRight:=aBorderRight;
|
|
|
- BorderParams.BorderBottom:=aBorderBottom;
|
|
|
+ BorderParams.BorderWidth[ffsLeft]:=aBorderLeft;
|
|
|
+ BorderParams.BorderWidth[ffsTop]:=aBorderTop;
|
|
|
+ BorderParams.BorderWidth[ffsRight]:=aBorderRight;
|
|
|
+ BorderParams.BorderWidth[ffsBottom]:=aBorderBottom;
|
|
|
|
|
|
aBackgroundColor:=El.CSSRenderedAttribute[fcaBackgroundColor];
|
|
|
if not CSSToFPColor(aBackgroundColor,BorderParams.BackgroundColorFP) then
|
|
|
BorderParams.BackgroundColorFP:=colTransparent;
|
|
|
|
|
|
- aBorderColor:=El.CSSRenderedAttribute[fcaBorderColor];
|
|
|
- if not CSSToFPColor(aBorderColor,BorderParams.BorderColorFP) then
|
|
|
- BorderParams.BorderColorFP:=colTransparent;
|
|
|
+ for s in TFresnelCSSFourSides do
|
|
|
+ begin
|
|
|
+ aBorderColor:=El.CSSRenderedAttribute[TFresnelCSSAttribute(ord(fcaBorderLeftColor)+ord(s))];
|
|
|
+ if not CSSToFPColor(aBorderColor,BorderParams.BorderColor[s]) then
|
|
|
+ BorderParams.BorderColor[s]:=colTransparent;
|
|
|
+ end;
|
|
|
|
|
|
DrawElBorder(El,BorderParams);
|
|
|
finally
|