Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Add an example to the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
SlaunchaMan committed Mar 22, 2013
1 parent 31eba89 commit 6ffa2b6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Expand Up @@ -7,6 +7,64 @@ The recommended way to get AmazeKit is to use [CocoaPods](http://www.cocoapods.o

**TODO**: Add instructions for bundling AmazeKit, using a static library, Xcode subproject, and as a Git submodule.

## Examples
The best way to see how AmazeKit works is to see it in action. Let’s look at a couple of common use cases and see what they produce:

### Rendering an Individual Image
The following code sets up an `AKImageCoordinator`. This class is responsible for rendering an image into a `UIImageView`, automatically rendering it at the appropriate size:

// Noise Effect
AKNoiseImageEffect *noiseEffect =
[[AKNoiseImageEffect alloc] initWithAlpha:0.05f
blendMode:kCGBlendModeMultiply
noiseType:AKNoiseTypeBlackAndWhite];

// Gradient Effect
UIColor *beginColor = [UIColor colorWithRed:144.0f / 255.0f
green:144.0f / 255.0f
blue:144.0f / 255.0f
alpha:1.0f];

UIColor *endColor = [UIColor colorWithRed:103.0f / 255.0f
green:103.0f / 255.0f
blue:103.0f / 255.0f
alpha:1.0f];

AKGradientImageEffect *gradientEffect =
[[AKGradientImageEffect alloc] initWithAlpha:1.0f
blendMode:kCGBlendModeMultiply
colors:@[beginColor, endColor]
direction:AKGradientDirectionVertical
locations:nil];

// Color Effect
AKColorImageEffect *colorEffect =
[[AKColorImageEffect alloc] initWithAlpha:1.0f
blendMode:kCGBlendModeColor
color:[UIColor blueColor]];


// Create the image renderer
AKImageRenderer *imageRenderer = [[AKImageRenderer alloc] init];

[imageRenderer setImageEffects:@[
noiseEffect,
gradientEffect,
colorEffect
]];

_imageCoordinator = [[AKImageCoordinator alloc] init];
[_imageCoordinator setImageRenderer:imageRenderer];

[_imageCoordinator addImageView:myImageView];

This produces the following image output (for an image view with a size of 250 x 100 on a Retina display):

![Example Image 1](readme_images/example_1.png)

### Rendering Button Images


## The `bin` Directory
In the `bin` directory are two scripts: `gen_docs.sh` and `publish_docs.sh`. These scripts are meant for me to run as a convenience to publish the appledoc docs. Use caution when running them.

Expand Down
Binary file added readme_images/example_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ffa2b6

Please sign in to comment.