Exemplo n.º 1
0
        public SWTexThread_SrcTex(SWTexture2DEx _tex, SWTexture2DEx _texSrc, SWBrush _brush) : base(_tex, _brush)
        {
            texColorBuffer = _tex.GetPixels();

            texSrc            = _texSrc;
            texSrcColorBuffer = _texSrc.GetPixels();
            texSrcWidth       = texSrc.width;
            texSrcHeight      = texSrc.height;
        }
Exemplo n.º 2
0
        public static void ProcessMask_DrawPoint(SWTexture2DEx tex, Vector2 _uv, SWBrush _brush)
        {
            colorStartBuffer = tex.GetPixels();
            brushBuffer      = new float[tex.width, tex.height];

            SWUndo.RegisterCompleteObjectUndo(tex);
            SWTexThread_TexDrawPoint t = new SWTexThread_TexDrawPoint(tex, _brush);

            t.Process(_uv);
        }
Exemplo n.º 3
0
//		public static SWTexture2DEx TextureCopy(SWTexture2DEx f)
//		{
//			SWTexture2DEx t = TextureCreate (f.width, f.height, f.format, f.alphaIsTransparency);
//			var colors = f.GetPixels ();
//			for(int i =0;i<colors.Length;i++) {
//				colors[i].a *= 0.6f;
//			}
//			t.SetPixels (colors);
//			t.Apply ();
//			return t;
//		}

        public static SWTexture2DEx TextureCreate(int w, int h, TextureFormat format)
        {
            SWTexture2DEx t = new SWTexture2DEx(w, h, format, false, false);

            t.filterMode = FilterMode.Trilinear;

            var colors = t.GetPixels();

            for (int i = 0; i < colors.Length; i++)
            {
                colors [i] = new Color(0, 0, 0, 0);
            }
            t.SetPixels(colors);
            t.Apply();
            return(t);
        }
Exemplo n.º 4
0
        public static SWTexture2DEx TextureResize(Texture2D tex, int newWidth, int newHeight)
        {
            SWTexture2DEx newTex       = SWCommon.TextureCreate(newWidth, newHeight, TextureFormat.ARGB32);
            var           colorsOrigin = tex.GetPixels();
            var           colors       = newTex.GetPixels();

            for (int i = 0; i < newWidth; i++)
            {
                for (int j = 0; j < newHeight; j++)
                {
                    Vector2 uv    = SWTextureProcess.TexUV(newWidth, newHeight, i, j);
                    int     index = TexUV2Index(newTex.width, newTex.height, uv);
                    colors[index] = SWTextureProcess.GetColor_UV(tex.width, tex.height, colorsOrigin, uv);
                }
            }
            newTex.SetPixels(colors);
            newTex.Apply();
            return(newTex);
        }