mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-11-17 12:05:12 +00:00
Fix ICON plugin masks (whoops). Release pattern resources.
This commit is contained in:
parent
404a9e6acc
commit
627256158c
@ -83,13 +83,12 @@
|
|||||||
|
|
||||||
resData = [[resource data] retain];
|
resData = [[resource data] retain];
|
||||||
planes[0] = (unsigned char*) [resData bytes];
|
planes[0] = (unsigned char*) [resData bytes];
|
||||||
|
NSUInteger plane0length = 0;
|
||||||
for (NSUInteger i = 0; i < [resData length]; ++i)
|
|
||||||
planes[0][i] ^= 0xff;
|
|
||||||
|
|
||||||
if( [resType isEqualToString: @"ICN#"] )
|
if( [resType isEqualToString: @"ICN#"] )
|
||||||
{
|
{
|
||||||
planes[1] = planes[0] + (4 * 32); // 32 lines a 4 bytes.
|
planes[1] = planes[0] + (4 * 32); // 32 lines a 4 bytes.
|
||||||
|
plane0length = 4 * 32;
|
||||||
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:32 pixelsHigh:32
|
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:32 pixelsHigh:32
|
||||||
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
||||||
bytesPerRow:4 bitsPerPixel:1] autorelease];
|
bytesPerRow:4 bitsPerPixel:1] autorelease];
|
||||||
@ -97,6 +96,7 @@
|
|||||||
else if( [resType isEqualToString: @"ics#"] || [resType isEqualToString: @"CURS"] )
|
else if( [resType isEqualToString: @"ics#"] || [resType isEqualToString: @"CURS"] )
|
||||||
{
|
{
|
||||||
planes[1] = planes[0] + (2 * 16); // 16 lines a 2 bytes.
|
planes[1] = planes[0] + (2 * 16); // 16 lines a 2 bytes.
|
||||||
|
plane0length = 2 * 16;
|
||||||
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:16
|
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:16
|
||||||
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
||||||
bytesPerRow:2 bitsPerPixel:1] autorelease];
|
bytesPerRow:2 bitsPerPixel:1] autorelease];
|
||||||
@ -104,6 +104,7 @@
|
|||||||
else if( [resType isEqualToString: @"icm#"] )
|
else if( [resType isEqualToString: @"icm#"] )
|
||||||
{
|
{
|
||||||
planes[1] = planes[0] + (2 * 12); // 12 lines a 2 bytes.
|
planes[1] = planes[0] + (2 * 12); // 12 lines a 2 bytes.
|
||||||
|
plane0length = 2 * 12;
|
||||||
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:12
|
bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:12
|
||||||
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace
|
||||||
bytesPerRow:2 bitsPerPixel:1] autorelease];
|
bytesPerRow:2 bitsPerPixel:1] autorelease];
|
||||||
@ -113,6 +114,11 @@
|
|||||||
bitsPerSample:1 samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedWhiteColorSpace
|
bitsPerSample:1 samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedWhiteColorSpace
|
||||||
bytesPerRow:4 bitsPerPixel:1] autorelease];
|
bytesPerRow:4 bitsPerPixel:1] autorelease];
|
||||||
|
|
||||||
|
if (plane0length > 0) {
|
||||||
|
for (NSUInteger i = 0; i < plane0length; ++i)
|
||||||
|
planes[0][i] ^= 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
[resImage addRepresentation:bir];
|
[resImage addRepresentation:bir];
|
||||||
[imageView setImage: resImage];
|
[imageView setImage: resImage];
|
||||||
|
|
||||||
|
@ -63,6 +63,11 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[resource release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName
|
- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName
|
||||||
{
|
{
|
||||||
return [resource defaultWindowTitle];
|
return [resource defaultWindowTitle];
|
||||||
|
@ -44,11 +44,12 @@
|
|||||||
<string key="NSWindowClass">NSWindow</string>
|
<string key="NSWindowClass">NSWindow</string>
|
||||||
<nil key="NSViewClass"/>
|
<nil key="NSViewClass"/>
|
||||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||||
|
<string key="NSWindowContentMinSize">{100, 100}</string>
|
||||||
<object class="NSView" key="NSWindowView" id="1006">
|
<object class="NSView" key="NSWindowView" id="1006">
|
||||||
<reference key="NSNextResponder"/>
|
<reference key="NSNextResponder"/>
|
||||||
<int key="NSvFlags">256</int>
|
<int key="NSvFlags">256</int>
|
||||||
<array class="NSMutableArray" key="NSSubviews">
|
<array class="NSMutableArray" key="NSSubviews">
|
||||||
<object class="NSImageView" id="852818349">
|
<object class="NSImageView" id="599375712">
|
||||||
<reference key="NSNextResponder" ref="1006"/>
|
<reference key="NSNextResponder" ref="1006"/>
|
||||||
<int key="NSvFlags">268</int>
|
<int key="NSvFlags">268</int>
|
||||||
<set class="NSMutableSet" key="NSDragTypes">
|
<set class="NSMutableSet" key="NSDragTypes">
|
||||||
@ -64,7 +65,7 @@
|
|||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSImageCell" key="NSCell" id="898742785">
|
<object class="NSImageCell" key="NSCell" id="844875715">
|
||||||
<int key="NSCellFlags">130560</int>
|
<int key="NSCellFlags">130560</int>
|
||||||
<int key="NSCellFlags2">33554432</int>
|
<int key="NSCellFlags2">33554432</int>
|
||||||
<string key="NSCellIdentifier">_NS:9</string>
|
<string key="NSCellIdentifier">_NS:9</string>
|
||||||
@ -79,8 +80,10 @@
|
|||||||
<string key="NSFrameSize">{478, 309}</string>
|
<string key="NSFrameSize">{478, 309}</string>
|
||||||
<reference key="NSSuperview"/>
|
<reference key="NSSuperview"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView" ref="599375712"/>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||||
|
<string key="NSMinSize">{100, 122}</string>
|
||||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||||
<bool key="NSWindowIsRestorable">YES</bool>
|
<bool key="NSWindowIsRestorable">YES</bool>
|
||||||
</object>
|
</object>
|
||||||
@ -99,7 +102,7 @@
|
|||||||
<object class="IBOutletConnection" key="connection">
|
<object class="IBOutletConnection" key="connection">
|
||||||
<string key="label">imageView</string>
|
<string key="label">imageView</string>
|
||||||
<reference key="source" ref="1001"/>
|
<reference key="source" ref="1001"/>
|
||||||
<reference key="destination" ref="852818349"/>
|
<reference key="destination" ref="599375712"/>
|
||||||
</object>
|
</object>
|
||||||
<int key="connectionID">17</int>
|
<int key="connectionID">17</int>
|
||||||
</object>
|
</object>
|
||||||
@ -150,12 +153,12 @@
|
|||||||
<int key="objectID">2</int>
|
<int key="objectID">2</int>
|
||||||
<reference key="object" ref="1006"/>
|
<reference key="object" ref="1006"/>
|
||||||
<array class="NSMutableArray" key="children">
|
<array class="NSMutableArray" key="children">
|
||||||
<reference ref="852818349"/>
|
<reference ref="599375712"/>
|
||||||
<object class="IBNSLayoutConstraint" id="855301011">
|
<object class="IBNSLayoutConstraint" id="443890170">
|
||||||
<reference key="firstItem" ref="1006"/>
|
<reference key="firstItem" ref="1006"/>
|
||||||
<int key="firstAttribute">6</int>
|
<int key="firstAttribute">6</int>
|
||||||
<int key="relation">0</int>
|
<int key="relation">0</int>
|
||||||
<reference key="secondItem" ref="852818349"/>
|
<reference key="secondItem" ref="599375712"/>
|
||||||
<int key="secondAttribute">6</int>
|
<int key="secondAttribute">6</int>
|
||||||
<float key="multiplier">1</float>
|
<float key="multiplier">1</float>
|
||||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||||
@ -167,11 +170,11 @@
|
|||||||
<int key="contentType">3</int>
|
<int key="contentType">3</int>
|
||||||
<reference key="containingView" ref="1006"/>
|
<reference key="containingView" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBNSLayoutConstraint" id="882842756">
|
<object class="IBNSLayoutConstraint" id="1018290444">
|
||||||
<reference key="firstItem" ref="1006"/>
|
<reference key="firstItem" ref="1006"/>
|
||||||
<int key="firstAttribute">4</int>
|
<int key="firstAttribute">4</int>
|
||||||
<int key="relation">0</int>
|
<int key="relation">0</int>
|
||||||
<reference key="secondItem" ref="852818349"/>
|
<reference key="secondItem" ref="599375712"/>
|
||||||
<int key="secondAttribute">4</int>
|
<int key="secondAttribute">4</int>
|
||||||
<float key="multiplier">1</float>
|
<float key="multiplier">1</float>
|
||||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||||
@ -183,8 +186,8 @@
|
|||||||
<int key="contentType">3</int>
|
<int key="contentType">3</int>
|
||||||
<reference key="containingView" ref="1006"/>
|
<reference key="containingView" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBNSLayoutConstraint" id="830932169">
|
<object class="IBNSLayoutConstraint" id="1175548">
|
||||||
<reference key="firstItem" ref="852818349"/>
|
<reference key="firstItem" ref="599375712"/>
|
||||||
<int key="firstAttribute">5</int>
|
<int key="firstAttribute">5</int>
|
||||||
<int key="relation">0</int>
|
<int key="relation">0</int>
|
||||||
<reference key="secondItem" ref="1006"/>
|
<reference key="secondItem" ref="1006"/>
|
||||||
@ -199,8 +202,8 @@
|
|||||||
<int key="contentType">3</int>
|
<int key="contentType">3</int>
|
||||||
<reference key="containingView" ref="1006"/>
|
<reference key="containingView" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBNSLayoutConstraint" id="8826240">
|
<object class="IBNSLayoutConstraint" id="109993714">
|
||||||
<reference key="firstItem" ref="852818349"/>
|
<reference key="firstItem" ref="599375712"/>
|
||||||
<int key="firstAttribute">3</int>
|
<int key="firstAttribute">3</int>
|
||||||
<int key="relation">0</int>
|
<int key="relation">0</int>
|
||||||
<reference key="secondItem" ref="1006"/>
|
<reference key="secondItem" ref="1006"/>
|
||||||
@ -220,35 +223,35 @@
|
|||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">7</int>
|
<int key="objectID">7</int>
|
||||||
<reference key="object" ref="852818349"/>
|
<reference key="object" ref="599375712"/>
|
||||||
<array class="NSMutableArray" key="children">
|
<array class="NSMutableArray" key="children">
|
||||||
<reference ref="898742785"/>
|
<reference ref="844875715"/>
|
||||||
</array>
|
</array>
|
||||||
<reference key="parent" ref="1006"/>
|
<reference key="parent" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">8</int>
|
<int key="objectID">8</int>
|
||||||
<reference key="object" ref="898742785"/>
|
<reference key="object" ref="844875715"/>
|
||||||
<reference key="parent" ref="852818349"/>
|
<reference key="parent" ref="599375712"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">13</int>
|
<int key="objectID">13</int>
|
||||||
<reference key="object" ref="855301011"/>
|
<reference key="object" ref="443890170"/>
|
||||||
<reference key="parent" ref="1006"/>
|
<reference key="parent" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">14</int>
|
<int key="objectID">14</int>
|
||||||
<reference key="object" ref="882842756"/>
|
<reference key="object" ref="1018290444"/>
|
||||||
<reference key="parent" ref="1006"/>
|
<reference key="parent" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">15</int>
|
<int key="objectID">15</int>
|
||||||
<reference key="object" ref="830932169"/>
|
<reference key="object" ref="1175548"/>
|
||||||
<reference key="parent" ref="1006"/>
|
<reference key="parent" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">16</int>
|
<int key="objectID">16</int>
|
||||||
<reference key="object" ref="8826240"/>
|
<reference key="object" ref="109993714"/>
|
||||||
<reference key="parent" ref="1006"/>
|
<reference key="parent" ref="1006"/>
|
||||||
</object>
|
</object>
|
||||||
</array>
|
</array>
|
||||||
@ -265,10 +268,10 @@
|
|||||||
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<array class="NSMutableArray" key="2.IBNSViewMetadataConstraints">
|
<array class="NSMutableArray" key="2.IBNSViewMetadataConstraints">
|
||||||
<reference ref="855301011"/>
|
<reference ref="443890170"/>
|
||||||
<reference ref="882842756"/>
|
<reference ref="1018290444"/>
|
||||||
<reference ref="830932169"/>
|
<reference ref="1175548"/>
|
||||||
<reference ref="8826240"/>
|
<reference ref="109993714"/>
|
||||||
</array>
|
</array>
|
||||||
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<boolean value="NO" key="7.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
<boolean value="NO" key="7.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user