Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
586e388c
authored
Oct 19, 2017
by
german callejas
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cropper fixed
parent
ec3773c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
41 deletions
android/Pictogram/supervisor/src/main/java/com/yottacode/pictogram/supervisor/gui/cropper/CropImageView.java
android/Pictogram/supervisor/src/main/java/com/yottacode/pictogram/supervisor/gui/cropper/CropImageView.java
View file @
586e388c
...
@@ -264,49 +264,22 @@ public class CropImageView extends android.support.v7.widget.AppCompatImageView
...
@@ -264,49 +264,22 @@ public class CropImageView extends android.support.v7.widget.AppCompatImageView
final
float
transX
=
matrixValues
[
Matrix
.
MTRANS_X
];
final
float
transX
=
matrixValues
[
Matrix
.
MTRANS_X
];
final
float
transY
=
matrixValues
[
Matrix
.
MTRANS_Y
];
final
float
transY
=
matrixValues
[
Matrix
.
MTRANS_Y
];
final
float
bitmapLeft
=
(
transX
<
0
)
?
Math
.
abs
(
transX
)
:
0
;
final
float
bitmapTop
=
(
transY
<
0
)
?
Math
.
abs
(
transY
)
:
0
;
final
Bitmap
originalBitmap
=
((
BitmapDrawable
)
drawable
).
getBitmap
();
final
Bitmap
originalBitmap
=
((
BitmapDrawable
)
drawable
).
getBitmap
();
/*Log.i("DETALLES","ScaleX: "+scaleX + "- ScaleY: "+scaleY);
Log.i("DETALLES","transX: "+transX + "- transY: "+transY);
Log.i("DETALLES","Edge Left: "+Edge.LEFT.getCoordinate() + "- Edge Top: "+Edge.TOP.getCoordinate());
Log.i("DETALLES","ancho original: "+originalBitmap.getWidth() + " Alto original: "+originalBitmap.getHeight());
final float cropWidth = Edge.getWidth();
final float cropHeight = Edge.getHeight();*/
/*Log.i("DETALLES","ancho original: "+originalBitmap.getWidth() + " Alto original: "+originalBitmap.getHeight());
Log.i("DETALLES","ancho: "+cropWidth + " Alto: "+cropHeight);*/
// Ensure that the left and top edges are not outside of the ImageView bounds.
/*final float bitmapLeft = (transX < 0) ? Math.abs(transX) : 0;
final float bitmapTop = (transY < 0) ? Math.abs(transY) : 0;*/
// Get the original bitmap object.
//final Bitmap originalBitmap = ((BitmapDrawable) drawable).getBitmap();
/*final float bitmapLeft = ((findViewById(R.id.ScrollView)).getWidth() - originalBitmap.getWidth())/2;
final float bitmapTop = ((findViewById(R.id.ScrollView)).getHeight() - originalBitmap.getHeight())/2;*/
/* Log.i("DETALLES","bitmapLeft: "+bitmapLeft + "- bitmapTop: "+bitmapTop);
// Calculate the top-left corner of the crop window relative to the ~original~ bitmap size.
final float cropX = (bitmapLeft + Edge.LEFT.getCoordinate());
final float cropY = (bitmapTop + Edge.TOP.getCoordinate());
Log.i("DETALLES","Edge Left: "+Edge.LEFT.getCoordinate() + "- Edge Top: "+Edge.TOP.getCoordinate());
Log.i("DETALLES","Posicion X: "+cropX + "- Posicion Y: "+cropY);*/
// Calculate the crop window size relative to the ~original~ bitmap size.
// Make sure the right and bottom edges are not outside the ImageView bounds (this is just to address rounding discrepancies).
/*final float cropWidth = Edge.getWidth();
final float cropHeight = Edge.getHeight();
Log.i("DETALLES","ancho original: "+originalBitmap.getWidth() + " Alto original: "+originalBitmap.getHeight());
Log.i("DETALLES","ancho: "+cropWidth + " Alto: "+cropHeight);*/
// Crop the subset from the original Bitmap.
return
Bitmap
.
createBitmap
(
originalBitmap
,
(
int
)
(
Edge
.
LEFT
.
getCoordinate
()
-
transX
),
(
int
)
(
Edge
.
TOP
.
getCoordinate
()
-
transY
),
(
int
)
Edge
.
getWidth
(),
(
int
)
Edge
.
getHeight
());
final
float
cropX
=
(
bitmapLeft
+
Edge
.
LEFT
.
getCoordinate
())
/
scaleX
;
final
float
cropY
=
(
bitmapTop
+
Edge
.
TOP
.
getCoordinate
())
/
scaleY
;
final
float
cropWidth
=
Math
.
min
(
Edge
.
getWidth
()
/
scaleX
,
originalBitmap
.
getWidth
()
-
cropX
);
final
float
cropHeight
=
Math
.
min
(
Edge
.
getHeight
()
/
scaleY
,
originalBitmap
.
getHeight
()
-
cropY
);
return
Bitmap
.
createBitmap
(
originalBitmap
,
(
int
)
cropX
,
(
int
)
cropY
,
(
int
)
cropWidth
,
(
int
)
cropHeight
);
}
}
// Private Methods /////////////////////////////////////////////////////////////////////////////
// Private Methods /////////////////////////////////////////////////////////////////////////////
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment