Skip to content

Commit 84a329f

Browse files
author
Michael Shannon Potter
committed
Update README
1 parent 3a86d17 commit 84a329f

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="http://www.path.com/" target="_blank"><img src="https://s3.amazonaws.com/fast-image-cache/readme-resources/path-logo.png" width="25%" height="25%" alt="Path Logo"></a>
1+
<a href="http://www.path.com/" target="_blank"><img src="https://s3.amazonaws.com/fast-image-cache/readme-resources/path-logo.png" width="227" height="86" alt="Path Logo"></a>
22

33
# Fast Image Cache
44

@@ -27,7 +27,7 @@ A significant burden on performance for graphics-rich applications like [Path](h
2727

2828
## Version History
2929

30-
- [**1.0**](http://github.com/path/FastImageCache/tree/1.0) (10/12/2013): Initial release
30+
- [**1.0**](http://github.com/path/FastImageCache/tree/1.0) (10/18/2013): Initial release
3131

3232
## What Fast Image Cache Does
3333

@@ -97,7 +97,7 @@ There are obvious consequences to this approach, however. Uncompressed image dat
9797

9898
#### Byte Alignment
9999

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.
101101

102102
## Considerations
103103

@@ -107,7 +107,7 @@ Image tables are configured by image formats, which specify (among other things)
107107

108108
Image tables allocate 4 bytes per pixel, so the maximum space occupied by an image table file can be determined as follows:
109109

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`
111111

112112
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.
113113

@@ -146,7 +146,7 @@ The `FastImageCacheDemo` Xcode project requires Xcode 5.0 or greater and is conf
146146
- Clone this repository, or [download the latest archive of `master`](https://github.com/path/FastImageCache/archive/master.zip).
147147
- From the `FastImageCache` root directory, copy the source files from the inner [`FastImageCache`](./FastImageCache) subdirectory to your Xcode project.
148148
- 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`.
150150

151151
### Initial Configuration
152152

@@ -188,7 +188,7 @@ sharedImageCache.formats = imageFormats;
188188

189189
#### Creating Entities
190190

191-
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.
192192

193193
```objective-c
194194
@interface XXUser : NSObject <FICEntity>
@@ -200,7 +200,7 @@ Entities are objects that conform to the [`FICEntity`](https://s3.amazonaws.com/
200200
@end
201201
```
202202

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.
204204

205205
```objective-c
206206
- (NSString *)UUID {
@@ -236,11 +236,11 @@ Here is an example implementation of the [`FICEntity`](https://s3.amazonaws.com/
236236
}
237237
```
238238

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.
240240

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.
242242

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.
244244
245245
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.
246246

@@ -273,12 +273,12 @@ There are a few things to note here.
273273
274274
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.
275275
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:`.
277277
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.
278278
279279
> **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.
280280
>
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.
282282
283283
### Providing Source Images to the Image Cache
284284
@@ -343,9 +343,7 @@ For example, if a user changes their profile photo, it probably makes sense to p
343343

344344
## Documentation
345345

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.
349347

350348
## Demo Application
351349

0 commit comments

Comments
 (0)