From f9b6acbf0810fc8d5b069971fae7fa0d13c5e15a Mon Sep 17 00:00:00 2001 From: saeed1 Date: Thu, 24 Mar 2016 12:14:09 +0600 Subject: [PATCH] Changes UIPaintView.java for solving the issue in MOD-2184 --- .../modules/titanium/paint/UIPaintView.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/android/src/ti/modules/titanium/paint/UIPaintView.java b/android/src/ti/modules/titanium/paint/UIPaintView.java index eb097a2..b1d1df5 100644 --- a/android/src/ti/modules/titanium/paint/UIPaintView.java +++ b/android/src/ti/modules/titanium/paint/UIPaintView.java @@ -59,10 +59,11 @@ private void setPaintOptions() { public void setStrokeWidth(Float width) { Log.d(LCAT, "Changing stroke width."); tiPaintView.finalizePaths(); - tiPaint.setStrokeWidth(width); + tiPaint.setStrokeWidth(TiConvert.toFloat(width)); tiPaint.setAlpha(alphaState); } + public void setEraseMode(Boolean toggle) { eraseState = toggle; tiPaintView.finalizePaths(); @@ -126,15 +127,24 @@ public PaintView(Context c) { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); - if (tiImage != null) { - TiDrawableReference ref = TiDrawableReference.fromUrl(proxy, tiImage); - tiBitmap = Bitmap.createScaledBitmap(ref.getBitmap(), w, h, true); - } else { - tiBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + + if(tiBitmap == null){ + if (tiImage != null) { + TiDrawableReference ref = TiDrawableReference.fromUrl(proxy, tiImage); + tiBitmap = Bitmap.createScaledBitmap(ref.getBitmap(), w, h, true); + } else { + tiBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + } + tiCanvas = new Canvas(tiBitmap); + } + else { + tiBitmap = Bitmap.createScaledBitmap(tiBitmap, w, h, true); + tiCanvas = new Canvas(tiBitmap); } - tiCanvas = new Canvas(tiBitmap); + } + @Override protected void onDraw(Canvas canvas) { boolean containsBG = props.containsKeyAndNotNull(TiC.PROPERTY_BACKGROUND_COLOR);