Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Bitmap/Oz/bitmap-1.oz
Normal file
37
Task/Bitmap/Oz/bitmap-1.oz
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
functor
|
||||
export
|
||||
New
|
||||
Get
|
||||
Set
|
||||
Transform
|
||||
define
|
||||
fun {New Width Height Init}
|
||||
C = {Array.new 1 Height unit}
|
||||
in
|
||||
for Row in 1..Height do
|
||||
C.Row := {Array.new 1 Width Init}
|
||||
end
|
||||
|
||||
array2d(width:Width
|
||||
height:Height
|
||||
contents:C)
|
||||
end
|
||||
|
||||
fun {Get array2d(contents:C ...) X Y}
|
||||
C.Y.X
|
||||
end
|
||||
|
||||
proc {Set array2d(contents:C ...) X Y Val}
|
||||
C.Y.X := Val
|
||||
end
|
||||
|
||||
proc {Transform array2d(contents:C width:W height:H ...) Fun}
|
||||
for Y in 1..H do
|
||||
for X in 1..W do
|
||||
C.Y.X := {Fun C.Y.X}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%% omitted: Clone, Map, Fold, ForAll
|
||||
end
|
||||
32
Task/Bitmap/Oz/bitmap-2.oz
Normal file
32
Task/Bitmap/Oz/bitmap-2.oz
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
%% For real task prefer QTk's images:
|
||||
%% http://www.mozart-oz.org/home/doc/mozart-stdlib/wp/qtk/html/node38.html
|
||||
|
||||
functor
|
||||
import
|
||||
Array2D
|
||||
export
|
||||
New
|
||||
Fill
|
||||
GetPixel
|
||||
SetPixel
|
||||
define
|
||||
Black = color(0x00 0x00 0x00)
|
||||
|
||||
fun {New Width Height}
|
||||
bitmap( {Array2D.new Width Height Black} )
|
||||
end
|
||||
|
||||
proc {Fill bitmap(Arr) Color}
|
||||
{Array2D.transform Arr fun {$ _} Color end}
|
||||
end
|
||||
|
||||
fun {GetPixel bitmap(Arr) X Y}
|
||||
{Array2D.get Arr X Y}
|
||||
end
|
||||
|
||||
proc {SetPixel bitmap(Arr) X Y Color}
|
||||
{Array2D.set Arr X Y Color}
|
||||
end
|
||||
|
||||
%% Omitted: MaxValue, ForAllPixels, Transform
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue