如何在 Android 中创建自定义画笔 [英] How to Create Custom brushes in Android

查看:89
本文介绍了如何在 Android 中创建自定义画笔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一些画笔,但我需要更多,我在 JS 中找到了一些画笔,但我无法在 android 代码中完美地转换它们,这是链接 http://perfectkills.com/exploring-canvas-drawing-techniques/ 可以将这些画笔从 JS 转换为 Andorid 代码,我尝试了不同的方法使这些画笔有效,但大多数仍然不合适,我也想要一些来自这个应用的画笔,https://play.google.com/store/apps/details?id=com.adsk.sketchbook&hl=en

I have created some brushes but i need more and i found some brushes in JS but i couldn't convert them perfectly in android code, This is the Link http://perfectionkills.com/exploring-canvas-drawing-techniques/ can some covert these brushes from JS to Andorid code, I have tried different approaches to make these brush works but most of them are still improper , i also want some of brushes from this app , https://play.google.com/store/apps/details?id=com.adsk.sketchbook&hl=en

我转换了切片"从链接中点击这个,它工作正常,但我无法与其他人这样做

i converted Sliced" strokes this one from the link and it works fine but im unable to do so with others

private void multistrokePen(float x, float y, Path path) {

        path.moveTo(this.startX, this.startY);
        path.lineTo(x, y);

        path.moveTo(this.startX- (this.paintStrokeWidth/2), this.startY - (this.paintStrokeWidth/2));
        path.lineTo(x - (this.paintStrokeWidth/2), y - (this.paintStrokeWidth/2));

        path.moveTo(this.startX- (this.paintStrokeWidth/4), this.startY - (this.paintStrokeWidth/4));
        path.lineTo(x- (this.paintStrokeWidth/4), y - (this.paintStrokeWidth/4));

        path.moveTo(startX+ (this.paintStrokeWidth/4), startY + (this.paintStrokeWidth/4));
        path.lineTo(x + (this.paintStrokeWidth/4), y + (this.paintStrokeWidth/4));


        path.moveTo(this.startX + (this.paintStrokeWidth/2), this.startY + 
         (this.paintStrokeWidth/2));
        path.lineTo(x + (this.paintStrokeWidth/2), y + (this.paintStrokeWidth/2));

        startX =x;
        startY =y;


    }

推荐答案

我转换了其中的一些.见此处.参见lines_pattern"了解您应该如何以结构化的方式使用它们.

I converted some of those. See here. See "lines_pattern" to understand how you should use those in structured way.

这篇关于如何在 Android 中创建自定义画笔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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