Hello Dibo,
Nice work !
I saw that you were looking for an idea with gradients on buttons.
Here is suggestion for DrawBasicBody procedure in BGRAButton :
case ABody.FStyle of
bbsClear, bbsColor:
{ Solid background color }
FBGRA.RoundRectAntialias(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY,
borcolor, FBorderWidth, backcolor);
bbsGradient:
begin
{ Using multishape filler to merge background gradient and border }
multi := TBGRAMultishapeFiller.Create;
multi.PolygonOrder := poFirstOnTop; { Border will replace background }
if borcolor.alpha <> 0 then { Let the background be wider with transparent border }
multi.AddRoundRectangleBorder(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY,
FBorderWidth, borcolor);
{ Gradients }
back := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAPixelTransparent);
grect1 := ARect;
grect2 := ARect;
{ Gradient 1 }
if ABody.FGradient1EndPercent>0 then
begin
grect1.Bottom := Round((grect1.Bottom/100)*ABody.FGradient1EndPercent);
gra := CreateGradient(ABody.FGradient1, grect1);
back.FillRect(grect1.Left,grect1.Top,grect1.Right,grect1.Bottom,
gra,dmSet
);
gra.Free;
end;
{ Gradient 2 }
if ABody.FGradient1EndPercent<100 then
begin
if grect1.Bottom<ARect.Bottom then
grect2.Top := grect1.Bottom-1;
gra := CreateGradient(ABody.FGradient2, grect2);
back.FillRect(grect2.Left,grect2.Top,grect2.Right,grect2.Bottom,
gra,dmSet
);
gra.Free;
end;
multi.AddRoundRectangle(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom,FRoundX,FRoundY, back);
multi.Draw(FBGRA);
multi.Free;
back.Free;
end;
end;