Click here to Skip to main content
15,921,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to Split image into parts in ASP.NET and ask the user to rearrange them into order.
If the user rearranged it properly, Then he can access the page.

Please Help me ?
Posted
Updated 17-Feb-11 21:21pm
v2

Hi,

can do it in javascript and ajax. Each image pieces wrapped in a div which has an index. Once the user arranged the images i.e by moving the Divs, then can read the index sequence and validated against the predefined sequence you already determined. Validate it through ajax and give access to the user.

For splitting the image in code behind refer this link

http://www.gamedev.net/topic/482317-split-a-large-image-into-smaller-ones-solved/

once splitted shuffle it and display in page. The sequence index before shuffle has to be stored against the new index of these pieces after shuffling need to be stored in a dictionary. This is needed to validate the user's response

For example if the image splitted in to 4 pieces (1,2,3,4) then shuffle. Now the pieces order will be (3,2,4,1). Div with id=1 will have the piece 3 and Div with id 2 will have piece 2 and so on....

if the user arranged correct the resulted Div array index would be 4,2,1,3

This can be compared to the shuffle order and validated against the original order. Here Div id 4 will look 4th value in the shuffle order which 1, that is correct. Next it look 2nd which has the index value 2....in that way it can be validated.
 
Share this answer
 
v3
I suggest you load your image in a Bitmap, then use LockBits (see: http://msdn.microsoft.com/fr-fr/library/5ey6h79d(v=vs.80).aspx[^]) to access the pixels and store them as you want in others bitmaps.

To display the bitmaps just make a call to DrawImage or DrawImageUnscaled.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900