StickerView icon indicating copy to clipboard operation
StickerView copied to clipboard

Unable to draw the sticker in a specific position

Open Ram8948 opened this issue 8 years ago • 1 comments

I have saved bitmap and StickerPropertyModel and now i am trying to draw the sticker in a specific position

Ram8948 avatar Feb 14 '17 11:02 Ram8948

Hey Ram8948, You can set Sticker at a specific position using the below method.

public void setBitmap(Bitmap bitmap, float x, float y) {
       matrix.reset();
       mBitmap = bitmap;
       setDiagonalLength();
       initBitmaps();
       int w = mBitmap.getWidth();
       int h = mBitmap.getHeight();
       oringinWidth = w;
       float initScale = (MIN_SCALE + MAX_SCALE) / 2;
       matrix.postScale(initScale, initScale, w / 2, h / 2);
       positionX = x;
       positionY = y;
       matrix.postTranslate(x - w / 2, y - h / 2);
       invalidate();
   }

Add this method to StickerView class. Now you can set your bitmap with the specified position.

AkashOpenxcell avatar Mar 07 '19 09:03 AkashOpenxcell