Hi All,
I am writing the code for mirror image in android using below code.
public class Reflection extends Activity {
private final String imageInSD = "R.drawable.honeycomb";
CheckBox enableMirror;
ImageView myImageView;
Bitmap bitmap;
int bmpWidth, bmpHeight;
Matrix matrixMirrorY;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
Log.d("swathi", "naveen");
enableMirror = (CheckBox) findViewById(R.id.enablemirror);
myImageView = (ImageView) findViewById(R.id.imageview);
enableMirror
.setOnCheckedChangeListener(new
CheckBox.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
drawMatrix();
}
});
bitmap = BitmapFactory.decodeFile(imageInSD);
bmpWidth = bitmap.getWidth();
bmpHeight = bitmap.getHeight();
initMirrorMatrix();
drawMatrix();
}
private void initMirrorMatrix() {
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1 };
matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
}
//
private void drawMatrix() {
if (enableMirror.isChecked()) {
Matrix matrix = new Matrix();
matrix.postConcat(matrixMirrorY);
Bitmap mirrorBitmap = Bitmap.createBitmap(bitmap, 0, 0,
bmpWidth,
bmpHeight, matrix, true);
myImageView.setImageBitmap(mirrorBitmap);
} else {
myImageView.setImageBitmap(bitmap);
}
}
}
please help me i am unable to trace the error where i am getting
Thanks
Naveen.
--
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en