如何创建一个允许用户自由手绘的应用程序? [英] how to create an application which allows user to free hand drawing?

查看:99
本文介绍了如何创建一个允许用户自由手绘的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iPad应用程序开发的新手。

i am new to iPad application development.

我有责任开发像 iDesk 应用程序我不知道如何从应用程序开始。

I have task to develop an application like iDesk application i don't know how to start with application.

此应用程序有1.徒手绘图2.形状识别&更多功能。但我不知道如何从这个应用程序开始。
请帮助我。

this application has 1. Freehand Drawing 2. Shape Recognition & much more functionality. but i don't know how to start with this app. please help me.

提供有关如何创建此应用程序的一些详细信息。我认为这个应用程序是从openGL创建的。如果可能,请提供一些样品。

provide some details about that how to create this app. i think this app is created from openGL. please provide me some samples if it is possible.

请帮助我。

我发布了一个新的问题本主题新问题对于这个主题

I have posted new question about this topic New Question for this topic

请帮助我。

推荐答案

使用以下我之前使用过的。它肯定会起作用: -

Use the following i have used it earlier. It will work definately:-

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    mouseSwiped = NO;
    UITouch *touch = [touches anyObject];

    if ([touch tapCount] == 2) {
        [drawImage setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"white" ofType:@"png"]]];
        return;
    }

    lastPoint = [touch locationInView:self.view];
    lastPoint.y -= 20;

}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    mouseSwiped = YES;

    UITouch *touch = [touches anyObject];   
    CGPoint currentPoint = [touch locationInView:self.drawImage];
    currentPoint.y -= 20;

    NSLog(@"current Point is x: %d, y: %d",currentPoint.x,currentPoint.y);

    UIGraphicsBeginImageContext(self.drawImage.frame.size);
    [drawImage.image drawInRect:CGRectMake(0, 0, self.drawImage.frame.size.width, self.drawImage.frame.size.height)];
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.5, 0.6, 1.0);
    CGContextBeginPath(UIGraphicsGetCurrentContext());
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
    CGContextStrokePath(UIGraphicsGetCurrentContext());
    drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    lastPoint = currentPoint;

}

这篇关于如何创建一个允许用户自由手绘的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