Pentagram: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
Line 15: Line 15:
=={{header|Action!}}==
=={{header|Action!}}==
{{libheader|Action! Tool Kit}}
{{libheader|Action! Tool Kit}}
<lang Action!>INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit
<syntaxhighlight lang="action!">INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit


DEFINE REALPTR="CARD"
DEFINE REALPTR="CARD"
Line 198: Line 198:
DO UNTIL CH#$FF OD
DO UNTIL CH#$FF OD
CH=$FF
CH=$FF
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Pentagram.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Pentagram.png Screenshot from Atari 8-bit computer]
Line 204: Line 204:
=={{header|Ada}}==
=={{header|Ada}}==
{{libheader|SDLAda}}
{{libheader|SDLAda}}
<lang Ada>with Ada.Numerics.Elementary_Functions;
<syntaxhighlight lang="ada">with Ada.Numerics.Elementary_Functions;


with SDL.Video.Windows.Makers;
with SDL.Video.Windows.Makers;
Line 297: Line 297:
Window.Finalize;
Window.Finalize;
SDL.Finalise;
SDL.Finalise;
end Pentagram;</lang>
end Pentagram;</syntaxhighlight>


=={{header|Applesoft BASIC}}==
=={{header|Applesoft BASIC}}==
<lang basic>100 XO = 140
<syntaxhighlight lang="basic">100 XO = 140
110 YO = 96
110 YO = 96
120 S = 90
120 S = 90
Line 344: Line 344:
670 PX = XO + X * SX
670 PX = XO + X * SX
680 PY = YO - Y * SY
680 PY = YO - Y * SY
690 NEXT I</lang>
690 NEXT I</syntaxhighlight>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
[[File:Pentagram Java.png|300px|thumb|right]]
[[File:Pentagram Java.png|300px|thumb|right]]
<syntaxhighlight lang="autohotkey">
<lang AutoHotkey>
#Include Gdip.ahk ; https://autohotkey.com/boards/viewtopic.php?f=6&t=6517
#Include Gdip.ahk ; https://autohotkey.com/boards/viewtopic.php?f=6&t=6517
Width :=A_ScreenWidth, Height := A_ScreenHeight
Width :=A_ScreenWidth, Height := A_ScreenHeight
Line 409: Line 409:
Gdip_Shutdown(pToken)
Gdip_Shutdown(pToken)
ExitApp
ExitApp
Return</lang>
Return</syntaxhighlight>


=={{header|C}}==
=={{header|C}}==
Interactive program which takes the side lengths of the pentagram's core, it's arms and the colours for filling the background, drawing the figure and then filling it in. Requires the [http://www.cs.colorado.edu/~main/bgi/cs1300/ WinBGIm] library.
Interactive program which takes the side lengths of the pentagram's core, it's arms and the colours for filling the background, drawing the figure and then filling it in. Requires the [http://www.cs.colorado.edu/~main/bgi/cs1300/ WinBGIm] library.


<lang C>#include<graphics.h>
<syntaxhighlight lang="c">#include<graphics.h>
#include<stdio.h>
#include<stdio.h>
#include<math.h>
#include<math.h>
Line 477: Line 477:
closegraph();
closegraph();
}
}
</syntaxhighlight>
</lang>
=={{header|Delphi}}==
=={{header|Delphi}}==
{{libheader| Winapi.Windows}}
{{libheader| Winapi.Windows}}
Line 483: Line 483:
{{libheader| Vcl.Forms}}
{{libheader| Vcl.Forms}}
{{libheader| System.Math}}
{{libheader| System.Math}}
<syntaxhighlight lang="delphi">
<lang Delphi>
unit Main;
unit Main;


Line 591: Line 591:
end;
end;


end.</lang>
end.</syntaxhighlight>
form code:
form code:
<syntaxhighlight lang="delphi">
<lang Delphi>
object Form1: TForm1
object Form1: TForm1
OnCreate = FormCreate
OnCreate = FormCreate
OnPaint = FormPaint
OnPaint = FormPaint
end
end
</syntaxhighlight>
</lang>




