Munching squares: Difference between revisions

Added Scala
(Initial PL/I implementation)
(Added Scala)
Line 787:
render #g
#g "flush"</lang>
 
=={{header|Scala}}==
[[Category:Scala Implementations]]
{{libheader|Scala}}<lang Scala>import scala.swing.Swing.pair2Dimension
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
centerOnScreen()
}
}</lang>
 
=={{header|Tcl}}==
{{libheader|Tk}}<lang tcl>package require Tk
<lang tcl>package require Tk
 
proc xorImage {img table} {
Anonymous user