'From etoys3.0 of 24 February 2008 [latest update: #2149] on 18 September 2008 at 1:40:19 am'! "Change Set: releaseResourceThumb-yo Date: 18 September 2008 Author: Yoshiki Ohshima When just creating the thumbnail for a morph that uses hardware resource, call delete to cause proper finalization."! !PartsBin class methodsFor: 'thumbnail cache' stamp: 'yo 9/18/2008 01:38'! thumbnailForQuad: aQuint color: aColor "Answer a thumbnail for a morph obtaining as per the quintuplet provided, creating the thumbnail if necessary. If it is created afresh, it will also be cached at this time" | aThumbnail aTitle formToThumbnail labeledItem aReceiver firstElem isTileToRefer | aTitle _ aQuint third. (isTileToRefer _ aQuint second = #tileToRefer) ifFalse: [Thumbnails at: aTitle ifPresent: [:thumb | ^ thumb]]. formToThumbnail _ aQuint at: 5 ifAbsent: []. formToThumbnail ifNil: [aReceiver _ (firstElem _ aQuint first) isSymbol ifTrue: [Smalltalk at: firstElem] ifFalse: [firstElem]. labeledItem := aReceiver perform: aQuint second. formToThumbnail := labeledItem imageForm: 32 backgroundColor: Color transparent forRectangle: labeledItem fullBounds. labeledItem isMorph ifTrue: [labeledItem openInWorld. labeledItem delete]. "To cause proper finalization." "formToThumbnail replaceColor: aColor withColor: Color transparent"]. aThumbnail _ Thumbnail new makeThumbnailFromForm: formToThumbnail. isTileToRefer ifFalse: [self cacheThumbnail: aThumbnail forSymbol: aTitle]. ^ aThumbnail "PartsBin initialize"! !