Jiechao Wang
Jiechao Wang

Reputation: 932

What's the Android equivalent of the following Java painting code?

I am focusing on the porting of a Java project to an Android project and recently encounter the following piece of code:

//data is an integer array of pixel colour information
//cm is an instance of IndexColorModel class
//bi is an instance of BufferedImage class
//x, y, cx, cy, offset, w, minX, minY are just known integers 
//surface is an instance of a class extending Canvas class

for (int i = 0; i < data.length; i++) 
    data[i] = cm.getRGB(data[i]); 
bi.setRGB(x, y, cx, cy, data, offset, w); 
surface.repaint(minX, minY, maxX - minX + 1, maxY - minY + 1); 

Could anyone provide the Android equivalent of the above Java painting code? Code, comments, hints are all welcome.

Another question is, how could we know whether a component (for example, a Canvas object) is lightweight or heavyweight component?

Really appreciated!

Upvotes: 0

Views: 261

Answers (1)

Romain Guy
Romain Guy

Reputation: 98501

Android does not have the notion of lightweight and heavyweight components. The distinction exists only with AWT/Swing.

Upvotes: 1

Related Questions