ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Temp/ColorMerge/MiscImageDissolver/MiscImageDissolver.rtf

This is MiscImageDissolver.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1  1997 by Mark Probst. All Rights Reserved.  i i0 
s5 li2116 fi0 ri1007 ql f0 fs56 b MiscImageDissolverb0 
{fs16 




}s17 li4888 fi-2771 ri1007 ql tx4888 f0 fs28 b Inherits From:b0 f1 fs28 	View : Responder : Object
s17 li4888 fi-2771 ri1007 ql tx4888 f0 fs28 b Declared In:b0 f1 fs28 	MiscImageDissolver.h
s13 li1360 fi0 ri1007 ql fs16 



f0 fs36 b Class Descriptionb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 MiscImageDissolver is a View that is able of not only displaying an image but also of smoothly dissolving from one image into another.  The parameters of the dissolving process are the number of steps and the duration of one step.
fs16 
fs28 Note that the methods b dissolveToImage:b0  and b dissolveOverImageList:b0  only start a dissolving process and return immediately.  The dissolving is taken out in the background (by virtue of a timed entry). 
s13 li1360 fi0 ri1007 ql fs16 



f0 fs36 b Instance Variablesb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 NXImage *b sourceImageb0 ;
NXImage *b destImageb0 ;
List *b imageListb0 ;
int b numStepsb0 ;
double b secsb0 ;
int b currentStepb0 ;
int b currentIndexb0 ;
char *b image1Nameb0 ;
char *b image2Nameb0 ;
DPSTimedEntry b timedEntryb0 ; 
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 sourceImage	A pointer to the image currently displayed.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 destImage	A pointer to the image currently dissolved to.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 imageList	A pointer to the image list currently dissolved over.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 numSteps	The number of steps of the dissolving process.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 secs	The number of seconds between two steps.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 currentStep	The current dissolving step or < 0 if finished.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 currentIndex	The current index in imageList of the image currently dissolved to.
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 image1Name	The name of an image
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 image2Name	The name of another image
s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 timedEntry	The timed entry for the dissolving process.
s13 li1360 fi0 ri1007 ql fs16 



f0 fs36 b Method Typesb0 
{fs16 
}s11 li6148 fi-4031 ri1007 ql tx6148 f1 fs28 Initializing and freeing	{f3 -} initFrame:
	{f3 -} free
Dissolving parameters	{f3 -} numSteps
	{f3 -} setNumSteps:
	{f3 -} stepInterval
	{f3 -} setStepInterval:
Convenience	{f3 -} image1Name
	{f3 -} setImage1Name:
	{f3 -} image2Name
	{f3 -} setImage2Name:
The image	{f3 -} image
	{f3 -} setImage:
Dissolving	{f3 -} dissolveToImage:
	{f3 -} dissolveOverImageList:
	{f3 -} dissolveToImage1:
	{f3 -} dissolveToImage2:
	{f3 -} dissolveToOtherImage:
	{f3 -} dissolveBackAndForth:
	{f3 -} hasFinished
Displaying	{f3 -} drawSelf::
	{f3 -} dissolveStep
Archiving	{f3 -} read:
	{f3 -} write:
s13 li1360 fi0 ri1007 ql fs16 



