Archived
1

Optimized image resources.

This commit is contained in:
Kim Wittenburg
2015-09-04 02:06:52 +02:00
parent 2c2252f6af
commit b851b70ddb
17 changed files with 87 additions and 68 deletions

View File

@@ -37,7 +37,7 @@ public class AlbumTableCellView: AdvancedTableCellView {
/// Contains the *tick* image for saved albums.
@IBOutlet public lazy var secondaryImageView: NSImageView! = {
let secondaryImageView = NSImageView()
secondaryImageView.image = NSImage(named: "Tick")
secondaryImageView.image = NSImage(named: "Tick")?.imageByMaskingWithColor(NSColor.clearColor())
secondaryImageView.imageScaling = .ScaleProportionallyDown
secondaryImageView.translatesAutoresizingMaskIntoConstraints = false
return secondaryImageView

View File

@@ -2,22 +2,14 @@
"images" : [
{
"idiom" : "universal",
"filename" : "Cross.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Cross-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Cross-2.png",
"scale" : "3x"
"filename" : "Cross.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

View File

@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Note.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Save.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@@ -0,0 +1,29 @@
%PDF-1.4
%âãÏÓ
1 0 obj <</Filter/FlateDecode/Length 321>>stream
­“;N1 †{ŸÂÀ²<C380>Ø“\‰b+
<1A> áú8™É<¨(ÐJ£|~üòk?á…5ã{<gè°=úg†W¸üÅÛ| /ÞÁÃ#ãSHd%•!SÐTGæJMp‰Ú_'í0y>J$?J­‰ž¯“D«Ÿñë¬&*X<58>fH¹—…Ršˆ‡+™ ¬Ù[ÅWXÙÝÈ[]f<>IwjÒî,­žáu¯ÇàkžzðŠÂ1D·BcÎǺ¯Ñ”F|ÖmHaA<>aøÖÿ ɉ “QjúbJÙ±P6”I(+Þ01³(ª¦fÞø
E¸ImŠKëm³”Ð0lj¼`‰2rÅ”É,×ÝhXµTã>ÁS±>âha>öÓvö —åvöÅïû=,ý|
Ë®/¿¯n?®ÃÅ<C383>Oñ?2ÿþg¹ôß=K§=
endstream
endobj
3 0 obj<</Contents 1 0 R/Type/Page/Resources<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]>>/Parent 2 0 R/MediaBox[0 0 1024 1024]>>
endobj
2 0 obj<</Kids[3 0 R]/Type/Pages/Count 1>>
endobj
4 0 obj<</Type/Catalog/Pages 2 0 R>>
endobj
5 0 obj<</ModDate(D:20150904000250Z)/Creator(http://www.fileformat.info/convert/image/svg2pdf.htm)/CreationDate(D:20150904000250Z)/Producer(iText1.2.3 by lowagie.com \(based on itext-paulo-152\))>>
endobj
xref
0 6
0000000000 65535 f
0000000015 00000 n
0000000543 00000 n
0000000403 00000 n
0000000593 00000 n
0000000637 00000 n
trailer
<</Info 5 0 R/ID [<e10888a855614e5c858d394112bdd7fb><e10888a855614e5c858d394112bdd7fb>]/Root 4 0 R/Size 6>>
startxref
842

View File

@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "SaveToITunes.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "SaveToITunes-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "SaveToITunes-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 KiB

View File

@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "iTunes-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "iTunes-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "iTunes.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 KiB

View File

@@ -664,12 +664,12 @@ CA
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<toolbar key="toolbar" implicitIdentifier="77DCE6FB-61CD-40EE-B6F9-02081D2DE8BE" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="jCk-5k-5x7">
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="694E800B-64CF-416A-A82D-2E13BB23AEC4" label="Add Selection" paletteLabel="Add iTunes Selection" tag="-1" image="iTunes" id="vfK-go-3oR">
<toolbarItem implicitItemIdentifier="694E800B-64CF-416A-A82D-2E13BB23AEC4" label="Add Selection" paletteLabel="Add iTunes Selection" tag="-1" image="Note" id="vfK-go-3oR">
<connections>
<action selector="addITunesSelection:" target="Oky-zY-oP4" id="G9h-yp-J9e"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="573468FC-979E-4370-A98C-49CB9C00BE09" label="Save" paletteLabel="Save to iTunes" tag="-1" image="SaveToITunes" id="ax1-DR-t4v">
<toolbarItem implicitItemIdentifier="573468FC-979E-4370-A98C-49CB9C00BE09" label="Save" paletteLabel="Save to iTunes" tag="-1" image="Save" id="ax1-DR-t4v">
<connections>
<action selector="performSave:" target="Oky-zY-oP4" id="9BZ-UY-ffJ"/>
</connections>
@@ -857,13 +857,13 @@ CA
<action selector="performSearch:" target="XfG-lQ-9wD" id="zNC-V3-DNP"/>
</connections>
</searchField>
<scrollView autohidesScrollers="YES" horizontalLineScroll="33" horizontalPageScroll="10" verticalLineScroll="33" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zXR-px-hjg">
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zXR-px-hjg">
<rect key="frame" x="20" y="20" width="652" height="320"/>
<clipView key="contentView" id="CyK-XI-Ggy">
<rect key="frame" x="1" y="1" width="650" height="318"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" autosaveColumns="NO" rowHeight="31" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="p3C-E5-sdk" id="1Vy-Gq-TWU">
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="p3C-E5-sdk" id="1Vy-Gq-TWU">
<rect key="frame" x="0.0" y="0.0" width="650" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
@@ -922,9 +922,9 @@ CA
</scene>
</scenes>
<resources>
<image name="Cross" width="245.75999450683594" height="245.75999450683594"/>
<image name="Cross" width="1024" height="1024"/>
<image name="NSPreferencesGeneral" width="32" height="32"/>
<image name="SaveToITunes" width="512" height="512"/>
<image name="iTunes" width="512" height="512"/>
<image name="Note" width="1024" height="1024"/>
<image name="Save" width="1024" height="1024"/>
</resources>
</document>

View File

@@ -13,6 +13,20 @@ import AppKitPlus
/// only be initialized from a nib or storyboard.
public class TrackTableCellView: AdvancedTableCellView {
// MARK: Types
private struct Images {
/// Caches the tick image for track cells so that it does not need to be
/// reloaded every time a cell is configured.
static let tickImage = NSImage(named: "Tick")?.imageByMaskingWithColor(NSColor.clearColor())
/// Caches the gray tick image for track cells so that it does not need to be
/// reloaded every time a cell is configured.
static let grayTickImage = NSImage(named: "Tick")?.imageByMaskingWithColor(NSColor.lightGrayColor())
}
// MARK: Properties
/// An outlet do display the track number. This acts as a secondary label.
@@ -97,9 +111,9 @@ public class TrackTableCellView: AdvancedTableCellView {
secondaryTextField?.stringValue = track.artistName
trackNumberTextField?.stringValue = "\(track.trackNumber)"
if track.associatedTracks.isEmpty {
imageView?.image = NSImage(named: "TickBW")
imageView?.image = TrackTableCellView.Images.grayTickImage
} else {
imageView?.image = NSImage(named: "Tick")
imageView?.image = TrackTableCellView.Images.tickImage
}
if track.saved {
let aspectRatioConstraint = NSLayoutConstraint(