找回密码
 立即注册

QQ登录

只需一步,快速开始

毕竟我是神经病

注册会员

21

主题

69

帖子

186

积分

注册会员

积分
186

活字格认证

毕竟我是神经病
注册会员   /  发表于:2017-2-9 10:27  /   查看:2901  /  回复:3
请问有没有可以选择图片某个区域位置居中的功能

3 个回复

倒序浏览
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-2-9 11:03:05
沙发
不是很清楚你说的具体的意思,是需要在imageviewer中对图片的位置进行调整么,区域位置居中是指?
回复 使用道具 举报
毕竟我是神经病
注册会员   /  发表于:2017-2-15 11:49:26
板凳
就是说选择图片一个区域,移动到图片的中心位置
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-2-15 14:48:49
地板
本帖最后由 Richard.Ma 于 2017-2-15 14:50 编辑
毕竟我是神经病 发表于 2017-2-15 11:49
就是说选择图片一个区域,移动到图片的中心位置

可以参考如下代码,需要居中的话对坐标进行计算即可

            //克隆图片
            RasterImage sourceimage= image.Clone();
            //合并图片
            CombineCommand command = new CombineCommand();
            command.SourceImage = sourceimage;
            // the rectangle that represents the affected area of the destination image.
            command.DestinationRectangle = new LeadRect(640, 360, 150,150);
            // The source point, which represents the source point of the source image which is to be combined.
            command.SourcePoint = new LeadPoint(640,360);
            // the operations that will be performed to produce the result, and the channel that will be used to achieve this result.
            command.Flags = CombineCommandFlags.OperationAdd | CombineCommandFlags.Destination0;// | CombineCommandFlags.SourceRed | CombineCommandFlags.DestinationGreen | CombineCommandFlags.ResultBlue;
            command.Run(image);

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部