找到你要的答案

Q:Fractal generator for android Bitmap / Canvas

Q:Android位图/画布的分形生成器

I want to create a Fractal generator for Android.

The only unclear thing I have in my list is: which class should I use, in order to display the result on the screen? I need to have something like a bitmap, to be able to get the current width / height and to be able to set some pixels (RGB), without having every pixel to be a different object.

I saw I can use the Bitmap class, but I am not sure if this is the right way.

As an extra, I also want to be able to set the generated screen to the background and save the result to a file.

Which class I should use for this?

我想为Android创建一个分形生成器。

我列表中唯一不清楚的事情是:我应该使用哪个类,以便在屏幕上显示结果?我需要像一个位图,可以得到当前的宽度/高度,可以设置一些像素(RGB),而不必每个像素是一个不同的对象。

我看到我可以使用位图类,但我不知道这是不是正确的方法。

作为一个额外的,我也希望能够设置生成的屏幕的背景和保存结果到文件。

我应该用哪个课?

answer1: 回答1:

You can use canvas.drawPoint():

To draw something, you need 4 basic components: A Bitmap to hold the pixels, a Canvas to host the draw calls (writing into the bitmap), a drawing primitive (e.g. Rect, Path, text, Bitmap), and a paint (to describe the colors and styles for the drawing).

For reference: http://developer.android.com/reference/android/graphics/Canvas.html#drawPoint(float,%20float,%20android.graphics.Paint)

你可以使用drawpoint()帆布:

画的东西,你需要4个基本组成部分:一个位图将像素,帆布主持绘制调用(写入位图),一个图元(如矩形、路径、文本、位图),和油漆(描述颜色和样式的图)。

参考资料:HTTP:/ /开发商。Android。COM /参考/ Android /图像/画布。HTML #钢针(浮动,20float %,% 20android。图形。漆)

android  android-canvas