{"id":13849258,"url":"https://github.com/kgn/KGNoise","last_synced_at":"2025-07-12T16:31:24.898Z","repository":{"id":4632102,"uuid":"5776550","full_name":"kgn/KGNoise","owner":"kgn","description":"Cocoa noise drawing code plus a ready to go noise view!","archived":false,"fork":false,"pushed_at":"2013-12-08T19:51:44.000Z","size":1094,"stargazers_count":776,"open_issues_count":1,"forks_count":84,"subscribers_count":75,"default_branch":"master","last_synced_at":"2024-11-19T21:44:24.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kgn.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-12T07:39:00.000Z","updated_at":"2024-07-06T01:51:17.000Z","dependencies_parsed_at":"2022-09-09T11:10:15.127Z","dependency_job_id":null,"html_url":"https://github.com/kgn/KGNoise","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FKGNoise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FKGNoise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FKGNoise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FKGNoise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgn","download_url":"https://codeload.github.com/kgn/KGNoise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225829364,"owners_count":17530663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T19:01:12.335Z","updated_at":"2024-11-22T01:30:43.374Z","avatar_url":"https://github.com/kgn.png","language":"Objective-C","funding_links":[],"categories":["Objective-C","etc"],"sub_categories":[],"readme":"![](https://raw.github.com/kgn/KGNoise/master/screenshot.jpg)\n\nI'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 look 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! \n\nKGNoise 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.\n\nKGNoise 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.\n\n# Usage\n\nAdd `KGNoise.h` and `KGNoise.m` to your project, then import `KGNoise.h`:\n\n```obj-c\n#import \"KGNoise.h\"\n```\n\nKGNoise is distributed under the MIT license, see the license file for more information.\n\n# KGNoise\n\n`KGNoise` provides two generic noise drawing functions that you can use in your drawing code.\n\n```obj-c\n+ (void)drawNoiseWithOpacity:(CGFloat)opacity;\n+ (void)drawNoiseWithOpacity:(CGFloat)opacity andBlendMode:(CGBlendMode)blendMode;\n```\n\n# UIColor/NSColor(KGNoise)\n\n```obj-c\n- (NSColor/UIColor *)colorWithNoiseWithOpacity:(CGFloat)opacity;\n- (NSColor/UIColor *)colorWithNoiseWithOpacity:(CGFloat)opacity andBlendMode:(CGBlendMode)blendMode;\n```\n\n# UIImage/NSImage(KGNoise)\n\n```obj-c\n- (UIImage/NSImage *)imageWithNoiseOpacity:(CGFloat)opacity;\n- (UIImage/NSImage *)imageWithNoiseOpacity:(CGFloat)opacity andBlendMode:(CGBlendMode)blendMode;\n```\n\n# KGNoiseView\n\nThere 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.\n\n```obj-c\n@property (strong, nonatomic) NSColor/UIColor *backgroundColor;\n@property (nonatomic) CGFloat noiseOpacity;\n@property (nonatomic) CGBlendMode noiseBlendMode;\n```\n\nPlease 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.\n\n# KGNoiseLinearGradientView \u0026 KGNoiseRadialGradientView\n\n`KGNoiseLinearGradientView` and `KGNoiseRadialGradientView` inherit from `KGNoiseView` and draw a linear or radial gradient respectively. They provide a property to set the alternate background color to be used in the gradient.\n\n```obj-c\n@property (strong, nonatomic) NSColor/UIColor *alternateBackgroundColor;\n```\n\nIn addition, KGNoiseLinearGradientView provides a property to set gradient direction to 0, 90, 180, or 270 degrees.\n\n```obj-c\n@property (nonatomic) KGLinearGradientDirection gradientDirection;\n```\n\n# KGNoiseExample\n\nThis project contains an example project that demonstrates how `KGNoiseView` could be used in a Mac or iOS app.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgn%2FKGNoise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgn%2FKGNoise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgn%2FKGNoise/lists"}