Unity--截取屏幕任意区域
原地址:http://blog.csdn.net/tanmengwen/article/details/8501612
void Update () {
if(Input.GetKeyDown(KeyCode.A))
{
StartCoroutine(getScreenTexture());
//unity 自带截屏,只能是截全屏
Application.CaptureScreenshot("shot.png");
}
}
public int capx=;
public int capy=;
public int capwidth=;
public int capheight=;
IEnumerator getScreenTexture()
{
yield return new WaitForEndOfFrame();
Texture2D t = new Texture2D(capwidth, capheight,TextureFormat.RGB24, true);//需要正确设置好图片保存格式
t.ReadPixels(new Rect(capx,capy,capwidth,capheight), , , false);//按照设定区域读取像素;注意是以左下角为原点读取
t.Apply();
//二进制转换
byte[] byt = t.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + Time.time + ".png", byt);
}
Unity--截取屏幕任意区域的更多相关文章
- cocos2d-x 截取屏幕可见区域
在游戏中,我们经常需要分享到社交网络的功能.分享时,我们时常会需要用到截屏的功能.目前网上的文章虽然很多,但是都是截取的 设计分辨率(DesignResolutionSize)大小的屏幕,而这个并不是 ...
- Android实例-程序界面内截取屏幕(XE8+小米2)
结果: 1.只能截取程序界面内的图片. 2.图片有点不清楚,自己设置清楚度. 实例代码: unit Unit1; interface uses System.SysUtils, System.Type ...
- Unity 截取图片并且显示出来
Unity 截取图片并且显示出来 近期用到了unity的截图,并且把他显示出来,摸索了很多! 讲解一个东西,android可以存储一些文件在本地,比如配置文件等! 对于不同的系统,方法不一! if ( ...
- jquery 截取屏幕
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...
- C# 截取屏幕图像
#region 截取屏幕图像 private static Bitmap GetScreenCapture() { Rectangle tScreenRect = , , Screen.Primary ...
- html2canvas截取屏幕的方法
html2canvas截取屏幕的方法 需要放在服务上运行,否则会报错, 放在服务器里,完美运行 处理截屏模糊的方法 html2canvas 0.5.0-beta3解决截图模糊问题 需要引入html2 ...
- C# 截取屏幕
/// <summary> /// 截取屏幕 /// </summary> /// <param name="x">起点X坐标</para ...
- ffmpeg+nginx截取屏幕实时画面并进行rtmp推流在前端播放
准备环境和文件 1.下载ffmpeg的包[https://foxbaby.lanzoui.com/iYjPmup51cd] 地址:https://ffmpeg.org/download.html#bu ...
- 【代码笔记】iOS-根据size截取屏幕中间矩形区域
代码: RootViewController.m #import "RootViewController.h" @interface RootViewController () @ ...
随机推荐
- 可以获取get post url 传递参数的统一方法
public static string objRequest(string requestName) { object obj = HttpContext.Current.Request[reque ...
- 一键清理Windows垃圾的BAT文件代码
@echo off color 0atitle win7一键清理系统垃圾echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★ ...
- 在Linux 5/6上使用UDEV SCSI规则配置ASM DISK
格式化磁盘(略) 识别磁盘(/sbin/scsi_id) Oracle Linux 5用如下脚本: #!/bin/sh for i in b c d e f g do echo "KERN ...
- 第一个MySQL 存储过程
昨天写了人生第一个mysql存储过程:遗憾的是,这个存储过程最后还是没用上,用php代码替代 话说mysql的存储过程真是反人类,不查reference,基本不能看懂那些语句:语言中能和它相比的,只有 ...
- hdu1007
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some ...
- 第一篇代码 嗨翻C语言 21点扑克
/* * 计算牌面点数的程序. * 使用“拉斯难加斯公开许可证”. * 学院21点扑克游戏小组. */#include <stdio.h>#include <stdlib.h& ...
- Android之Activity的几种跳转方式
1.显示调用方法 Intent intent=new Intent(this,OtherActivity.class); //方法1 Intent intent2=new Intent(); in ...
- linux php安装zookeeper扩展
linux php安装zookeeper扩展 tags:php zookeeper linux ext 前言: zookeeper提供很犀利的命名服务,并且集群操作具有原子性,所以在我的多个项目中被采 ...
- OC开发中运用到的枚举
一 常见枚举的定义: typedef enum { LOGIN_SUCCESS, USER_NAME, USER_PASSWORD, OLD_LAT, OLD_LNG }FIELD_SAVED; ...
- Redis 客户端配置及示例
一.redis自定义配置节点 <configSections> <section name ="RedisConfig" type="Amy.Toolk ...