Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://www.mutualart.com/Artwork/6-WORKS--SECHS-SERIGRAPHIEN/540343E9E4091FCC
- // Richard Paul Lohse: SECHS SERIGRAPHIEN
- let design = """YYYYYYYYYB
- PPPPPPPPYB
- PRPYYYYYYB
- PRPPPPYBYB
- PRPRBRYBYB
- PRPRYPYBYB
- PRPRBBBBYB
- PRRRRRRBYB
- PRBBBBBBBB
- PRRRRRRRRR"""
- #r "System.Drawing.dll"
- #r "System.Windows.Forms.dll"
- open System
- open System.Drawing
- open System.Windows.Forms
- let toColor = function
- | 'R' -> Color.FromArgb(255,245,117,26)
- | 'Y' -> Color.FromArgb(255,238,241,0)
- | 'P' -> Color.FromArgb(255,161,129,228)
- | 'B' -> Color.FromArgb(255,80,170,241)
- | _ -> Color.White
- let toBrush c = new SolidBrush(toColor c) :> Brush
- let show () =
- let form = new Form (Text="SECHS SERIGRAPHIEN", Width=320+16, Height=320+36)
- let image = new Bitmap(form.Width, form.Height)
- let picture = new PictureBox(Dock=DockStyle.Fill, Image=image)
- do form.Controls.Add(picture)
- use graphics = Graphics.FromImage(image)
- let lines = design.Split([|'\n'|])
- lines |> Seq.iteri (fun y line ->
- line |> Seq.iteri (fun x c ->
- let brush = toBrush c
- graphics.FillRectangle(brush, x*32, y*32, 32, 32)
- )
- )
- form.ShowDialog() |> ignore
- show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement