uptechteam / MotionViews-Android

Code Guide: How to create Snapchat-like image stickers and text stickers.
https://blog.uptech.team/how-to-create-snapchat-like-stickers-for-android-50512957c351
MIT License
479 stars 112 forks source link

how does the initial width and height of sticker set? #23

Closed flankechen closed 6 years ago

flankechen commented 7 years ago

Thanks for the great code. I am implementing some human face sticker use case and want to set the sticker width to the detected human face width. Defalut pikachu sticker has a original size 256256, but apperas larger in the screen. I test this in Nexus 6p with a screen size 14402560. Pikachu apperas to occupy 1/3 of the screen width. How this defalut width is set to 1/3 of the screen width? And how to set the entity's width according to screen pixel width? Thanks!

AndriyBas commented 6 years ago

@flankechen Entity scale is relative to its parent size. You can control the Entity size with the scale param (see Layer.java) class. Just set it to the one you need. scale == 1.0 means Entities biggest side will be the same as parent smallest side (meaning it will fit the parent).