[android-developers] Re: How to draw smooth gradients?
On 5 Mai, 16:44, blew <pascal.jac...@gmail.com> wrote:
> I think you can do this by drawing the gradients in a 8-8-8 bit color
> defined canvas
> this should apply the configuration to all elements in the canvas:
> Bitmap bitmap = Bitmap.createBitmap(width, height,
> Bitmap.Config.ARGB_8888);
> Canvas canvas = new Canvas(bitmap);
Hmm, how do I actually put the canvas contents on the screen then?
The only way I know of is drawing it on a view's canvas in the
onDraw() method:
@override
protected void onDraw(Canvas canvas) {
Bitmap bitmap888 = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas888 = new Canvas(bitmap);
drawSomething(canvas888); // actually draw gradient on canvas888
canvas.drawBitmap(bitmap888, 0, 0, null);
}
When I do it that way, the gradient is rendered as 5-6-5 again.
Any ideas?
Kind regards,
Felix
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home