f0 fs36 b Instance Methodsb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveBackAndForth:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveBackAndForthb0 b :b0 i senderi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 This method dissolves over the two images named image1Name and image2Name.  If the currently displayed image is image1Name, it dissolves first to image2Name and then back to image1Name, otherwise it dissolves the other way round.
fs16 
fs28 This method works by calling b dissolveOverImageList:b0 .
fs16 
fs28 Returns b selfb0  on success, and b nilb0  otherwise. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveOverImageList:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveOverImageListb0 b :b0 (List*)i theListi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Starts a dissolving process over the list i theListi0 .  i theListi0  must contain pointers to NXImage's.  The current image is dissolved to the first element in the list, which in turn is then dissolved to the second etc.
fs16 
fs28 If everything is in order and the dissolving has been started, this method returns b selfb0 .  Otherwise, returns b nilb0 .
fs16 
fs28 If the methods returns b selfb0 , you can assume that the list will be freed.  Otherwise, you have to free it yourself. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveStepb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveStepb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Does one step in the dissolving process.  You do not call this method directly.  It is called from the timed entry function instead.  Returns b selfb0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveToImage1:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveToImage1b0 b :b0 i senderi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Dissolves to an image named image1Name using the method b dissolveToImage:b0 .
fs16 
fs28 Returns b selfb0  on success, and b nilb0  otherwise. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveToImage2:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveToImage2b0 b :b0 i senderi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Dissolves to an image named image2Name using the method b dissolveToImage:b0 .
fs16 
fs28 Returns b selfb0  on success, and b nilb0  otherwise. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveToImage:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveToImageb0 b :b0 (NXImage*)i theImagei0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Starts a dissolving process to i theImagei0 , if dissolving is not already in progress, and returns b selfb0 .  Otherwise, returns b nilb0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b dissolveToOtherImage:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b dissolveToOtherImageb0 b :b0 i senderi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Dissolves to the image named image2Name, if sourceImage is the image named image1Name.  Otherwise dissolves to the image named image1Name.  In other words: If the currently displayed image is either of image1Name or image2Name, this method dissolves to the other one, and dissolves to image1Name if the currently displayed image is neither of the two.
fs16 
fs28 This method uses b dissolveToImage:b0 .
fs16 
fs28 Returns b selfb0  on success, and b nilb0  otherwise. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b drawSelf::b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b drawSelfb0 b :b0 (const NXRect*)i rectsi0  b  b0 b :b0 (int)i rectCounti0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Draws the MiscImageDissolver object and returns b selfb0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b freeb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b freeb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Frees the MiscImageDissolver instance. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b hasFinishedb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (BOOL)b hasFinishedb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns YES if there is no dissolving in progress.  Otherwise, returns NO. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b imageb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (NXImage*)b imageb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns sourceImage. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b image1Nameb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (const char*)b image1Nameb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns image1Name. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b image2Nameb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (const char*)b image2Nameb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns image2Name. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b initFrame:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b initFrameb0 b :b0 (const NXRect*)i recti0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Initializes the MiscImageDissolver object and sets sourceImage to the image named image1Name (if set), otherwise to the image named "ImageDissolver" (if available).  The number of steps is set to 20 and the duration of a step is set to 0.05 seconds.
fs16 
fs28 This is the designated initializer for MiscImageDissolver. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b numStepsb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (int)b numStepsb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns the number of steps of the dissolving process. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b read:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b readb0 b :b0 (NXTypedStream*)i theStreami0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Reads the MiscImageDissolver object in from the typed stream i theStreami0 .  Returns b selfb0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b setImage1Name:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b setImage1Nameb0 b :b0 (const char*)i theNamei0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Sets image1Name to the string pointed to by i theNamei0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b setImage2Name:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b setImage2Nameb0 b :b0 (const char*)i theNamei0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Sets image2Name to the string pointed to by i theNamei0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b setImage:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b setImageb0 b :b0 (NXImage*)i theImagei0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Sets the image displayed to i theImagei0 , if dissolving is not in progress, and returns b selfb0 .  Otherwise, returns b nilb0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b setNumSteps:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b setNumStepsb0 b :b0 (int)i theNumStepsi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Sets the number of steps of the dissolving process to i theNumStepsi0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b setStepInterval:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b setStepIntervalb0 b :b0 (double)i theSecondsi0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Sets the duration of a dissolving step to i theSecondsi0 . 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b stepIntervalb0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  (double)b stepIntervalb0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Returns the duration of one dissolving step in seconds. 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 f0 fs28 b write:b0 
fs28 {fs8 
}tx3240 li2100 fi-760 li3240f1 fs28  b writeb0 b :b0 (NXTypedStream*)i theStreami0 
{fs16 
}pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 Writes the MiscImageDissolver object to the typed stream i theStreami0 .  Returns b selfb0 . 

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.