繪製形狀我創建了我們公司的自動J2ME-> Android的轉換器。將J2ME圖形(javax.microedition.ldcui.Graphics)映射到Android圖形(android.graphics.Canvas)非常簡單。直接調用畫布方法
public void drawRGB(int[] rgbData, int offset, int scanLength, int x, int y, int width, int height, boolean processAlpha) {
canvas.drawBitmap(rgbData, offset, width, x + translateX, y + translateY, width, height, processAlpha, null);
}
fillTriangle - - 使用路徑
public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
Path path = new Path();
path.moveTo(x1 + translateX, y1 + translateY);
path.lineTo(x2 + translateX, y2 + translateY);
path.lineTo(x3 + translateX, y3 + translateY);
path.close();
strokePaint.setStyle(Paint.Style.FILL);
canvas.drawPath(path, strokePaint);
}
由Vector你的意思是
setStrokeStyle - 在您的油漆實例
PathEffect EFFECT_DOTTED_STROKE = new DashPathEffect(new float[] {2, 4}, 4);
if (style == SOLID) {
strokePaint.setPathEffect(null);
}
else {
strokePaint.setPathEffect(EFFECT_DOTTED_STROKE);
}
drawRGB變化路徑效應java.util.Vector中? Android API包含完全相同的類...