Skip to content

Commit

Permalink
Merge pull request #15 from N-Salahin/MOD-2184
Browse files Browse the repository at this point in the history
[MOD-2184], Android: Resoulves two issues in MOD-2184
  • Loading branch information
hansemannn authored Aug 20, 2016
2 parents f62467b + f9b6acb commit d8f295e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions android/src/ti/modules/titanium/paint/UIPaintView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d8f295e

Please sign in to comment.