Je travaille sur l'application d'édition d'image et suis coincé ici.comportement incohérent du chemin tracé sur le zoom dans Android
public void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
// int width=this.getDrawable().getIntrinsicWidth();
// int height=this.getDrawable().getIntrinsicHeight();
// float sw=((float)getBitmapRect().width())/width;
// float sh=((float)getBitmapRect().height())/height;
matrix = new Matrix();
// matrix.postScale(sw, sh);
canvas.setMatrix(getDisplayMatrix());
canvas.concat(matrix);
canvas.save();
if (MainActivity.checkBtnOn == MainActivity.BSS_ONE) {
for (Pair<Path, Float> p : foregroundPaths) {
mPaint.setStrokeWidth(p.second);
canvas.drawPath(p.first, mPaint);
}
} else if (MainActivity.checkBtnOn == MainActivity.BSS_TWO) {
for (Pair<Path, Float> p : foregroundPaths) {
mPaint.setStrokeWidth(p.second);
canvas.drawPath(p.first, mPaint);
}
} else {
for (Pair<Path, Float> p : foregroundPaths) {
mPaint.setStrokeWidth(p.second);
canvas.drawPath(p.first, mPaint);
}
}
// matrix.postScale(getScale(), getScale());
rect = canvas.getClipBounds();
displayRectF = new RectF(rect.left, rect.top, rect.right, rect.bottom);
// rect =drawable.getBounds();
canvas.restore();
}
Ma question est "Que, je fais mal qui me conduisent à un comportement incohérent de chemin tracé." signifie des changements de son emplacement sur le zoom (Pour le zoom j'utilise la bibliothèque sephiroth). J'ai attaché deux lien d'image. la première image est ajustée à l'écran et le second zoom.
S'il vous plaît aidez-moi ou toute suggestion sera appréciée. Merci
pas besoin de SetMatrix sur la toile. –