Line 604: Line 604:
[https://easylang.online/apps/_pentagram.html Run it]
[https://easylang.online/apps/_pentagram.html Run it]


<lang>xp = 10
<syntaxhighlight lang="text">xp = 10
yp = 40
yp = 40
linewidth 2
linewidth 2
Line 619: Line 619:
.
.
color 900
color 900
polygon f[]</lang>
polygon f[]</syntaxhighlight>


=={{header|Go}}==
=={{header|Go}}==
{{libheader|Go Graphics}}
{{libheader|Go Graphics}}
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 657: Line 657:
dc.Stroke()
dc.Stroke()
dc.SavePNG("pentagram.png")
dc.SavePNG("pentagram.png")
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 670: Line 670:
</pre>
</pre>
creates a 400x400 SVG file.
creates a 400x400 SVG file.
<lang haskell>-- Extract the vertices of a pentagon, re-ordering them so that drawing lines
<syntaxhighlight lang="haskell">-- Extract the vertices of a pentagon, re-ordering them so that drawing lines
-- from one to the next forms a pentagram. Set the line's thickness and its
-- from one to the next forms a pentagram. Set the line's thickness and its
-- colour, as well as the fill and background colours. Make the background a
-- colour, as well as the fill and background colours. Make the background a
Line 688: Line 688:
# bgFrame 0.2 bisque
# bgFrame 0.2 bisque


main = mainWith (pentagram :: Diagram B)</lang>
main = mainWith (pentagram :: Diagram B)</syntaxhighlight>


=={{header|IS-BASIC}}==
=={{header|IS-BASIC}}==
<lang IS-BASIC>100 PROGRAM "Pentagra.bas"
<syntaxhighlight lang="is-basic">100 PROGRAM "Pentagra.bas"
110 OPTION ANGLE DEGREES
110 OPTION ANGLE DEGREES
120 GRAPHICS HIRES 4
120 GRAPHICS HIRES 4
Line 700: Line 700:
170 NEXT
170 NEXT
180 SET INK 3
180 SET INK 3
190 SET BEAM OFF:PLOT 0,0,PAINT</lang>
190 SET BEAM OFF:PLOT 0,0,PAINT</syntaxhighlight>


=={{header|J}}==
=={{header|J}}==
Line 706: Line 706:
Probably the simplest approach is:
Probably the simplest approach is:


<lang j>require'plot'
<syntaxhighlight lang="j">require'plot'
plot j./2 1 o./180p_1 %~ 144*i. 6</lang>
plot j./2 1 o./180p_1 %~ 144*i. 6</syntaxhighlight>


This will give a pentagram with a blue border and a white interior.
This will give a pentagram with a blue border and a white interior.
Line 716: Line 716:
[[File:Pentagram Java.png|300px|thumb|right]]
[[File:Pentagram Java.png|300px|thumb|right]]
{{works with|Java|8}}
{{works with|Java|8}}
<lang java>import java.awt.*;
<syntaxhighlight lang="java">import java.awt.*;
import java.awt.geom.Path2D;
import java.awt.geom.Path2D;
import javax.swing.*;
import javax.swing.*;
Line 778: Line 778:
});
});
}
}
}</lang>
}</syntaxhighlight>


=={{header|jq}}==
=={{header|jq}}==
Line 789: Line 789:
Notice that the size of an appropriate SVG viewBox is computed.
Notice that the size of an appropriate SVG viewBox is computed.


<lang jq># Input: {svg, minx, miny, maxx, maxy}
<syntaxhighlight lang="jq"># Input: {svg, minx, miny, maxx, maxy}
def svg:
def svg:
# viewBox = <min-x> <min-y> <width> <height>
# viewBox = <min-x> <min-y> <width> <height>
Line 826: Line 826:


pentagram(200)
pentagram(200)
| svg</lang>
| svg</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 840: Line 840:
=={{header|Julia}}==
=={{header|Julia}}==


<lang julia>using Luxor
<syntaxhighlight lang="julia">using Luxor


function drawpentagram(path::AbstractString, w::Integer=1000, h::Integer=1000)
function drawpentagram(path::AbstractString, w::Integer=1000, h::Integer=1000)
Line 858: Line 858:
end
end


drawpentagram("data/pentagram.png")</lang>
drawpentagram("data/pentagram.png")</syntaxhighlight>


=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|Java}}
{{trans|Java}}
<lang scala>// version 1.1.2
<syntaxhighlight lang="scala">// version 1.1.2


import java.awt.*
import java.awt.*
Line 921: Line 921:
}
}
}
}
}</lang>
}</syntaxhighlight>


=={{header|Lua}}==
=={{header|Lua}}==
Using the Bitmap class [[Bitmap#Lua|here]], with an ASCII pixel representation, then extending with <code>line()</code> as [[Bitmap/Bresenham%27s_line_algorithm#Lua|here]], then extending with <code>floodfill()</code> as [[Bitmap/Flood_fill#Lua|here]], then extending further..
Using the Bitmap class [[Bitmap#Lua|here]], with an ASCII pixel representation, then extending with <code>line()</code> as [[Bitmap/Bresenham%27s_line_algorithm#Lua|here]], then extending with <code>floodfill()</code> as [[Bitmap/Flood_fill#Lua|here]], then extending further..
<lang lua>local cos, sin, floor, pi = math.cos, math.sin, math.floor, math.pi
<syntaxhighlight lang="lua">local cos, sin, floor, pi = math.cos, math.sin, math.floor, math.pi


function Bitmap:render()
function Bitmap:render()
Line 952: Line 952:
bitmap:clear(".")
bitmap:clear(".")
bitmap:pentagram(20, 22, 20, -pi/2, "@", '+')
bitmap:pentagram(20, 22, 20, -pi/2, "@", '+')
bitmap:render()</lang>
bitmap:render()</syntaxhighlight>
{{out}}
{{out}}
<pre style="font-size:50%">................................................................................
<pre style="font-size:50%">................................................................................
Line 996: Line 996:


=={{header|Maple}}==
=={{header|Maple}}==
<lang maple>with(geometry):
<syntaxhighlight lang="maple">with(geometry):
RegularStarPolygon(middle, 5/2, point(c, 0, 0), 1):
RegularStarPolygon(middle, 5/2, point(c, 0, 0), 1):
v := [seq(coordinates(i), i in DefinedAs(middle))]:
v := [seq(coordinates(i), i in DefinedAs(middle))]:
pentagram := plottools[rotate](plottools[polygon](v), Pi/2):
pentagram := plottools[rotate](plottools[polygon](v), Pi/2):
plots[display](pentagram, colour = yellow, axes = none);</lang>
plots[display](pentagram, colour = yellow, axes = none);</syntaxhighlight>
{{out}}
{{out}}
Note: Plot shown below is generated using interface(plotdevice = char);
Note: Plot shown below is generated using interface(plotdevice = char);
Line 1,029: Line 1,029:


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang mathematica>Graphics[{
<syntaxhighlight lang="mathematica">Graphics[{
EdgeForm[Directive[Thickness[0.01], RGBColor[0, 0, 1]]],(*Edge coloring*)
EdgeForm[Directive[Thickness[0.01], RGBColor[0, 0, 1]]],(*Edge coloring*)
RGBColor[0.5, 0.5, .50], (*Fill coloring*)
RGBColor[0.5, 0.5, .50], (*Fill coloring*)
Polygon[AnglePath[Table[6 Pi/5, 5]]]}
Polygon[AnglePath[Table[6 Pi/5, 5]]]}
]</lang>
]</syntaxhighlight>


=={{header|Nim}}==
=={{header|Nim}}==
{{works with|nim|1.4.4}}
{{works with|nim|1.4.4}}
{{libheader|nim-libgd}}
{{libheader|nim-libgd}}
<lang nim>
<syntaxhighlight lang="nim">
import libgd
import libgd
from math import sin, cos, degToRad
from math import sin, cos, degToRad
Line 1,111: Line 1,111:


main()
main()
</syntaxhighlight>
</lang>


=={{header|ooRexx}}==
=={{header|ooRexx}}==
<lang oorexx>/* REXX ***************************************************************
<syntaxhighlight lang="oorexx">/* REXX ***************************************************************
* Create a BMP file showing a pentagram
* Create a BMP file showing a pentagram
**********************************************************************/
**********************************************************************/
Line 1,207: Line 1,207:
end
end
Return
Return
::requires RxMath Library</lang>
::requires RxMath Library</syntaxhighlight>


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>use SVG;
<syntaxhighlight lang="perl">use SVG;


my $tau = 2 * 4*atan2(1, 1);
my $tau = 2 * 4*atan2(1, 1);
Line 1,249: Line 1,249:
open $fh, '>', 'pentagram.svg';
open $fh, '>', 'pentagram.svg';
print $fh $svg->xmlify(-namespace=>'svg');
print $fh $svg->xmlify(-namespace=>'svg');
close $fh;</lang>
close $fh;</syntaxhighlight>
[https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/pentagram.svg Pentagram] (offsite image)
[https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/pentagram.svg Pentagram] (offsite image)


Line 1,257: Line 1,257:
{{libheader|Phix/online}}
{{libheader|Phix/online}}
You can run this online [http://phix.x10.mx/p2js/Pentagram.htm here].
You can run this online [http://phix.x10.mx/p2js/Pentagram.htm here].
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Pentagram.exw
-- demo\rosetta\Pentagram.exw
Line 1,345: Line 1,345:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</lang>-->
<!--</syntaxhighlight>-->


And a quick svg version, output identical to sidef
And a quick svg version, output identical to sidef
{{trans|Sidef}}
{{trans|Sidef}}
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">HDR</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"""
<span style="color: #008080;">constant</span> <span style="color: #000000;">HDR</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"""
Line 1,390: Line 1,390:
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">pentagram</span><span style="color: #0000FF;">())</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">pentagram</span><span style="color: #0000FF;">())</span>
<!--</lang>-->
<!--</syntaxhighlight>-->


=={{header|PostScript}}==
=={{header|PostScript}}==
<lang postscript>%!PS-Adobe-3.0 EPSF
<syntaxhighlight lang="postscript">%!PS-Adobe-3.0 EPSF
%%BoundingBox: 0 0 200 600
%%BoundingBox: 0 0 200 600
Line 1,413: Line 1,413:
s 170 t p s 2 setlinewidth stroke r g fill r % non-zero, but hide inner strokes
s 170 t p s 2 setlinewidth stroke r g fill r % non-zero, but hide inner strokes


%%EOF</lang>
%%EOF</syntaxhighlight>


The following isn't exactly what the task asks for, but it's kind of fun if you have a PS interpreter that progressively updates. The program draws a lot of stars, so it's extremely likely that some of them are pentagrams...
The following isn't exactly what the task asks for, but it's kind of fun if you have a PS interpreter that progressively updates. The program draws a lot of stars, so it's extremely likely that some of them are pentagrams...
<lang postscript>%!PS-Adobe-3.0 EPSF
<syntaxhighlight lang="postscript">%!PS-Adobe-3.0 EPSF
%%BoundingBox: 0 0 400 400
%%BoundingBox: 0 0 400 400


Line 1,442: Line 1,442:


0 setlinewidth 2000 {star} repeat showpage
0 setlinewidth 2000 {star} repeat showpage
%%EOF</lang>
%%EOF</syntaxhighlight>


=={{header|Processing}}==
=={{header|Processing}}==
<lang java>
<syntaxhighlight lang="java">
//Aamrun, 29th June 2022
//Aamrun, 29th June 2022


Line 1,460: Line 1,460:
}
}
endShape(CLOSE);
endShape(CLOSE);
</syntaxhighlight>
</lang>


=={{header|Python}}==
=={{header|Python}}==
{{works with|Python|3.4.1}}
{{works with|Python|3.4.1}}


<lang python>import turtle
<syntaxhighlight lang="python">import turtle


turtle.bgcolor("green")
turtle.bgcolor("green")
Line 1,474: Line 1,474:
t.forward(200)
t.forward(200)
t.right(144)
t.right(144)
t.end_fill()</lang>
t.end_fill()</syntaxhighlight>


=={{header|Quackery}}==
=={{header|Quackery}}==
<lang Quackery>[ $ "turtleduck.qky" loadfile ] now!
<syntaxhighlight lang="quackery">[ $ "turtleduck.qky" loadfile ] now!


[ [ 1 1
[ [ 1 1
Line 1,502: Line 1,502:
-1 10 turn
-1 10 turn
200 1 phi v* phi v* pentagram
200 1 phi v* phi v* pentagram
1 10 turn</lang>
1 10 turn</syntaxhighlight>


{{output}}
{{output}}
Line 1,510: Line 1,510:
=={{header|R}}==
=={{header|R}}==
Very simple approach,
Very simple approach,
<lang R>p <- cbind(x = c(0, 1, 2,-0.5 , 2.5 ,0),
<syntaxhighlight lang="r">p <- cbind(x = c(0, 1, 2,-0.5 , 2.5 ,0),
y = c(0, 1, 0,0.6, 0.6,0))
y = c(0, 1, 0,0.6, 0.6,0))
plot(p)
plot(p)
lines(p)</lang>
lines(p)</syntaxhighlight>


==={{header|Using circle equation}}===
==={{header|Using circle equation}}===
Line 1,521: Line 1,521:
each point on the circumference is 72 degrees apart,
each point on the circumference is 72 degrees apart,
5 points on the circles circumference are calculated and than plotted and line drawn in-between to produce pentagram
5 points on the circles circumference are calculated and than plotted and line drawn in-between to produce pentagram
<lang rsplus>#Circle equation
<syntaxhighlight lang="rsplus">#Circle equation
#x = r*cos(angle) + centre_x
#x = r*cos(angle) + centre_x
#y = r*sin(angle) + centre_y
#y = r*sin(angle) + centre_y
Line 1,574: Line 1,574:
col = "#1b98e0",
col = "#1b98e0",
border = "red",
border = "red",
lwd = 5)</lang>
lwd = 5)</syntaxhighlight>


=={{header|Racket}}==
=={{header|Racket}}==


<lang racket>#lang racket
<syntaxhighlight lang="racket">#lang racket
(require 2htdp/image)
(require 2htdp/image)


(overlay
(overlay
(star-polygon 100 5 2 "outline" (make-pen "blue" 4 "solid" "round" "round"))
(star-polygon 100 5 2 "outline" (make-pen "blue" 4 "solid" "round" "round"))
(star-polygon 100 5 2 "solid" "cyan"))</lang>
(star-polygon 100 5 2 "solid" "cyan"))</syntaxhighlight>


=={{header|Raku}}==
=={{header|Raku}}==
Line 1,589: Line 1,589:
{{works with|rakudo|2018.08}}
{{works with|rakudo|2018.08}}
Generate an SVG file to STDOUT. Redirect to a file to capture and display it.
Generate an SVG file to STDOUT. Redirect to a file to capture and display it.
<lang perl6>use SVG;
<syntaxhighlight lang="raku" line>use SVG;


constant $dim = 200;
constant $dim = 200;
Line 1,608: Line 1,608:
],
],
],
],
);</lang>
);</syntaxhighlight>
See [https://github.com/thundergnat/rc/blob/master/img/pentagram-perl6.svg Pentagram] (offsite svg image)
See [https://github.com/thundergnat/rc/blob/master/img/pentagram-perl6.svg Pentagram] (offsite svg image)


Line 1,615: Line 1,615:


=={{header|Red}}==
=={{header|Red}}==
<lang red>Red [
<syntaxhighlight lang="red">Red [
Source: https://github.com/vazub/rosetta-red
Source: https://github.com/vazub/rosetta-red
Tabs: 4
Tabs: 4
Line 1,646: Line 1,646:
]
]
]
]
</syntaxhighlight>
</lang>


=={{header|REXX}}==
=={{header|REXX}}==
{{trans|ooRexx}}
{{trans|ooRexx}}
<lang rexx>/* REXX ***************************************************************
<syntaxhighlight lang="rexx">/* REXX ***************************************************************
* Create a BMP file showing a pentagram
* Create a BMP file showing a pentagram
**********************************************************************/
**********************************************************************/
Line 1,818: Line 1,818:
End
End
Numeric Digits prec
Numeric Digits prec
Return r+0</lang>
Return r+0</syntaxhighlight>


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang="ring">
# Project : Pentagram
# Project : Pentagram


Line 1,884: Line 1,884:
label1 { setpicture(p1) show() }
label1 { setpicture(p1) show() }
return
return
</syntaxhighlight>
</lang>
Output:
Output:


Line 1,891: Line 1,891:
=={{header|Scala}}==
=={{header|Scala}}==
===Java Swing Interoperability===
===Java Swing Interoperability===
<lang Scala>import java.awt._
<syntaxhighlight lang="scala">import java.awt._
import java.awt.geom.Path2D
import java.awt.geom.Path2D


Line 1,943: Line 1,943:
)
)


}</lang>
}</syntaxhighlight>


=={{header|Sidef}}==
=={{header|Sidef}}==
{{trans|Raku}}
{{trans|Raku}}
Generates a SVG image to STDOUT.
Generates a SVG image to STDOUT.
<lang ruby>func pentagram(dim=200, sides=5) {
<syntaxhighlight lang="ruby">func pentagram(dim=200, sides=5) {
var pentagram = <<-EOT
var pentagram = <<-EOT
<?xml version="1.0" standalone="no" ?>
<?xml version="1.0" standalone="no" ?>
Line 1,976: Line 1,976:
}
}


say pentagram()</lang>
say pentagram()</syntaxhighlight>
{{out}}
{{out}}
<pre><?xml version="1.0" standalone="no" ?>
<pre><?xml version="1.0" standalone="no" ?>
Line 1,989: Line 1,989:


=={{header|SPL}}==
=={{header|SPL}}==
<lang spl>mx,my = #.scrsize()
<syntaxhighlight lang="spl">mx,my = #.scrsize()
xc = mx/2
xc = mx/2
yc = my/2
yc = my/2
Line 2,003: Line 2,003:
#.drawcolor(1,1,0)
#.drawcolor(1,1,0)
#.drawsize(1)
#.drawsize(1)
<</lang>
<</syntaxhighlight>


=={{header|Tcl}}==
=={{header|Tcl}}==
This implementation draws a simple pentagram on a [http://wiki.tcl.tk/1415 Canvas] widget.
This implementation draws a simple pentagram on a [http://wiki.tcl.tk/1415 Canvas] widget.
{{works with|Tcl|8.6}}
{{works with|Tcl|8.6}}
<syntaxhighlight lang="tcl">
<lang Tcl>
package require Tk 8.6 ;# lmap is new in Tcl/Tk 8.6
package require Tk 8.6 ;# lmap is new in Tcl/Tk 8.6


Line 2,033: Line 2,033:
;# a fun reader exercise is to make the shape respond to mouse events,
;# a fun reader exercise is to make the shape respond to mouse events,
;# or animate it!
;# or animate it!
</syntaxhighlight>
</lang>


=={{header|VBA}}==
=={{header|VBA}}==
<lang vb>Sub pentagram()
<syntaxhighlight lang="vb">Sub pentagram()
With ActiveSheet.Shapes.AddShape(msoShape5pointStar, 10, 10, 400, 400)
With ActiveSheet.Shapes.AddShape(msoShape5pointStar, 10, 10, 400, 400)
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.ForeColor.RGB = RGB(255, 0, 0)
Line 2,042: Line 2,042:
.Line.ForeColor.RGB = RGB(0, 0, 255)
.Line.ForeColor.RGB = RGB(0, 0, 255)
End With
End With
End Sub</lang>
End Sub</syntaxhighlight>


=={{header|Wren}}==
=={{header|Wren}}==
{{trans|Go}}
{{trans|Go}}
{{libheader|DOME}}
{{libheader|DOME}}
<lang ecmascript>import "graphics" for Canvas, Color, Point
<syntaxhighlight lang="ecmascript">import "graphics" for Canvas, Color, Point
import "dome" for Window
import "dome" for Window


Line 2,081: Line 2,081:
}
}
}
}
}</lang>
}</syntaxhighlight>


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>proc FillArea(X, Y, C0, C); \Replace area colored C0 with color C
<syntaxhighlight lang="xpl0">proc FillArea(X, Y, C0, C); \Replace area colored C0 with color C
int X, Y, \starting coordinate for flood fill algorithm
int X, Y, \starting coordinate for flood fill algorithm
C0, C; \initial color, and color to replace it with
C0, C; \initial color, and color to replace it with
Line 2,137: Line 2,137:
];
];
FillArea(0, 0, $F, 1); \replace white (F) with blue (1)
FillArea(0, 0, $F, 1); \replace white (F) with blue (1)
]</lang>
]</syntaxhighlight>


=={{header|zkl}}==
=={{header|zkl}}==
Line 2,143: Line 2,143:
{{trans|Raku}}
{{trans|Raku}}
Generate an SVG file to STDOUT. Redirect to a file to capture and display it.
Generate an SVG file to STDOUT. Redirect to a file to capture and display it.
<lang zkl>const DIM=200, SIDES=5, A=360/SIDES, R=DIM.toFloat();
<syntaxhighlight lang="zkl">const DIM=200, SIDES=5, A=360/SIDES, R=DIM.toFloat();
vs:=[0.0..360-A,A].apply("toRad"); // angles of vertices
vs:=[0.0..360-A,A].apply("toRad"); // angles of vertices
#<<<
#<<<
Line 2,167: Line 2,167:
);
);
}
}
println("</svg>");</lang>
println("</svg>");</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>