예제 #1
0
        // private void Blur()
        // {
        //     var destTexture = RenderTexture.GetTemporary(_paintBuffer.descriptor);
        //     Graphics.Blit(_paintBuffer, destTexture, _blurMaterial, 0);
        //     Graphics.Blit(destTexture, _paintBuffer);
        //     RenderTexture.ReleaseTemporary(destTexture);
        // }

        public void LoadImage(string fileName)
        {
            Debug.Log($"LoadImage '{fileName}'");

            Layers.Clear();
            _imageFilename = fileName;
            var texture = PaintUtils.LoadImageTexture(_imageFilename);

            if (texture != null && (texture.width != defaultImageWidth || texture.height != defaultImageHeight))
            {
                Destroy(texture);
                texture = null;
            }

            if (texture != null)
            {
                // Set whole wetness buffer to dry:
                //_copyPaintBufferMaterial.SetFloat(PropId_Alpha, 0);
                //Graphics.Blit(texture, _paintBuffer, _copyPaintBufferMaterial);
                Layers.Create("Base", new Vector2Int(texture.width, texture.height));
                Graphics.Blit(texture, Layers.CurrentLayer.RenderTexture);
                Destroy(texture);
            }
            else
            {
                Layers.Create("Base", new Vector2Int(defaultImageWidth, defaultImageHeight));
                Clear();
            }

            _imageSize = Layers.CurrentLayer.Size;
        }
예제 #2
0
파일: BookView.cs 프로젝트: ahackel/Paint
        private void LoadThumbnails()
        {
            for (int i = 0; i < ImageBookConfig.Documents.Count; i++)
            {
                var document  = ImageBookConfig.Documents[i];
                var thumbnail = PaintUtils.LoadImageTexture(document.Name + ".thumb.png");
                if (thumbnail == null)
                {
                    thumbnail = document.Overlay;
                }

                _thumbnails[i].image = thumbnail;
            }
        }