Android的位图轮廓 [英] Android Bitmap contour

查看:394
本文介绍了Android的位图轮廓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提请我绘制的轮廓,
我试图用模糊,如本页面:
如何使周围的位图?
光晕效果 其效果是不是我想要的,
我想要一个实的轮廓,
不模糊。

有谁知道如何?

I'm trying to draw the contour of my drawable,
I tried to use Blur, as in this page:
How to make glow effect around a bitmap?
Its effect is not what I want,
I want a "solid" contour,
not blurred.

anyone knows how?

推荐答案

没有大纲式过滤器或屏蔽,我可以找到,而模糊和荫罩都不是很强。因此,你可以创建自己的效果通过使用彩色滤光片和规模。这个例子将创建一个红色的轮廓

There is no outline type filter or mask that I can find, while blur and shadow mask are not very strong. Hence you could create your own effect by using color filter and scale. This example would create a red contour

ColorFilter filter;
filter = new PorterDuffColorFilter(0xFFFF0000, PorterDuff.Mode.SRC_IN);         

paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColorFilter(filter);

canvas.save();
canvas.scale(1.1f, 1.1f,imageCenterX , imageCenterY);
canvas.drawBitmap(image, imageX, imageY, paint);
canvas.restore();

canvas.drawBitmap(image, imageX, imageY, null);

有足够快的游戏帧动画,我测试过了。

It is fast enough for a game frame animation, I've tested it.

这篇关于Android的位图轮廓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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