YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
3
Task/Munching-squares/Befunge/munching-squares.bf
Normal file
3
Task/Munching-squares/Befunge/munching-squares.bf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
55+::"3P",,,28*:*::..\,:.\,:v
|
||||
>2%*28*:**-2/\1-:v<:8:-1<_@ v
|
||||
^\-1*2%2/*:*82::\_$0.0..:^:*<
|
||||
|
|
@ -1,7 +1,4 @@
|
|||
# Project : Munching squares
|
||||
# Date : 2018/01/13
|
||||
# Author : Gal Zsolt (~ CalmoSoft ~)
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
load "guilib.ring"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,25 @@
|
|||
import scala.swing.Swing.pair2Dimension
|
||||
import scala.swing.{ Color, Graphics2D, MainFrame, Panel, SimpleSwingApplication }
|
||||
import scala.swing.{Color, Graphics2D, MainFrame, Panel, SimpleSwingApplication}
|
||||
|
||||
object XorPattern extends SimpleSwingApplication {
|
||||
|
||||
val ui = new Panel {
|
||||
|
||||
override def paintComponent(g: Graphics2D) = {
|
||||
super.paintComponent(g)
|
||||
for {
|
||||
y <- 0 until size.getHeight().toInt
|
||||
x <- 0 until size.getWidth().toInt
|
||||
} {
|
||||
g.setColor(new Color(0, (x ^ y) % 256, 0))
|
||||
g.drawLine(x, y, x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def top = new MainFrame {
|
||||
preferredSize = (300, 300)
|
||||
title = "Rosetta Code >>> Task: Munching squares | Language: Scala"
|
||||
contents = ui
|
||||
contents = new Panel {
|
||||
|
||||
protected override def paintComponent(g: Graphics2D) = {
|
||||
super.paintComponent(g)
|
||||
for {
|
||||
y <- 0 until size.getHeight.toInt
|
||||
x <- 0 until size.getWidth.toInt
|
||||
} {
|
||||
g.setColor(new Color(0, (x ^ y) % 256, 0))
|
||||
g.drawLine(x, y, x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
centerOnScreen()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require('Imager')
|
|||
|
||||
var img = %O<Imager>.new(xsize => 256, ysize => 256)
|
||||
|
||||
for x,y in (^256 ~X ^256) {
|
||||
for y=(^256), x=(^256) {
|
||||
var rgb = [(255 - x - y).abs, (255-x)^y, x^(255-y)]
|
||||
img.setpixel(x => x, y => y, color => rgb)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
' Munching squares - 27/07/2018
|
||||
Public Class MunchingSquares
|
||||
Const xsize = 256
|
||||
Dim BMP As New Drawing.Bitmap(xsize, xsize)
|
||||
Dim GFX As Graphics = Graphics.FromImage(BMP)
|
||||
|
||||
Private Sub MunchingSquares_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
|
||||
'draw
|
||||
Dim MyGraph As Graphics = Me.CreateGraphics
|
||||
Dim nColor As Color
|
||||
Dim i, j, cp As Integer
|
||||
xPictureBox.Image = BMP
|
||||
For i = 0 To xsize - 1
|
||||
For j = 0 To xsize - 1
|
||||
cp = i Xor j
|
||||
nColor = Color.FromArgb(cp, 0, cp)
|
||||
BMP.SetPixel(i, j, nColor)
|
||||
Next j
|
||||
Next i
|
||||
End Sub 'Paint
|
||||
|
||||
End Class
|
||||
Loading…
Add table
Add a link
Reference in a new issue