Hosted by
|
with Lines; use Lines;
with Outlines; use Outlines;
package body Transforms is
procedure Scale
(This : access Outline;
Factor : in Real)
is
use Outlines.Line_Lists;
begin
Reset(This);
while Next(This) loop
Lines.Scale(Current(This), Factor);
end loop;
end Scale;
procedure Scale
(This : access Glyph;
Factor : in Real)
is
use Glyphs.Outline_Lists;
Outlines : Outline_List_Access := Get_Outlines(This);
Bounds : Rectangle;
begin
Reset(Outlines);
while Next(Outlines) loop
Scale(Current(Outlines), Factor);
end loop;
Bounds := Get_Bounds(This);
Set_Bounds(This,
Left => Bounds.Left * Factor,
Bottom => Bounds.Bottom * Factor,
Right => Bounds.Right * Factor,
Top => Bounds.Top * Factor);
end Scale;
procedure Translate
(This : access Outline;
Offset : in Vector)
is
use Outlines.Line_Lists;
begin
Reset(This);
while Next(This) loop
Lines.Translate(Current(This), Offset);
end loop;
end Translate;
procedure Translate
(This : access Glyph;
Offset : in Vector)
is
use Glyphs.Outline_Lists;
Outlines : Outline_List_Access := Get_Outlines(This);
Bounds : Rectangle;
begin
Reset(Outlines);
while Next(Outlines) loop
Translate(Current(Outlines), Offset);
end loop;
Bounds := Get_Bounds(This);
Set_Bounds(This,
Left => Bounds.Left + Offset.X,
Bottom => Bounds.Bottom + Offset.Y,
Right => Bounds.Right + Offset.X,
Top => Bounds.Top + Offset.Y);
end Translate;
end Transforms;
|