hi all,
I wrote following code.
class MyView extends View {
Bitmap bitmap;
public MyView(Context context) {
super(context);
Drawable drawable =
context.getResources().getDrawable(R.drawable.icon);
bitmap = Bitmap.createBitmap(100, 100, true);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, 100, 100);
drawable.draw(canvas);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setARGB(255, 255, 255, 255);
canvas.drawRect(0, 0, screenWidth, screenHeight, paint);
canvas.drawBitmap(bitmap, 10, 10, null);
int[] imagedata = new int[100 * 100];
bitmap.getPixels(imagedata, 0, 100, 0, 0, 100, 100);
bitmap.setPixels(imagedata, 0, 100, 0, 0, 100, 100);
invalidate();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
int screenWidth, screenHeight;
@Override
protected void onSizeChanged(int i, int j, int k, int l) {
screenWidth = i;
screenHeight = j;
super.onSizeChanged(i, j, k, l);
}
}
These code just retrieve the pixel data and then put them back. But
why i got different result on the screen. It seems like the retrieve
method change some pixel? Can anybody help me with this please?
Thanks.
BR
Gibson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---