用Unity做简易的图像处理软件(二)

项目分享:https://github.com/Claymoreno1/RenderTexture

这一次添加了水平翻转、垂直翻转、顺时针旋转、逆时针旋转,关闭图像,保存,退出功能;对RT的创建和销毁做了一些更改。
界面如下:
演示
保存演示
保存
关于选择的C#部分

public void clockwise()
    {
   
        clockw = true;
        rotate();
    }
    public void anticlockwise()
    {
   
        anclockw = true;
        rotate();
    }

private void rotate()//旋转shader更新
    {
   
        if (Gamevars.textureisable)
        {
   
            rotatematerial.SetInt("_Clockwise", clockw ? 1 : 0);
            rotatematerial.SetInt("_AnuiClockwise", anclockw? 1:0);
            RenderTexture Disttexture =RenderTexture.GetTemporary(texture.height, texture.width, 0);//因为旋转之后宽高对调
            Graphics.Blit(texture, Disttexture, rotatematerial);
            int width = Disttexture.width;
            int height = Disttexture.height;
            Gamevars.imagewidth = width;
            Gamevars.imageheight = height;//更新控制结构体
            Viewtexture = new Texture2D(width, height, TextureFormat.ARGB32, false);
            RenderTexture
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值