Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dblapps/DAScratchPad
https://github.com/dblapps/DAScratchPad
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/dblapps/DAScratchPad
- Owner: dblapps
- License: mit
- Created: 2013-05-31T20:43:04.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-21T20:01:34.000Z (over 10 years ago)
- Last Synced: 2024-03-14T18:36:01.859Z (9 months ago)
- Language: Objective-C
- Size: 332 KB
- Stars: 110
- Watchers: 8
- Forks: 24
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DAScratchPad
=======================#### Author
David B. Levi (https://github.com/dblapps)
#### Overview
DAScratchPad is a small UIView subclass that provides a simple drawing interface. It provides both a painting and airbrushing capability. You can put this view anywhere in your UI, and your user can draw in it. You can add UI controls to change drawing color, line width, opacity, select painting or airbrushing, and set airbrush flow. You can also get the current image from the scratch pad, clear the current image, or replace the current image.
An example xcode project is included that demonstrates simple usage.
DAScratchPad is compatible with iOS4.3+.
#### License
DAScratchPad is available under the MIT license. See the LICENSE file for more info.
#### How To Use
Copy the contents of the DAScratchPad directory to your xcode project.
Import DAScratchPad.h in appropriate places.
Add the QuartzCore frameworks to your project.
Add instance of DAScratchPad in interface builder, or add them programatically:
DAScratchPad* scratchpad = [[DAScratchPad alloc] initWithFrame:CGRectMake(30.0f, 30.0f, 150.0f, 150.0f)];
[self.view addSubview:scratchpad];Change properties to control color, line width, and opacity:
scratchpad.drawColor = [UIColor greenColor];
scratchpad.drawWidth = 15.0f;
scratchpad.drawOpacity = 0.5f; // range is 0.0f through 1.0fSelect painting or airbrushing, and set airbrush rate and flow:
scratchpad.toolType = DAScratchPadToolTypePaint;
scratchpad.toolType = DAScratchPadToolTypeAirBrush;
scratchpad.airBrushFlow = 0.7f; // range is 0.0f through 1.0fUse 'getSketch' to retrieve the current image:
UIImage* sketch = [scratchpad getSketch];
Use 'setSketch:' to replace the current image:
UIImage* image = [UIImage imageNamed:@"SavedImage.jpg"];
[scratchpad setSketch:image];Use 'clearToColor:' to clear the current image:
[scratchpad clearToColor:[UIColor whiteColor]];