Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the correct position so I can reconstruct the image. To drag and put at the right position I need to make the pieces rectangles but I am not getting the idea of how to make rectangles out of these irregular shapes. How can I make rectangles for manipulating these pieces?

This is a follow up to my previous question.

I need to make Rect of each small pattern which is drawn by line in below mention image

share|improve this question
add comment

2 Answers

Since you're using static patterns for breaking the image up, you can use static defined rectangles too. Simply pre-define the bounds for each rectangle by manually checking the placement for each. As shown in the image I gave you before, the rectangles should just be the minimum size required to enclose each shape.

share|improve this answer
    
@Bytes i used masking to break an image i didnt use rectangle as you comment in my last Question i used mask image as the shape of images(same pattern i have used) so i cant use the rectangle box, i need to make rect of this irregular shape . –  Anil gupta Jul 5 '12 at 15:39
add comment

I also recommend using predefined rectangles as byte56 recommended; but if you insist to dynamically create those rectangles, you can easily check what are the most left, most right, most up and most bottom pixel in your pattern. their coordinates will define edges of your rectangle.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.