Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to draw the sticker in a specific position #19

Open
Ram8948 opened this issue Feb 14, 2017 · 1 comment
Open

Unable to draw the sticker in a specific position #19

Ram8948 opened this issue Feb 14, 2017 · 1 comment

Comments

@Ram8948
Copy link

Ram8948 commented Feb 14, 2017

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

@AkashOpenxcell
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants