Bitmap: Difference between revisions

345 bytes added ,  3 years ago
Line 4,124:
=={{header|Smalltalk}}==
{{works with|Smalltalk/X}}
<lang Smalltalk>|img1 img2|
imgimg1 := Image width:100 height:200 depth:24.
|img|
img1 fillRectangle:(0@0 corner:100@100) with:Color red.
img := Image width:100 height:200 depth:24.
imgimg1 fillRectanglecolorAt:(0@010 corner:100@100 10) withput:(Color redgreen).
imgimg1 saveOn:'sampleFile.png'.
img colorAt:(10 @ 10) put:(Color green).
img saveOn:'sampleFile.png'.
 
imgimg1 displayOn:Transcript window graphicsContext.
Transcript showCR:(imgimg1 colorAt:(100 @ 10) ).
 
|img2|
img2 := Image width:100 height:200 depth:8.
img2 colorMap:{ Color black. Color red . Color green }.
img2 fillRectangle:(0@0 corner:100@100) with:Color red.
imgimg2 colorAt:(10 @ 10) put:(Color green).
img2 saveOn:'sampleFile.gif'.
 
img2 displayOn:Transcript window graphicsContext.
Transcript showCR:(img2 colorAt:(100 @ 10) ).
</lang>
 
Anonymous user