UnityEngine.Graphics.DrawTexture C# (CSharp) Method

DrawTexture() private method

private DrawTexture ( InternalDrawTextureArguments &arguments ) : void
arguments InternalDrawTextureArguments
return void
        internal static extern void DrawTexture(ref InternalDrawTextureArguments arguments);
        [ExcludeFromDocs]

Same methods

Graphics::DrawTexture ( Rect screenRect, Texture texture ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Material mat ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Color color ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Color color, Material mat ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Color color, [ mat, [ pass ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, [ mat, [ pass ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, [ mat, [ pass ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat ) : void
Graphics::DrawTexture ( Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, [ mat, [ pass ) : void

Usage Example

コード例 #1
0
        private static void SaveResized(Texture2D tex, int width, int height, int x, int y)
        {
            var target     = new Texture2D(width, height, TextureFormat.RGBA32, false);
            var targetData = target.GetRawTextureData <Color32>();
            var clearColor = Color.clear;

            for (int l = 0; l < height; ++l)
            {
                for (int k = 0; k < x; ++k) //left border
                {
                    targetData[l * width + k] = clearColor;
                }
                for (int k = tex.width - x; k < width; ++k) //right border
                {
                    targetData[l * width + k] = clearColor;
                }
            }
            for (int k = x; k < width - x; ++k)
            {
                for (int l = 0; l < y; ++l) //bottom border
                {
                    targetData[l * width + k] = clearColor;
                }
                for (int l = tex.height - y; l < height; ++l) //top border
                {
                    targetData[l * width + k] = clearColor;
                }
            }
            var rt  = RenderTexture.GetTemporary(tex.width, tex.height);
            var rta = RenderTexture.active;

            RenderTexture.active = rt;
            GL.Clear(false, true, Color.clear);
            GL.LoadPixelMatrix(0, 1, 1, 0);
            UnityGraphics.DrawTexture(new Rect(0, 0, 1, 1), tex, MatCopy, 0);//point copy
            target.ReadPixels(new Rect(0, 0, tex.width, tex.height), x, y);
            RenderTexture.active = rta;
            RenderTexture.ReleaseTemporary(rt);
            string projectPath = Application.dataPath.Replace("/Assets", "/");
            string path        = AssetDatabase.GetAssetPath(tex);

            File.WriteAllBytes(projectPath + path, target.EncodeToPNG());
            AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
        }
All Usage Examples Of UnityEngine.Graphics::DrawTexture