Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created June 13, 2013 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C4Code/5770607 to your computer and use it in GitHub Desktop.
Save C4Code/5770607 to your computer and use it in GitHub Desktop.
Image Scale add Points
//
// C4WorkSpace.m
// david
//
// Created by moi on 13-06-12.
// Copyright (c) 2013 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Image *img;
}
-(void)setup {
//work your magic here
img = [C4Image imageNamed:@"C4Sky"];
[self.canvas addImage:img];
img.center = self.canvas.center;
img.userInteractionEnabled = NO;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint p = [[touches anyObject] locationInView:self.canvas];
C4Shape *s = [C4Shape ellipse:CGRectMake(0, 0, 10, 10)];
s.center = p;
[self.canvas addShape:s];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint p = [[touches anyObject] locationInView:self.canvas];
img.width = p.x;
img.center = self.canvas.center;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment