You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -97,7 +97,7 @@ There are obvious consequences to this approach, however. Uncompressed image dat
97
97
98
98
#### Byte Alignment
99
99
100
-
For high-performance scrolling, it is critical that Core Animation is able to use an image without first having to create a copy. One of the reasons Core Animation would create a copy of an image is improper byte-alignment of the image's underlying CGImageRef. A properly aligned bytes-per-row value must be a multiple of (8 pixels * bytes per pixel). For a typical ARGB image, the aligned bytes-per-row value is a multiple of 32. Every image table is configured such that each image is always properly byte-aligned for Core Animation from the start. As a result, when images are retrieved from an image table, they are already in a form that Core Animation can work with directly without having to create a copy.
100
+
For high-performance scrolling, it is critical that Core Animation is able to use an image without first having to create a copy. One of the reasons Core Animation would create a copy of an image is improper byte-alignment of the image's underlying [`CGImageRef`](http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fdeveloper.apple.com%2Flibrary%2Fios%2Fdocumentation%2Fgraphicsimaging%2FReference%2FCGImage%2FReference%2Freference.html&ei=fG9XUpX_BqWqigLymIG4BQ&usg=AFQjCNHTelntXU5Gw0BQkQqj9HC5iZibyA&sig2=tLY7PDhyockUVlVFbrzyOQ). A properly aligned bytes-per-row value must be a multiple of `8 pixels × bytes per pixel`. For a typical ARGB image, the aligned bytes-per-row value is a multiple of 32. Every image table is configured such that each image is always properly byte-aligned for Core Animation from the start. As a result, when images are retrieved from an image table, they are already in a form that Core Animation can work with directly without having to create a copy.
101
101
102
102
## Considerations
103
103
@@ -107,7 +107,7 @@ Image tables are configured by image formats, which specify (among other things)
107
107
108
108
Image tables allocate 4 bytes per pixel, so the maximum space occupied by an image table file can be determined as follows:
109
109
110
-
`4 bytes per pixel` × `image width in pixels` × `image height in pixels` × `maximum number of entries`
110
+
`4 bytes per pixel × image width in pixels × image height in pixels × maximum number of entries`
111
111
112
112
Applications using Fast Image Cache should carefully consider how many images each image table should contain. When a new image is stored in an image table that is already full, it will replace the least-recently-accessed image.
113
113
@@ -146,7 +146,7 @@ The `FastImageCacheDemo` Xcode project requires Xcode 5.0 or greater and is conf
146
146
- Clone this repository, or [download the latest archive of `master`](https://github.com/path/FastImageCache/archive/master.zip).
147
147
- From the `FastImageCache` root directory, copy the source files from the inner [`FastImageCache`](./FastImageCache) subdirectory to your Xcode project.
148
148
- Import [`FICImageCache.h`](./FastImageCache/FICImageCache.h) wherever you use the image cache.
149
-
- Import [`FICEntity.h`](./FastImageCache/FICEntity.h) for each class that conforms to [`FICEntity`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html).
149
+
- Import [`FICEntity.h`](./FastImageCache/FICEntity.h) for each class that conforms to `FICEntity`.
Entities are objects that conform to the [`FICEntity`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html) protocol. Entities uniquely identify entries in an image table, and they are also responsible for drawing the images they wish to store in the image cache. Applications that already have model objects defined (perhaps managed by Core Data) are usually appropriate entity candidates.
191
+
Entities are objects that conform to the `FICEntity` protocol. Entities uniquely identify entries in an image table, and they are also responsible for drawing the images they wish to store in the image cache. Applications that already have model objects defined (perhaps managed by Core Data) are usually appropriate entity candidates.
192
192
193
193
```objective-c
194
194
@interfaceXXUser : NSObject <FICEntity>
@@ -200,7 +200,7 @@ Entities are objects that conform to the [`FICEntity`](https://s3.amazonaws.com/
200
200
@end
201
201
```
202
202
203
-
Here is an example implementation of the [`FICEntity`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html) protocol.
203
+
Here is an example implementation of the `FICEntity` protocol.
204
204
205
205
```objective-c
206
206
- (NSString *)UUID {
@@ -236,11 +236,11 @@ Here is an example implementation of the [`FICEntity`](https://s3.amazonaws.com/
236
236
}
237
237
```
238
238
239
-
Ideally, an entity's [`UUID`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html#//api/name/UUID) should never change. This is why it corresponds nicely with a model object's server-generated ID in the case where an application is working with resources retrieved from an API.
239
+
Ideally, an entity's `UUID` should never change. This is why it corresponds nicely with a model object's server-generated ID in the case where an application is working with resources retrieved from an API.
240
240
241
-
An entity's [`sourceImageUUID`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html#//api/name/sourceImageUUID)*can* change. For example, if a user updates their profile photo, the URL to that photo should change as well. The [`UUID`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html#//api/name/UUID) remains the same and identifies the same user, but the changed profile photo URL will indicate that there is a new source image.
241
+
An entity's `sourceImageUUID`*can* change. For example, if a user updates their profile photo, the URL to that photo should change as well. The `UUID` remains the same and identifies the same user, but the changed profile photo URL will indicate that there is a new source image.
242
242
243
-
> **Note**: Often, it is best to hash whatever identifiers are being used to define [`UUID`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html#//api/name/UUID) and [`sourceImageUUID`](https://s3.amazonaws.com/fast-image-cache/documentation/Protocols/FICEntity.html#//api/name/sourceImageUUID). Fast Image Cache provides utility functions to do this. Because hashing can be expensive, it is recommended that the hash be computed only once (or only when the identifier changes) and stored in an instance variable.
243
+
> **Note**: Often, it is best to hash whatever identifiers are being used to define `UUID` and `sourceImageUUID`. Fast Image Cache provides utility functions to do this. Because hashing can be expensive, it is recommended that the hash be computed only once (or only when the identifier changes) and stored in an instance variable.
244
244
245
245
When the image cache is asked to provide an image for a particular entity and format name, the entity is responsible for providing a URL. The URL need not even point to an actual resource—e.g., the URL might be constructed of a custom URL-scheme—, but it must be a valid URL.
246
246
@@ -273,12 +273,12 @@ There are a few things to note here.
273
273
274
274
1. Note that it is an entity and an image format name that uniquely identifies the desired image in the image cache. As a format name uniquely identifies an image table, the entity alone uniquely identifies the desired image data in an image table.
275
275
1. The image cache never returns a [`UIImage`](http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC0QFjAA&url=http%3A%2F%2Fdeveloper.apple.com%2Flibrary%2Fios%2Fdocumentation%2Fuikit%2Freference%2FUIImage_Class%2F&ei=lG9XUtTdJIm9iwKDq4CACA&usg=AFQjCNEa2LN2puQYOfBRVPaEsvsSawOVMg&sig2=0TzbC6wzT5EdynHsDMIEUw) directly. The requested image is included in the completion block. The return value will indicate whether or not the image already exists in the image cache.
276
-
1. [`-retrieveImageForEntity:withFormatName:completionBlock:`](https://s3.amazonaws.com/fast-image-cache/documentation/Classes/FICImageCache.html#//api/name/retrieveImageForEntity:withFormatName:completionBlock:) is a synchronous method. If the requested image already exists in the image cache, the completion block will be called immediately. There is an asynchronous counterpart to this method called [`-asynchronouslyRetrieveImageForEntity:withFormatName:completionBlock:`](https://s3.amazonaws.com/fast-image-cache/documentation/Classes/FICImageCache.html#//api/name/asynchronouslyRetrieveImageForEntity:withFormatName:completionBlock:).
276
+
1. `-retrieveImageForEntity:withFormatName:completionBlock:` is a synchronous method. If the requested image already exists in the image cache, the completion block will be called immediately. There is an asynchronous counterpart to this method called `-asynchronouslyRetrieveImageForEntity:withFormatName:completionBlock:`.
277
277
1. If a requested image does **not** already exist in the image cache, then the image cache invokes the necessary actions to request the source image for its delegate. Afterwards, perhaps some time later, the completion block will be called.
278
278
279
279
> **Note**: The distinction of synchronous and asynchronous only applies to the process of retrieving an image that already exists in the image cache. In the case where a synchronous image request is made for an image that does not already exist in the image case, the image cache does **not** block the calling thread until it has an image. The retrieval method will immediately return `NO`, and the completion block will be called later.
280
280
>
281
-
> See the [`FICImageCache` class reference](https://s3.amazonaws.com/fast-image-cache/documentation/Classes/FICImageCache.html) for a thorough explanation of how the execution lifecycle works for image retrieval, especially as it relates to the handling of the completion blocks.
281
+
> See the `FICImageCache` class header for a thorough explanation of how the execution lifecycle works for image retrieval, especially as it relates to the handling of the completion blocks.
282
282
283
283
### Providing Source Images to the Image Cache
284
284
@@ -343,9 +343,7 @@ For example, if a user changes their profile photo, it probably makes sense to p
343
343
344
344
## Documentation
345
345
346
-
Fast Image Cache's header files are fully documented, and [appledoc](http://gentlebytes.com/appledoc/)-generated documentation is available in [HTML form](https://s3.amazonaws.com/fast-image-cache/documentation/index.html).
347
-
348
-
Fast Image Cache's implementation files are minimally documented where special attention needs to be raised. Otherwise, every effort was made to write self-documenting code.
346
+
Fast Image Cache's header files are fully documented, and [appledoc](http://gentlebytes.com/appledoc/) can be used to generate documentation in various forms, including HTML and Xcode DocSet.
0 commit comments