Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding readme

  • Loading branch information...
commit cab3351b04c35e3f855210b414e5b8068adf28ef 1 parent c76dd50
@kgn authored
Showing with 38 additions and 0 deletions.
  1. +38 −0 readme.md
View
38 readme.md
@@ -0,0 +1,38 @@
+I've been developing this noise drawing code for quite some time. It all started with drawing noise in the title bar of [INAppStoreWindow](https://github.com/indragiek/INAppStoreWindow). The original implementation of the noise drawing for the titlebar used `CIFilter`, but this took up an unusual amount of memory and also didn't looks so great. So I began my quest for the best noise drawing solution, this project contains the third version which I feel is finally ready for prime time on the Mac and iOS!
+
+KGNoise generates random black and white pixels into a static 128x128 image that is then tiled to fill the space. The random pixels are seeded with a value that has been chosen to look the most random, this also means that the noise will look consistent between app launches.
+
+KGNoise is **retina** compatible on both iOS and the Mac. An identical interface is provided for both platforms through the use of compile time `#if` checks.
+
+# Usage
+Add `KGNoise.h` and `KGNoise.m` to your project, then import `KGNoise.h`:
+
+```
+#import "KGNoise.h"
+```
+
+# KGNoise
+
+`KGNoise` provides two generic noise drawing functions that you can use in your drawing code.
+
+```
++ (void)drawNoiseWithOpacity:(CGFloat)opacity;
++ (void)drawNoiseWithOpacity:(CGFloat)opacity andBlendMode:(CGBlendMode)blendMode;
+```
+
+# KGNoiseView
+
+There is also a subclass of `NSView` or `UIView`, depending on your platform, that you can use out of the box to draw noise on a solid color. The noise opacity, blending mode, and background color are all customizable.
+
+```
+@property (strong, nonatomic) NSColor/UIColor *backgroundColor;
+@property (nonatomic) CGFloat noiseOpacity;
+@property (nonatomic) CGBlendMode noiseBlendMode;
+```
+
+Please note that the standard `backgroundColor` is used for `UIView`, but `backgroundColor` does not exist on `NSView` so it has been added to provide the exact same interface for both platforms.
+
+# KGNoiseExample
+
+This project contains an example project that demonstrates how `KGNoiseView` could be used in a Mac or iOS app.
+
Please sign in to comment.
Something went wrong with that request. Please try again.