[squeak-dev] The Trunk: MorphicExtras-tpr.106.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 25 21:15:43 UTC 2013
tim Rowledge uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-tpr.106.mcz
==================== Summary ====================
Name: MorphicExtras-tpr.106
Author: tpr
Time: 25 March 2013, 2:14:11.755 pm
UUID: fa05ed2e-81a1-482b-9d66-365fd51319f0
Ancestors: MorphicExtras-nice.105
Remove BitBlt|WarpBlt>current usage - it's a vestige of an old experiment
=============== Diff against MorphicExtras-nice.105 ===============
Item was changed:
----- Method: PaintBoxMorph>>init3 (in category 'initialization') -----
init3
"Just a record of how we loaded in the latest paintbox button images"
| bb pic16Bit aa blt thin |
self loadoffImage: 'etoy_default.gif'.
self allMorphsDo:
[:button |
(button isKindOf: ThreePhaseButtonMorph)
ifTrue: [button offImage: nil]
ifFalse: [button position: button position + (100 @ 0)]].
(bb := self submorphNamed: #keep:) position: bb position + (100 @ 0).
(bb := self submorphNamed: #toss:) position: bb position + (100 @ 0).
(bb := self submorphNamed: #undo:) position: bb position + (100 @ 0).
"Transparent is (Color r: 1.0 g: 0 b: 1.0)"
self moveButtons.
self loadOnImage: 'etoy_in.gif'.
AllOnImage := nil.
'save space'.
self loadPressedImage: 'etoy_in.gif'.
AllPressedImage := nil.
'save space'.
self loadCursors.
"position the stamp buttons"
stampHolder stampButtons owner last delete.
stampHolder pickupButtons last delete.
stampHolder stampButtons: (stampHolder stampButtons copyFrom: 1 to: 3).
stampHolder pickupButtons: (stampHolder pickupButtons copyFrom: 1 to: 3).
stampHolder pickupButtons do:
[:button |
| rect |
"PopUpMenu notify: 'Rectangle for ',sel."
rect := Rectangle fromUser.
button bounds: rect "image is nil"].
"| rect lay |"
stampHolder clear.
stampHolder stampButtons do:
[:button |
| lay rect |
button
offImage: nil;
pressedImage: nil.
lay := button owner.
"PopUpMenu notify: 'Rectangle for ',sel."
rect := Rectangle fromUser.
button image: (Form fromDisplay: (rect insetBy: 2)).
lay borderWidth: 2.
lay bounds: rect "image is nil"].
"| pic16Bit blt aa on |"
pic16Bit := GIFReadWriter formFromFileNamed: 'etoy_in.gif'. "really 8"
aa := Form extent: OriginalBounds extent depth: 8.
+ blt := BitBlt toForm: aa.
- blt := BitBlt current toForm: aa.
blt
sourceForm: pic16Bit;
combinationRule: Form over;
sourceRect: OriginalBounds;
destOrigin: 0 @ 0;
copyBits.
"Collect all the images for the buttons in the on state"
stampHolder pickupButtons do:
[:button | | on |
on := ColorForm extent: button extent depth: 8.
on colors: pic16Bit colors.
on
copy: (0 @ 0 extent: button extent)
from: button topLeft - self topLeft
in: aa
rule: Form over.
button
image: on;
pressedImage: on;
offImage: nil].
self invalidRect: bounds.
((self submorphNamed: #erase:) arguments third) offset: 12 @ 35.
((self submorphNamed: #eyedropper:) arguments third) offset: 0 @ 0.
((self submorphNamed: #fill:) arguments third) offset: 10 @ 44.
((self submorphNamed: #paint:) arguments third) offset: 3 @ 3. "unused"
((self submorphNamed: #rect:) arguments third) offset: 6 @ 17.
((self submorphNamed: #ellipse:) arguments third) offset: 5 @ 4.
((self submorphNamed: #polygon:) arguments third) offset: 5 @ 4.
((self submorphNamed: #line:) arguments third) offset: 5 @ 17.
((self submorphNamed: #star:) arguments third) offset: 2 @ 5.
thumbnail delete.
thumbnail := nil.
(submorphs select: [:e | e class == RectangleMorph]) first
bounds: Rectangle fromUser.
((submorphs select: [:e | e class == RectangleMorph]) first)
borderWidth: 1;
borderColor: Color black.
"| thin |"
submorphs do: [:ss | ss class == ImageMorph ifTrue: [thin := ss "first"]].
colorMemoryThin := thin!
Item was changed:
----- Method: PaintBoxMorph>>init4 (in category 'initialization') -----
init4
"Just a record of how Ted loaded in the paintbox button images, Feb 98"
| bb im pp newImage pic24Bit picNewBit blt |
"self loadoffImage: 'roundedPalette3.bmp'."
pic24Bit := GIFReadWriter formFromServerFile: 'updates/137roundedPalette3.bmp'.
picNewBit := Form extent: pic24Bit extent depth: 16.
pic24Bit displayOn: picNewBit.
OriginalBounds := picNewBit boundingBox.
AllOffImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt toForm: AllOffImage.
- blt := BitBlt current toForm: AllOffImage.
blt sourceForm: picNewBit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 @ 0; copyBits.
AllOffImage mapColor: Color transparent to: Color black.
self image: AllOffImage.
self invalidRect: bounds.
self submorphsDo: [:button | button position: button position + (10 @ 10)].
(im := submorphs at: 28) class == ImageMorph ifTrue: [
im position: im position + (2 @ 0)]. "color picker"
"exercise it once"
(bb := self submorphNamed: #keep:) position: bb position + (0 @ 25).
(bb := self submorphNamed: #toss:) position: bb position + (0 @ 25).
(bb := self submorphNamed: #undo:) position: bb position + (0 @ -25).
(bb := self submorphNamed: #clear:) position: bb position + (0 @ -25).
(bb := self submorphNamed: #undo:) position: bb position + (0 @ -69).
(bb := self submorphNamed: #clear:) position: bb position + (0 @ -69).
self submorphsDo: [:button |
button class == AlignmentMorph ifTrue: [
button position: button position + (0 @ 25)].
(button printString includesSubString: 'stamp:') ifTrue: [
button position: button position + (0 @ 25)]].
(bb := self submorphNamed: #prevStamp:) position: bb position + (0 @ 25).
(bb := self submorphNamed: #nextStamp:) position: bb position + (0 @ 25).
bb := self submorphNamed: #keep:.
newImage := bb pressedImage copy: (0 @ 4 corner: (bb pressedImage boundingBox extent)).
bb onImage: newImage. bb pressedImage: newImage. bb extent: newImage extent.
bb position: bb position + (4 @ 1).
pp := (bb := self submorphNamed: #toss:) pressedImage.
newImage := pp copy: (0 @ 4 corner: (bb pressedImage extent - (3 @ 0))).
bb onImage: newImage. bb pressedImage: newImage.
bb extent: newImage extent.
bb position: bb position + (3 @ 1).
pp := (bb := self submorphNamed: #undo:) pressedImage.
newImage := pp copy: (0 @ 0 corner: (bb pressedImage extent - (3 @ 5))).
bb onImage: newImage. bb pressedImage: newImage.
bb extent: newImage extent.
bb position: bb position + (3 @ -1).
pp := (bb := self submorphNamed: #clear:) pressedImage.
newImage := pp copy: (0 @ 0 corner: (bb pressedImage extent - (0 @ 5))).
bb onImage: newImage. bb pressedImage: newImage.
bb extent: newImage extent.
bb position: bb position + (3 @ -1).
pic24Bit := GIFReadWriter formFromServerFile: 'updates/137pencil.bmp'.
picNewBit := Form extent: pic24Bit extent depth: 16.
pic24Bit displayOn: picNewBit.
newImage := picNewBit as8BitColorForm.
newImage transparentColor: (Color r: 0 g: 0 b: 0).
(bb := self submorphNamed: #erase:) pressedImage: newImage; onImage: newImage;
extent: newImage extent.
bb position: bb position + (-11 @ -1).
!
Item was changed:
----- Method: PaintBoxMorph>>loadOffForm: (in category 'initialization') -----
loadOffForm: pic16Bit
"Prototype loadOffForm: (Smalltalk imageImports at: #offPaletteJapanese)"
| blt |
OriginalBounds := pic16Bit boundingBox.
AllOffImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt toForm: AllOffImage.
- blt := BitBlt current toForm: AllOffImage.
blt sourceForm: pic16Bit;
combinationRule: Form over;
sourceRect: OriginalBounds;
destOrigin: 0 @ 0;
copyBits.
AllOffImage mapColor: Color blue to: Color transparent.
self image: AllOffImage.
AllOffImage := nil.
self invalidRect: bounds
!
Item was changed:
----- Method: PaintBoxMorph>>loadOnImage: (in category 'initialization') -----
loadOnImage: fileName
"Read in and convert the image for the paintBox with the buttons
on. A .bmp 24-bit image. For each button, cut that chunk out and save it."
" self loadOnImage: 'NoSh:=on.bmp'.
AllOnImage := nil. 'save space'. "
| pic16Bit blt aa type |
type := 'gif'. " gif or bmp "
type = 'gif' ifTrue: [
pic16Bit "really 8" := GIFReadWriter formFromFileNamed: fileName.
pic16Bit display.
aa := AllOnImage := Form extent: OriginalBounds extent depth: 8.
+ blt := BitBlt toForm: aa.
- blt := BitBlt current toForm: aa.
blt sourceForm: pic16Bit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
].
type = 'bmp' ifTrue: [
pic16Bit := (Form fromBMPFileNamed: fileName) asFormOfDepth: 16.
pic16Bit display.
aa := AllOnImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt toForm: aa.
- blt := BitBlt current toForm: aa.
blt sourceForm: pic16Bit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
aa mapColor: Color transparent to: Color black.
].
"Collect all the images for the buttons in the on state"
self allMorphsDo: [:button | | on |
(button isKindOf: ThreePhaseButtonMorph) ifTrue: [
type = 'gif' ifTrue: [on := ColorForm extent: button extent depth: 8.
on colors: pic16Bit colors]
ifFalse: [on := Form extent: button extent depth: 16].
on copy: (0 at 0 extent: button extent)
from: (button topLeft - self topLeft) in: aa rule: Form over.
button onImage: on]].
self invalidRect: bounds.
!
Item was changed:
----- Method: PaintBoxMorph>>loadPressedForm: (in category 'initialization') -----
loadPressedForm: pic16Bit
"Prototype loadPressedForm: (Smalltalk imageImports at: #pressedPaletteJapanese)"
| blt |
AllPressedImage := AllPressedImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt toForm: AllPressedImage.
- blt := BitBlt current toForm: AllPressedImage.
blt sourceForm: pic16Bit;
combinationRule: Form over;
sourceRect: OriginalBounds;
destOrigin: 0 @ 0;
copyBits.
AllPressedImage mapColor: Color black to: Color transparent.
self
allMorphsDo: [:button | | on |
(button isKindOf: ThreePhaseButtonMorph)
ifTrue: [on := Form extent: button extent depth: 16.
on
copy: (0 @ 0 extent: button extent)
from: button topLeft - self topLeft
in: AllPressedImage
rule: Form over.
button pressedImage: on]].
AllPressedImage := nil.
self invalidRect: bounds
!
Item was changed:
----- Method: PaintBoxMorph>>loadPressedImage: (in category 'initialization') -----
loadPressedImage: fileName
"Read in and convert the image for the paintBox with the buttons
on. A .bmp 24-bit image. For each button, cut that chunk out and save it."
" self loadPressedImage: 'NoSh:=on.bmp'.
AllPressedImage := nil. 'save space'. "
| pic16Bit blt aa type |
type := 'gif'. " gif or bmp "
type = 'gif' ifTrue: [
pic16Bit "really 8" := GIFReadWriter formFromFileNamed: fileName.
pic16Bit display.
aa := AllPressedImage := Form extent: OriginalBounds extent depth: 8.
+ blt := BitBlt toForm: aa.
- blt := BitBlt current toForm: aa.
blt sourceForm: pic16Bit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
].
type = 'bmp' ifTrue: [
pic16Bit := (Form fromBMPFileNamed: fileName) asFormOfDepth: 16.
pic16Bit display.
aa := AllPressedImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt toForm: aa.
- blt := BitBlt current toForm: aa.
blt sourceForm: pic16Bit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
aa mapColor: Color transparent to: Color black.
].
"Collect all the images for the buttons in the on state"
self allMorphsDo: [:button | | on |
(button isKindOf: ThreePhaseButtonMorph) ifTrue: [
type = 'gif' ifTrue: [on := ColorForm extent: button extent depth: 8.
on colors: pic16Bit colors]
ifFalse: [on := Form extent: button extent depth: 16].
on copy: (0 at 0 extent: button extent)
from: (button topLeft - self topLeft) in: aa rule: Form over.
button pressedImage: on]].
self invalidRect: bounds.
!
Item was changed:
----- Method: PaintBoxMorph>>loadoffImage: (in category 'initialization') -----
loadoffImage: fileName
"Read in and convert the background image for the paintBox. All
buttons off. A .bmp 24-bit image."
" Prototype loadoffImage: 'roundedPalette3.bmp' "
| pic16Bit blt type getBounds |
type := 'bmp'. " gif or bmp "
getBounds := 'fromPic'. "fromUser = draw out rect of paintbox on image"
"fromOB = just read in new bits, keep same size and place as last time."
"fromPic = picture is just the PaintBox, use its bounds"
type = 'gif' ifTrue: [
pic16Bit "really 8" := GIFReadWriter formFromFileNamed: fileName.
getBounds = 'fromUser' ifTrue: ["Just first time, collect the bounds"
pic16Bit display.
OriginalBounds := Rectangle fromUser].
getBounds = 'fromPic' ifTrue: [OriginalBounds := pic16Bit boundingBox].
].
"Use OriginalBounds as it was last time"
type = 'bmp' ifTrue: [
pic16Bit := (Form fromBMPFileNamed: fileName) asFormOfDepth: 16.
getBounds = 'fromUser' ifTrue: ["Just first time, collect the bounds"
pic16Bit display.
OriginalBounds := Rectangle fromUser].
"Use OriginalBounds as it was last time"
(getBounds = 'fromPic') ifTrue: [OriginalBounds := pic16Bit boundingBox].
AllOffImage := Form extent: OriginalBounds extent depth: 16.
].
type = 'gif' ifTrue: [
AllOffImage := ColorForm extent: OriginalBounds extent depth: 8.
AllOffImage colors: pic16Bit colors].
+ blt := BitBlt toForm: AllOffImage.
- blt := BitBlt current toForm: AllOffImage.
blt sourceForm: pic16Bit; combinationRule: Form over;
sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
type = 'bmp' ifTrue: [AllOffImage mapColor: Color transparent to: Color black].
self image: AllOffImage.
self invalidRect: bounds.
!
Item was changed:
----- Method: ScreeningMorph>>fullDrawOn: (in category 'drawing') -----
fullDrawOn: aCanvas
| mergeForm |
submorphs isEmpty ifTrue: [^super fullDrawOn: aCanvas].
(aCanvas isVisible: self fullBounds) ifFalse: [^self].
(submorphs size = 1 or: [displayMode == #showScreenOnly])
ifTrue: [^aCanvas fullDrawMorph: self screenMorph].
displayMode == #showSourceOnly
ifTrue: [^aCanvas fullDrawMorph: self sourceMorph].
displayMode == #showScreenOverSource
ifTrue:
[aCanvas fullDrawMorph: self sourceMorph.
^aCanvas fullDrawMorph: self screenMorph].
displayMode == #showScreened
ifTrue:
[aCanvas fullDrawMorph: self screenMorph.
self flag: #fixCanvas. "There should be a more general way than this"
mergeForm := self sourceMorph
imageFormForRectangle: self screenMorph bounds.
+ (BitBlt toForm: mergeForm)
- (BitBlt current toForm: mergeForm)
copyForm: self screenForm
to: 0 @ 0
rule: Form and
colorMap: (Bitmap with: 0 with: 4294967295).
aCanvas paintImage: mergeForm at: self screenMorph position]!
More information about the Squeak-dev
mailing list
|