在ASP.NET中将图像拆分 [英] Spliting the image in pieces in ASP.NET

查看:86
本文介绍了在ASP.NET中将图像拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ASP.NET中将图像拆分为多个部分,并要求用户重新排列它们.
如果用户正确地重新布置了页面,则他可以访问该页面.

请帮助我吗?

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 ?

推荐答案



可以在javascript和ajax中做到这一点.每个图像都包裹在具有索引的div中.一旦用户通过移动Divs排列了图像,便可以读取索引序列并针对您已经确定的预定义序列进行验证.通过ajax验证它并授予用户访问权限.

要在后面的代码中拆分图像,请参阅此链接

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

拆分后,将其随机播放并显示在页面中.改组前的序列索引必须与这些片段的新索引相对应,而改组后的序列索引需要存储在字典中.这是验证用户的响应所必需的

例如,如果图像分成4个部分(1、2、3、4),则将随机播放.现在件的顺序将是(3,2,4,1). id = 1的Div将具有3的片段,而id 2的Div将具有2的片段,依此类推....

如果用户安排正确,则结果Div数组索引将为4,2,1,3

可以将其与混洗顺序进行比较,并针对原始顺序进行验证.在这里,Div id 4将按随机排列顺序显示第4个值,即1.接下来,它看起来第二个具有索引值2 ....,这样可以对其进行验证.
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.


我建​​议您将图像加载到Bitmap中,然后使用LockBits (请参阅: http://msdn.microsoft.com/fr-fr/library/5ey6h79d(v = vs.80).aspx [ ^ ])访问像素并将它们按需要存储在其他位图中.

要显示位图,只需调用DrawImageDrawImageUnscaled.
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.


这篇关于在ASP.NET中将图像拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