Bitmap/Bézier curves/Quadratic: Difference between revisions

Content deleted Content added
Vedit macro language added
No edit summary
Line 1:
{{task|Raster graphics operations}}
 
Using the data storage type defined [[Basic_bitmap_storage|on this page]] for raster images, and the <codett>draw_line</codett> function defined in [[Bresenham's_line_algorithm|this one]], draw a ''quadratic bezier curves''
([http://en.wikipedia.org/wiki/Bezier_curves#Quadratic_B.C3.A9zier_curves definition on Wikipedia]).
 
 
=={{header|Ada}}==
<lang ada>
procedure Quadratic_Bezier
( Picture : in out Image;
Line 30:
end loop;
end Quadratic_Bezier;
</adalang>
The following test
<lang ada>
X : Image (1..16, 1..16);
begin
Line 38:
Quadratic_Bezier (X, (8, 2), (13, 8), (2, 15), Black);
Print (X);
</adalang>
should produce;
<pre>
Line 113:
=={{header|OCaml}}==
 
<lang ocaml>let quad_bezier ~img ~color
~p1:(_x1, _y1)
~p2:(_x2, _y2)
Line 157:
in
by_pair pts (fun p0 p1 -> line ~p0 ~p1);
;;</ocamllang>
 
=={{header|Vedit macro language}}==