(* .cm *) let () = let w, h = (160, 90) in let svg = Svg.new_svg_document ~width:(w) ~height:(h) () in let green = "#20d820" in let red = "#ff0000" in let yellow = "#fafa20" in Svg.add_rect svg ~x:(0) ~y:(0) ~width:(w) ~height:(h) ~fill:red (); Svg.add_rect svg ~x:(0) ~y:(0) ~width:(50) ~height:(h) ~fill:green (); Svg.add_rect svg ~x:(w - 50) ~y:(0) ~width:(50) ~height:(h) ~fill:yellow (); (* star *) let stroke_width = 3.2 in let f = float_of_int in let scale = Svg.make_scale ~scale:((0.6, 0.6), (f (w/2), f (h/2))) () in Svg.begin_group svg ~matrix:scale (); Svg.add_triangle svg ~p1:((w/2), 10) ~p2:((w/2)-8, 30) ~p3:((w/2)+8, 30) ~fill:yellow ~stroke:yellow ~stroke_width (); Svg.add_triangle svg ~p1:((w/2)-8, 30) ~p2:((w/2)-24, 70) ~p3:((w/2)+34, 30) ~fill:yellow ~stroke:yellow ~stroke_width (); Svg.add_triangle svg ~p1:((w/2)+8, 30) ~p2:((w/2)+24, 70) ~p3:((w/2)-34, 30) ~fill:yellow ~stroke:yellow ~stroke_width (); Svg.end_group svg; Svg.add_newline svg; Svg.finish_svg svg; Svg.print_svg_document svg; ;;