June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,4 +1,27 @@
|
|||
use MONKEY_TYPING;
|
||||
use MONKEY-TYPING;
|
||||
|
||||
class Pixel { has UInt ($.R, $.G, $.B) }
|
||||
class Bitmap {
|
||||
has UInt ($.width, $.height);
|
||||
has Pixel @!data;
|
||||
|
||||
method fill(Pixel $p) {
|
||||
@!data = $p.clone xx ($!width*$!height)
|
||||
}
|
||||
method pixel(
|
||||
$i where ^$!width,
|
||||
$j where ^$!height
|
||||
--> Pixel
|
||||
) is rw { @!data[$i + $j * $!width] }
|
||||
|
||||
method set-pixel ($i, $j, Pixel $p) {
|
||||
self.pixel($i, $j) = $p.clone;
|
||||
}
|
||||
method get-pixel ($i, $j) returns Pixel {
|
||||
self.pixel($i, $j);
|
||||
}
|
||||
}
|
||||
|
||||
augment class Pixel { method Str { "$.R $.G $.B" } }
|
||||
augment class Bitmap {
|
||||
method P3 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue