procedure InsertColorStop(offsetFrac: single; color: TColor32);
Apart from innermost and outermost gradient colors (see SetParameters), additional colors can be inserted into the color gradient. The innermost color's offset is 0 (zero) and the outermost color's offset is 1, so when inserting additional colors into the gradient, the 'offsetFrac' parameter needs to be between 0 and 1.
uses Img32, Img32.Fmt.PNG, Img32.vector, Img32.Draw; ... var img: TImage32; path: TPathD; rec: TRect; radGradRend: TRadialGradientRenderer; begin img.SetSize(256,256); rec := img.Bounds; Windows.InflateRect(rec, -3,-3); path := Pie(rec, angle15, -angle15); //do the drawing DrawLine(img, path, 1, clBlack32, esPolygon); radGradRend := TRadialGradientRenderer.Create; radGradRend.SetParameters(rec, clFuchsia32, clBlue32); radGradRend.InsertColorStop(0.3, clRed32); radGradRend.InsertColorStop(0.4, clYellow32); radGradRend.InsertColorStop(0.5, clYellow32); radGradRend.InsertColorStop(0.7, clLime32); radGradRend.InsertColorStop(0.8, clAqua32); DrawPolygon(img, path, frNonZero, radGradRend); radGradRend.Free; DrawLine(img, path, 5, clMaroon32, esPolygon); img.SaveToFile('pacman3.png'); img.Free; end;
Copyright ©2010-2023 Angus Johnson - Image32 4.8 - Help file built on 17 Jan 2025