home *** CD-ROM | disk | FTP | other *** search
Wrap
/*********** ImageConversion: colors ***********/ replace "[<obj> numColors]" with "NSNumberOfColorComponents([<obj> colorSpaceName])" replacemethod "setNumColors:" with same error "ImageConversion: 'setNumColors:' is obsolete; possibly use 'setColorSpaceName:' instead" /*********** ImageConversion: moved from NSImage to NSImageRep ***********/ replace "[<isKindOf(NSImage) class> <old>:<arg>]" with "[NSImageRep <new>:<arg>]" where ("<old>", "<new>") isOneOf { ("registerImageRep", "registerImageRepClass"), ("unregisterImageRep", "unregisterImageRepClass"), ("imageRepForFileType", "imageRepClassForFileType"), ("imageRepForPasteboardType", "imageRepClassForPasteboardType"), ("imageRepForStream", "imageRepClassForData") } replacemethod "<old>" with "<new>" error "ImageConversion: <new> (used to be <old>) is now implemented by the NSImageRep class." where ("<old>", "<new>") isOneOf { ("registerImageRep:", "registerImageRepClass:"), ("unregisterImageRep:", "unregisterImageRepClass:"), ("imageRepForFileType:", "imageRepClassForFileType:"), ("imageRepForPasteboardType:", "imageRepClassForPasteboardType:"), ("imageRepForStream:", "imageRepClassForData:") } /*********** ImageConversion: writeTIFF ***********/ replacemethod "<old>" with "<new>" { replace "<rettype>" with "(NSData *)" replace "<call>" with "<stream_arg> = <call>" } where ("<old>", "<new>") isOneOf { ("writeTIFF:<stream> usingCompression:<comp>", "TIFFRepresentationUsingCompression:<comp> factor:0.0"), ("writeTIFF:<stream> allRepresentations:<flag> usingCompression:<comp> andFactor:<fact>", "TIFFRepresentationUsingCompression:<comp> factor:<fact>"), ("writeTIFF:<stream> allRepresentations:", "TIFFRepresentation"), ("writeTIFF:<stream>", "TIFFRepresentation") } /*********** ImageConversion: new... ***********/ replace "[<obj> <method>:<a>]" with "[[<obj> <replacement>] retain]" where ("<method>", "<replacement>") isOneOf { ("newListFromSection", "imageRepsWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:<a>]"), ("newListFromFile", "imageRepsWithContentsOfFile:<a>"), ("newListFromStream", "imageRepsWithData:<a>") } replace "[<obj> <method>:<a> zone:<z>]" with "[[<obj> <replacement>] retain]" where ("<method>", "<replacement>") isOneOf { ("newListFromSection", "imageRepsWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:<a>]"), ("newListFromFile", "imageRepsWithContentsOfFile:<a>"), ("newListFromStream", "imageRepsWithData:<a>") } /*********** ImageConversion: init... ***********/ replace "[[<isKindOf(NSImage) class> <b alloc>] initFromSection:<section>]" with "[<class> imageNamed:<section>]" warning "ImageConversion: [<class> imageNamed:...] used to be [[<class> alloc..] initFromSection...]; the image is named as a side effect of this conversion" replace "[[<isKindOf(NSImage) class> <b alloc>] <old>:<a>]" with "[[<class> <b alloc>] <new>:<a>]" where ("<old>", "<new>") isOneOf { ("initFromFile", "initByReferencingFile"), ("initFromStream", "initWithData"), } replace "[[NSImageRep <b alloc>] initFromPasteboard:<pboard>]" with "[NSImageRep imageRepWithPasteboard:<pboard>]" replacemethod "initFromPasteboard:" with "initWithPasteboard:" replacemethod "initFromImage:rect:" with same warning "ImageConversion: NSImages 'initFromImage:rect:' is obsolete. Use the copy method instead." replace "[[NSBitmapImageRep <b alloc>] initFromSection:<section>]" with "[[NSBitmapImageRep imageRepWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:<section>]] retain]" replace "[[NSBitmapImageRep <b alloc>] initFromFile:<file>]" with "[[NSBitmapImageRep imageRepWithContentsOfFile:<file>] retain]" replace "[[NSBitmapImageRep <b alloc>] initFromStream:<stream>]" with "[[NSBitmapImageRep <b alloc>] initWithData:<stream>]" replace "[[NSEPSImageRep <b alloc>] initFromSection:<section>]" with "[[NSEPSImageRep imageRepWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:<section>]] retain]" replace "[[NSEPSImageRep <b alloc>] initFromFile:<file>]" with "[[NSEPSImageRep imageRepWithContentsOfFile:<file>] retain]" replace "[[NSEPSImageRep <b alloc>] initFromStream:<stream>]" with "[[NSEPSImageRep <b alloc>] initWithData:<stream>]" replace "[<bitmaprep> initData:NULL fromRect:<rect>]" with "[<bitmaprep> initWithFocusedViewRect:<rect>]" replace "[<bitmaprep> initData:<data> fromRect:<rect>]" with "[<bitmaprep> initWithFocusedViewRect:<rect>]" warning "ImageConversion: 'initWithFocusedViewRect:' used to be 'initData:fromRect:' with <data> as the first arg; ignoring <data>" replacemethod "initData:<data> fromRect:<rect>" with "initWithFocusedViewRect:<rect>" warning "ImageConversion: 'initWithFocusedViewRect:' used to be 'initData:fromRect:'; the data pointer is obsolete" replace "<t target> = [<bitmaprep> initData:<1> pixelsWide:<2> pixelsHigh:<3> bitsPerSample:<4> samplesPerPixel:<5> hasAlpha:<6> isPlanar:<7> colorSpace:<8> bytesPerRow:<9> bitsPerPixel:<10>]" with "{ unsigned char *conversion_tmp[5] = {NULL}; conversion_tmp[0] = <1>; <target> = [<bitmaprep> initWithBitmapDataPlanes:&conversion_tmp[0] pixelsWide:<2> pixelsHigh:<3> bitsPerSample:<4> samplesPerPixel:<5> hasAlpha:<6> isPlanar:<7> colorSpaceName:<8> bytesPerRow:<9> bitsPerPixel:<10>]; }" replace "[<bitmaprep> initData:<1> pixelsWide:<2> pixelsHigh:<3> bitsPerSample:<4> samplesPerPixel:<5> hasAlpha:<6> isPlanar:<7> colorSpace:<8> bytesPerRow:<9> bitsPerPixel:<10>]" with "{ unsigned char *conversion_tmp[5] = {NULL}; conversion_tmp[0] = <1>; [<bitmaprep> initWithBitmapDataPlanes:&conversion_tmp[0] pixelsWide:<2> pixelsHigh:<3> bitsPerSample:<4> samplesPerPixel:<5> hasAlpha:<6> isPlanar:<7> colorSpaceName:<8> bytesPerRow:<9> bitsPerPixel:<10>]; }" replacemethod "initData:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpace:bytesPerRow:bitsPerPixel:" with "initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:" replace "@<intOrImp> <isKindOf(NSImage) class><w w1><any code><w w2>@end" with same where "<intOrImp>" isOneOf { "interface", "implementation" } within ("<code>") { replace "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("- initFromFile", "- initByReferencingFile"), ("- initFromStream", "- initWithData"), } } /*********** ImageConversion: cache depth ***********/ replacemethod "setCacheDepthBounded:<flag>" with "setCacheDepthMatchesImageDepth:<flag>" { replace "<flag_arg>" with "!<flag_arg>" } within ("<implementation>") { replace "<flag_param>" with "!<flag_param>" } replacemethod "isCacheDepthBounded" with "cacheDepthMatchesImageDepth" { replace "<call>" with "(!<call>)" } within ("<implementation>") { replace "return <retval>;" with "return !(<retval>);" } replace "[<token image> useCacheWithDepth:<depth>]" with "[<image> addRepresentation:[[[NSCachedImageRep alloc] initWithSize:[<image> size] depth:<depth> separate:[<image> isCachedSeparately] alpha:YES] autorelease]]" warning "ImageConversion: Make sure that <image> can be evaluated multiple times." replace "[<image> useCacheWithDepth:<depth>]" with "[<image> addRepresentation:[[[NSCachedImageRep alloc] initWithSize:[<image> size] depth:<depth> separate:[<image> isCachedSeparately] alpha:YES] autorelease]]" warning "ImageConversion: Make sure that <image> can be evaluated multiple times." /*********** ImageConversion: loadFromStream, loadFromFile ***********/ replace "[<image> loadFromStream:<stream>]" with "[<image> addRepresentations:[NSImageRep imageRepsWithData:<stream>]]" replace "[<image> loadFromFile:<file>]" with "[<image> addRepresentations:[NSImageRep imageRepsWithContentsOfFile:<file>]]" replacemethod "loadFromStream:" with same error "ImageConversion: 'loadFromStream:' is obsolete. Use addRepresentation: to add representations to an image once it is created." replacemethod "loadFromFile:" with same error "ImageConversion: 'loadFromFile:' is obsolete. Use addRepresentation: to add representations to an image once it is created." replacemethod "canLoadFromStream:" with "canInitWithData:" { replace "<stream_type>" with "(NSData *)" } error "ImageConversion: 'canInitWithData:' (used to be 'canLoadFromStream:') takes an NSData instance (used to take NXStream)." /*********** ImageConversion: getWindow ***********/ replace "[<token cachedrep> getWindow:<win> andRect:<rect>]" with "{ *(<win>) = [<cachedrep> window]; *(<rect>) = [<cachedrep> rect]; }" replace "[<cachedrep> getWindow:<win> andRect:<rect>]" with "{ NSCachedImageRep *tmpCachedRep = <cachedrep>; *(<win>) = [tmpCachedRep window]; *(<rect>) = [tmpCachedRep rect]; }" /*********** ImageConversion: getEPS ***********/ replacemethod "getEPS:length:" with "EPSRepresentation" { replace "<call>" with "<eps> = <call>" } error "ImageConversion: 'EPSRepresentation' returns an NSData instance (used to be 'getEPS:length:')" /*********** ImageConversion: others ***********/ replace "[<image> useDrawMethod:<method> inObject:<obj>]" with "[<image> addRepresentation:[[[NSCustomImageRep alloc] initWithDrawSelector:<method> delegate:<obj>] autorelease]]" replace "[<cachedimage> getWindow:<win> andRect:<rect>];" with "{ *<win> = [<cachedimage> window]; *<rect> = [<cachedimage> rect]; }" replace "*&" with "" replacemethod "getWindow:andRect:" with same error "ImageConversion: 'getWindow:andRect' has been replaced by two methods: 'window' and 'rect'" /*********** ImageConversion: simple renaming ***********/ replacemethod "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("canInitFromPasteboard:", "canInitWithPasteboard:"), ("composite:<op>fromRect:<rect>toPoint:<point>", "compositeToPoint:<point>fromRect:<rect>operation:<op>"), ("composite:<op>toPoint:<point>", "compositeToPoint:<point>operation:<op>"), ("dissolve:<delta>fromRect:<rect>toPoint:<point>", "dissolveToPoint:<point>fromRect:<rect>fraction:<delta>"), ("dissolve:<delta>toPoint:<point>", "dissolveToPoint:<point>fraction:<delta>"), ("drawAt:", "drawAtPoint:"), ("drawIn:", "drawInRect:"), ("findImageNamed:", "imageNamed:"), ("getCompression:andFactor:", "getCompression:factor:") ("getDataPlanes:", "getBitmapDataPlanes:"), ("initDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpace:bytesPerRow:bitsPerPixel:", "initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:") ("initDrawMethod:inObject:", "initWithDrawSelector:delegate:"), ("initFromWindow:rect:", "initWithWindow:rect:") ("initSize:", "initWithSize:") ("isColorMatchPreferred", "prefersColorMatch"), ("isEPSUsedOnResolutionMismatch", "usesEPSOnResolutionMismatch"), ("isMatchedOnMultipleResolution", "matchesOnMultipleResolution"), ("isScalable", "scalesWhenResized"), ("isUnique", "isCachedSeparately"), ("lockFocusOn:", "lockFocusOnRepresentation:") ("numPlanes", "numberOfPlanes"), ("representationList", "representations"), ("setColorMatchPreferred:", "setPrefersColorMatch:"), ("setCompression:andFactor:", "setCompression:factor:") ("setEPSUsedOnResolutionMismatch:", "setUsesEPSOnResolutionMismatch:"), ("setMatchedOnMultipleResolution:", "setMatchesOnMultipleResolution:"), ("setScalable:", "setScalesWhenResized:"), ("setUnique:", "setCachedSeparately:"), ("useRepresentation:", "addRepresentation:") } replacemethod "bestRepresentation" with "bestRepresentationForDevice:<device>" { replace "<device_type>" with "(NSDictionary *)" replace "<device_param>" with "deviceDescription" replace "<device_arg>" with "nil" } /*********** ImageConversion: obsolete methods ***********/ replacemethod "<sel>" with same error "ImageConversion: <sel> is obsolete." where "<sel>" isOneOf { "getImage:rect:", "lastRepresentation", "useFromFile:", "useFromSection:", "sizeImage:", "sizeImage:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpace:" } replacemethod "<sel>" with same error "ImageConversion: <sel> is obsolete." where "<sel>" isOneOf { "getImage:rect:", "lastRepresentation", "useFromFile:", "useFromSection:" } /*********** ImageConversion: obsolete functions ***********/ replace "NXSizeBitmap(<b args>)" with same warning "ImageConversion: NXSizeBitmap/NXReadBitmap can be replaced by the much cleaner [[NSBitmapImageRep alloc] initWithFocusedViewRect:rect]" replace "NXReadBitmap(<b args>)" with same warning "ImageConversion: NXSizeBitmap/NXReadBitmap can be replaced by the much cleaner [[NSBitmapImageRep alloc] initWithFocusedViewRect:rect]"