I am new to this Cocos2d. i am developing a Tetris type of game. I want to crop an image into small blocks. All i know about this thing is that in iPhone a method called CGImageCreateWithImageInRect is used. Is there any method of this kind is available in android cocos2d or not?
Asked
Active
Viewed 591 times
2
-
Why? You can just simply draw a section of a texture if you initialize a sprite with the texture and the rect. – CodeSmile Apr 04 '13 at 17:01
1 Answers
5
I have created bitmap of that image then crop that bitmap using these code.
Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.xyz);
resizedbitmap1=Bitmap.createBitmap(bmp, 0,0,yourwidth, yourheight);
then converted this bitmap to sprite and this way i solved my issue.

Lucas Eduardo
- 11,525
- 5
- 44
- 49

Rizwan
- 1,461
- 12
- 26