Color.st
changeset 1907 61fdff318175
parent 1859 b483006c48f5
child 1928 caf10cc253c4
--- a/Color.st	Wed Sep 24 05:20:00 1997 +0200
+++ b/Color.st	Thu Sep 25 11:24:59 1997 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:3.1.5 on 25-mar-1997 at 14:43:26'                    !
+
 Object subclass:#Color
 	instanceVariableNames:'red green blue device colorId ditherForm replacementColor
 		writable'
@@ -21,6 +23,13 @@
 	category:'Graphics-Support'
 !
 
+Object subclass:#DeviceColorHandle
+	instanceVariableNames:'device colorId'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:Color
+!
+
 !Color class methodsFor:'documentation'!
 
 copyright
@@ -4347,9 +4356,53 @@
     ^ true
 ! !
 
+!Color::DeviceColorHandle class methodsFor:'documentation'!
+
+documentation
+"
+    This is an abstract class for device handles which are responsible
+    for finalization i.e. to destroy underlying system resources, when the GC
+    frees an object which has created some system object.
+    These are used with colors.
+
+    [see also:]
+        Color
+
+    [author:]
+        Claus Gittinger
+
+"
+! !
+
+!Color::DeviceColorHandle methodsFor:'accessing'!
+
+setDevice:aDevice colorId:anId
+    "set the handles contents"
+
+    device := aDevice.
+    colorId := anId.
+
+    "Modified: 23.4.1996 / 22:10:26 / cg"
+    "Created: 25.3.1997 / 14:29:10 / stefan"
+! !
+
+!Color::DeviceColorHandle methodsFor:'finalization'!
+
+disposed
+    "the color for which I am a handle was collected 
+     - release system resources"
+
+    colorId notNil ifTrue:[
+        device freeColor:colorId.
+        colorId := nil.
+    ].
+
+    "Created: 25.3.1997 / 14:29:10 / stefan"
+! !
+
 !Color class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.101 1997-08-13 18:25:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.102 1997-09-25 09:24:41 stefan Exp $'
 ! !
 Color initialize!