Exemplo n.º 1
0
        private static void ImageOrig(int width = 0, int height = 0)
        {
            _image = new Texture2D(2, 2);
            ToolbarControl.LoadImageFromFile(ref _image, _imagefile);

            //var _imagetex = UnityWebRequestTexture.GetTexture(_imagefile);
            //_image = ((DownloadHandlerTexture)_imagetex.downloadHandler).texture;
            //_imagetex.Dispose();

            if (width == 0)
            {
                width = Screen.width / 2;
            }
            if (height == 0)
            {
                height = Screen.height / 2;
            }

            if (_image.width > Screen.width / 2 || _image.height > Screen.height / 2)
            {
                float finalRatio = Mathf.Min((float)(Screen.width / 2) / (float)_image.width, (float)(Screen.height / 2) / (float)_image.height);

                float finalWidth  = (float)_image.width * finalRatio;
                float finalHeight = (float)_image.height * finalRatio;

                TextureScale.Bilinear(_image, (int)finalWidth, (int)finalHeight);
            }
            updateSize = true;
        }
Exemplo n.º 2
0
 private void ImageZp()
 {
     TextureScale.Bilinear(_image, _image.width + ((_image.width * 10) / 100), _image.height + ((_image.height * 10) / 100));
     updateSize = true;
 }