acerbetti / acedrawingview Goto Github PK
View Code? Open in Web Editor NEWAn open source iOS component to create a drawing app
License: Apache License 2.0
An open source iOS component to create a drawing app
License: Apache License 2.0
I have a project with ACEDrawingView, but it not run with iOS8. How do I?
Thanks.
Hello @acerbetti I would like to know if there is any option to draw text using the ACEDrawingView. All your other tools work amazing for me but I want to know how we can draw text in a rect. Can you please help me with this?
I want to make a pattern option... with image of stars or something else...
Now I want move the image in the drawing view ,is it possible to add a uiimageview as the subview of drawing view?
Now suddenly when I do pod update. it gets 1.3.5 and screwing up my project. all drawing are screwed. can you tell me what is going on ?
Its error on my side or ACEDrawingView Side
Update : I just confirmed that 1.3.5 is broken for Retina displays. I just plugged in 1.3.2 manually in project and everything started to working out of the box.
I am not sure if someone already created issue for retina vs non retina displays. if not please consider this as one.
What's the easiest way to get the bounds of a drawing (not the drawingView, but the bounds of the actual path)?
It would be nice if you could access the CGMutablePathRef
of the ACEDrawingPenTool
from the outside (e.g. to store it in a database).
I suggest overriding the CGPath
accessor defined by UIBezierPath
to do this. This should make things easy, because UIBezierPath
conforms to NSCoding
, so everything should work out-of-the-box.
I'll see if I find some time to format a PR to accomplish this.
I am trying to use you code to expand a simple app I'm working on. This code is really helpful!!!!
Questions: I'm saving the image to file and then reloading it. The problem I'm running into is setting the ACEDrawingView image with default content. It assumes an empty drawing surface. Is there something I'm missing? Did you allow for initial content?
I changed the code to allow (removed read-only setting on image in ACEDrawingView). I then set it in viewDidLoad of the controller class. This sort-of works. The image loads from file just fine. The problem is as soon as I draw on the image, it zooms out and moves the image down-and-to-the-right. This isn't ideal (obviously). Any ideas on how to make this more flexible (and still work)?
I want to draw a star by using this ACEDrawingView, any one help me?
Hiya there.
Thanks for the cool project.
I got a small problem with this. When I draw in Portrait mode and then switch to Landscape and continue drawing I get a broken image. This mostly happens when I draw at previously unreachable positions. There will be white fragments around the new lines I am drawing.
Did anybody experience this before and has an idea what to do bout this?
Thx in advance!
Hi,
How to set the background UIImageView to Aspect Fit ?
Best
how to call hideHandle()?
I had integrate this API in swift, issue comes with delegate call from:
Definition of delegate given in swift file, but call is not made.
Please help. Consider it as urgent!
Hi, thanks for sharing this code. It's a great little tool.
I wanted to use this code for a simple colouring-in tool for kids but I'm having issues with it on retina ipads. I'm loading a UIImage into ACEDrawingView with the loadImage:(UIImage *)image method but once I start drawing with the brush I noticed the original uiimage starts to get messed up. Looks like the drawRect is painting the wrong area of the original image on retina displays only. (You have to paint a few longs lines before you see it).
Am I just using the code wrong?
Sometimes when drawing erratically, the pen stops working. Other times when drawing for a prolonged period of time, the drawing disappears. Could someone please explain what's happening, and how to fix it? Thanks - Adam
Hello, I want to know how we can support variable width in this project.
Just quick question, would it be possible to take a photo with the device camera and draw onto it? Might be a nice feature to add :-)
Hi @stephengazzard & @acerbetti first of all thanks for the awesome library...Could u plz add the feature of resizing the ellipse and rectangle and move across the drawing view...
Thanks
Hi,
Is possible to add brush support for this? -.-
many thanks for this great sample project.
I want to ask if you can give me a tip. I want to save the drawn lines, shapes, etc.. I do not mean save as png or pdf. Rather, I want to save the contents of the "self.pathArray" and load this data later in the "drawingView". Later the drawing is to be further processed. If there still remain the UnDo steps, it would be perfect.
I try and try ... but do not get ahead.
it would be great if you could help me.
sincerely thomas.
In ACEDrawingView ( touchesEnded method) currentTool is set to nil currentTool and then it is sent in the delegate method
// clear the current tool
self.currentTool = nil;
// clear the redo queue
[self.bufferArray removeAllObjects];
// call the delegate
if ([self.delegate respondsToSelector:@selector(drawingView:didEndDrawUsingTool:)]) {
[self.delegate drawingView:self didEndDrawUsingTool:self.currentTool];
}
Optimization please (undo, redo)
draws a lot of Fig.-> undo or redo -> speed is very slow
Is it possible to load in a background image to draw over the top of?
This is a great control, but I want something in Swift. Can you recommend an equivalent? Alternatively, some detail of how to integrate in a large Swift project would be really appreciated.
Label(ACEDrawingLabelView) not available when save photo. As code no is available in drawTool to draw label over image. Use latest version of library installed with pods.
Hi
i tried the demo out on my iPad 3, and as i draw, the line being drawn falls way behind from where my finger is.
Im guessing this is because the drawing is redrawing every line and shape over and over, instead of just drawing the current draw item?
Oz
Hi,
I want to save drawing ,when I finish drawing. I can open it again.Please tell me how to do it .Look forward to your reply .Thanks!
Hi, can u suggest how i get previous drawing line points.and i want to update the colour for previous lines with selected color
My Swift project shows a build error that fails to recognise UIColor strangely. I fixed this by adding:
to ACEDrawingTools.h
Hi there
I've just discovered your component, but I'm having trouble using it. Following your instructions, I import the ACEDrawingView folder into my (completely new) project. If I try and compile now, the build fails. I'm pretty much at a loss; the demo project works just fine, and I can't see any configuration differences between the two.
Here's the compiler dump:
CompileC /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/Objects-normal/x86_64/ACEDrawingTools.o DrawingTest/ACEDrawingView/ACEDrawingTools.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/drdaz/Desktop/DrawingTest
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/drdaz/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 -iquote /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DrawingTest-generated-files.hmap -I/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DrawingTest-own-target-headers.hmap -I/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DrawingTest-all-target-headers.hmap -iquote /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DrawingTest-project-headers.hmap -I/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DerivedSources/x86_64 -I/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/DerivedSources -F/Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/Objects-normal/x86_64/ACEDrawingTools.d --serialize-diagnostics /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/Objects-normal/x86_64/ACEDrawingTools.dia -c /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m -o /Users/drdaz/Library/Developer/Xcode/DerivedData/DrawingTest-cwkxsajnlrcqvzglxvjlddpaxzzb/Build/Intermediates/DrawingTest.build/Debug-iphonesimulator/DrawingTest.build/Objects-normal/x86_64/ACEDrawingTools.o
In file included from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:26:
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:44:31: error: unknown type name 'UIColor'
@property (nonatomic, strong) UIColor *lineColor;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:44:1: error: property with 'retain (or strong)' attribute must be of object type
@property (nonatomic, strong) UIColor *lineColor;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:45:31: error: unknown type name 'CGFloat'
@property (nonatomic, assign) CGFloat lineAlpha;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:46:31: error: unknown type name 'CGFloat'
@property (nonatomic, assign) CGFloat lineWidth;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:48:26: error: expected a type
- (void)setInitialPoint:(CGPoint)firstPoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:49:24: error: expected a type
- (void)moveFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:49:52: error: expected a type
- (void)moveFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:57:32: error: cannot find interface declaration for 'UIBezierPath', superclass of 'ACEDrawingPenTool'
@interface ACEDrawingPenTool : UIBezierPath {
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:58:5: error: unknown type name 'CGMutablePathRef'; did you mean 'CFMutableDataRef'?
CGMutablePathRef path;
^~~~~~~~~~~~~~~~
CFMutableDataRef
In module 'Foundation' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:26:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h:14:66: note: 'CFMutableDataRef' declared here
typedef struct CF_BRIDGED_MUTABLE_TYPE(NSMutableData) __CFData * CFMutableDataRef;
^
In file included from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:26:
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:61:4: error: expected a type
- (CGRect)addPathPreviousPreviousPoint:(CGPoint)p2Point withPreviousPoint:(CGPoint)p1Point withCurrentPoint:(CGPoint)cpoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:61:41: error: expected a type
- (CGRect)addPathPreviousPreviousPoint:(CGPoint)p2Point withPreviousPoint:(CGPoint)p1Point withCurrentPoint:(CGPoint)cpoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:61:76: error: expected a type
- (CGRect)addPathPreviousPreviousPoint:(CGPoint)p2Point withPreviousPoint:(CGPoint)p1Point withCurrentPoint:(CGPoint)cpoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:61:110: error: expected a type
- (CGRect)addPathPreviousPreviousPoint:(CGPoint)p2Point withPreviousPoint:(CGPoint)p1Point withCurrentPoint:(CGPoint)cpoint;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:40:17: warning: auto property synthesis will not synthesize property 'lineWidth' declared in protocol 'ACEDrawingTool' [-Wobjc-protocol-property-synthesis]
@implementation ACEDrawingPenTool
^
In file included from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:26:
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:46:39: note: property declared here
@property (nonatomic, assign) CGFloat lineWidth;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:40:17: warning: auto property synthesis will not synthesize property 'hash' declared in protocol 'NSObject' [-Wobjc-protocol-property-synthesis]
@implementation ACEDrawingPenTool
^
In module 'Foundation' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:26:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In module 'os' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/dispatch/dispatch.h:48:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/os/object.h:75:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/objc/NSObject.h:18:33: note: property declared here
@property (readonly) NSUInteger hash;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:40:17: warning: auto property synthesis will not synthesize property 'superclass' declared in protocol 'NSObject' [-Wobjc-protocol-property-synthesis]
@implementation ACEDrawingPenTool
^
In module 'Foundation' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:26:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In module 'os' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/dispatch/dispatch.h:48:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/os/object.h:75:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/objc/NSObject.h:20:28: note: property declared here
@property (readonly) Class superclass;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:40:17: warning: auto property synthesis will not synthesize property 'description' declared in protocol 'NSObject' [-Wobjc-protocol-property-synthesis]
@implementation ACEDrawingPenTool
^
In module 'Foundation' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.h:26:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In module 'os' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/dispatch/dispatch.h:48:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/os/object.h:75:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/objc/NSObject.h:43:38: note: property declared here
@property (readonly, copy) NSString *description;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:47:13: error: 'ACEDrawingPenTool' cannot use 'super' because it is a root class
self = [super init];
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:49:14: error: property 'lineCapStyle' not found on object of type 'ACEDrawingPenTool *'
self.lineCapStyle = kCGLineCapRound;
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:50:14: warning: incompatible pointer types assigning to 'CFMutableDataRef' (aka 'struct __CFData *') from 'CGMutablePathRef' (aka 'struct CGPath *') [-Wincompatible-pointer-types]
path = CGPathCreateMutable();
^ ~~~~~~~~~~~~~~~~~~~~~
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:74:19: error: incompatible pointer types passing retainable parameter of type 'CFMutableDataRef' (aka 'struct __CFData *')to a CF function expecting 'CGMutablePathRef' (aka 'struct CGPath *') type
CGPathAddPath(path, NULL, subpath);
^~~~
In module 'CoreText' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:28:
In module 'CoreGraphics' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:296:47: note: passing argument to parameter 'path1' here
CG_EXTERN void CGPathAddPath(CGMutablePathRef path1,
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:82:28: error: implicit declaration of function 'UIGraphicsGetCurrentContext' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
CGContextRef context = UIGraphicsGetCurrentContext();
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:82:18: warning: incompatible integer to pointer conversion initializing 'CGContextRef' (aka 'struct CGContext *') with an expression of type 'int' [-Wint-conversion]
CGContextRef context = UIGraphicsGetCurrentContext();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:84:28: error: incompatible pointer types passing retainable parameter of type 'CFMutableDataRef' (aka 'struct __CFData *')to a CF function expecting 'CGPathRef' (aka 'const struct CGPath *') type
CGContextAddPath(context, path);
^~~~
In module 'CoreText' imported from /Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:28:
In module 'CoreGraphics' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h:28:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:311:65: note: passing argument to parameter 'path' here
CG_EXTERN void CGContextAddPath(CGContextRef context, CGPathRef path)
^
/Users/drdaz/Desktop/DrawingTest/DrawingTest/ACEDrawingView/ACEDrawingTools.m:87:61: error: member reference base type 'int *' is not a structure or union
CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor);
~~~~~~~~~~~~~~^~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.</code>
Your code works perfectly for me. But when i draw so much data at that time undo function take exponential time depends on the content draw on the drawing pad. How can i reduce that time while undoing? I don't know how much time undo function take when it is called because it is dependent on total content.
If the background color is anything but clear, the eraser tool draws like a normal pen tool
Hello there,
First of all, I'd like to thank you for developing and open sourcing this project. It has been immensely useful to us. There is one slight issue. After drawing lines and changing the orientation of the phone to landscape, the lines do rotate, but jump when a new line is added.
I've looked into it a bit but couldn't solve it. If anybody has any idea how I can solve this issue, please let me know.
I want to implement 3D-Touch and change the linewidth based on the pressure.
In the touchesMoved I use this code to change the lineWidth:
CGFloat maximumPossibleForce = touch.maximumPossibleForce;
CGFloat force = touch.force;
CGFloat normalizedForce = force/maximumPossibleForce;
CGFloat lineWidth = normalizedForce * 10;
self.currentTool.lineWidth = lineWidth;
It works, however, when crossing lines with a previously drawn line, it overrides it.
If anyone knows a solution I would greatly appreciate it! Thanks :)
- (UIImage *)applyDrawToImage:(UIImage *)baseImage;
is not present when integrating this library with cocoapods, maybe the library is not updated to the latest version?
is there any way we could disable a drawTool or any state that will disabled all drawTool options. thanks!
i would like erase lines or other paint tool. i know that if i select the background color i can imitate erase, but i put image background this solution is not valid.
how to use custom cursour instead of directly touches?
What would be the best approach to adding zooming functionality? Thanks!
Hi there (and happy holidays!)
I've noticed the TODO in ACEDrawingView, where you write that you need to implement partial redraw in the drawRect method. I'm in a situation where I am using this component to draw on top of full resolution (8MP) photos. The full redraw causes the component to lag and crash when the image is zoomed out fully (I've embedded the view in a UIScrollView). At least, I believe this is the cause of the crash - Apple's documentation suggests this is likely the case, but there is no stack trace or error to debug.
This is not a whine, but rather I'm interested in implementing the partial redraw logic. Unless I'm reading it wrong, you began the implementation since the pen tool requests a partial update, but the drawRect method ignores it.
I'm not that familiar with CoreGraphics, so if you have the time I'd like to hear how you thought to implement this functionality, rather than hacking at it from the ground up myself. From the time I've spent looking at the flow of the pen tool, my instinct tells me to get the draw method to return a UIImage and draw that image in the rect specified in the touches... call. I've made some modifications to that effect, but I'm not getting what I'm looking for.
So... yeah. If you've got a moment I'd love to have a dialogue about this. I'd be happy to contribute any usable code I create back to the project.
As title
I would like to create a app like snapchat so we can draw on a video
Thank You
How to add arrow CGImage at the end point of the line? What methods can modify ? Thank you.
I update to the last version and here is what I got:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'
*** First throw call stack:
(
0 CoreFoundation 0x00000001067c834b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a1e321e objc_exception_throw + 48
2 CoreFoundation 0x0000000106831265 +[NSException raise:format:] + 197
3 Foundation 0x0000000109cd6b3d -[NSBundle initWithURL:] + 87
4 Foundation 0x0000000109cd6ad3 +[NSBundle bundleWithURL:] + 45
5 ACEDrawingView 0x0000000105482f6f -[ACEDrawingView configure] + 703
6 ACEDrawingView 0x0000000105482c6a -[ACEDrawingView initWithCoder:] + 138
The ACEDrawingView is instantiated from a Storyboard.
Cocoapod: 1.0.1
Xcode: 8.0
how to stop all lines to overlapping . after changing line alpha.
ACEDrawingToolTypeCustom was added to the top of the ACEDrawingToolType enum essentially making it the default value for drawTool. This leads to a crash since customDrawTool has not been specified.
The fix is to either move ACEDrawingToolTypeCustom out of the zero position in the enum or to explicitly default drawTool to ACEDrawingToolTypePen in configure().
Hi.
Thanks for this amazing project. I have one question.
We have an image on our canvas. So, all paths should be added to it's context.
When we move our finger by screen - we see line (new paths added through draw cycles).
But there is only one place, where image grabs the context info:
function. It called only when touches end.
Why we can see line during drawing (instead blank screen and appearing this curve after finishing touch)?
Hello, firstly I want to thank you for this great project. Secondly, I want to mention that, the curves are not very smooth, you will notice it when you try to write very closely. Can you suggest how it can be tweaked, so that we get bamboo like smooth curves while writing.
I am attaching the images for reference , how it looks on bamboo and your app.
thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.