lundi 24 mars 2014

Cwacs-camera photos are mirrored no matter what mirrorFFC is set to


Vote count:

0




I'm having a strange problem with CommonsWare's cwac-camera library. Images taken by the front camera are always mirrored (i.e. mirror of what I see in the preview) despite setting:


builder.mirrorFFC(true);


I have confirmed that this setting is applied correctly by logging in the ImageCleanupTask as follows:



if (applyMatrix) {
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
if (xact.host.getDeviceProfile().portraitFFCFlipped()
&& (xact.displayOrientation == 90 || xact.displayOrientation == 270)) {
matrix=flip(new Matrix());
}
else if (xact.mirrorFFC()) {
Log.d("myapp", "matrixFFC is true");
matrix=mirror(new Matrix());
}
}


The strangest thing is photos are always mirrored, whether I set mirrorFFC(true) or not. I haven't made any other changes to the Cwac library.


A quick and dirty hack solving the problem is to modify ImageCleanupTask as follows:



if (matrix != null) {
Bitmap original=
BitmapFactory.decodeByteArray(data, 0, data.length);

cleaned=
Bitmap.createBitmap(original, 0, 0, original.getWidth(),
original.getHeight(), matrix, true);
original.recycle();

//below my added code:
Matrix myMatrix = new Matrix();
myMatrix.preScale(-1.0f, 1.0f);
cleaned = Bitmap.createBitmap(cleaned, 0, 0, cleaned.getWidth(), cleaned.getHeight(), myMatrix, false);
}


Now the question is - is it simply my device (Samsung SGS i9000, running ICS) that causes problems or something else?



asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire