Ejemplo n.º 1
0
    public void PrepareCopy(byte[] pixels)
    {
        Color32 paintColor = this.paintEngine.paintColor;

        this.paintEngine.paintColor = Color.black;
        ChopFillAlgorithm.FindAndFillId(this.paintEngine, pixels, short.MaxValue);
        this.paintEngine.paintColor = paintColor;
    }
Ejemplo n.º 2
0
    public void FillOnCopy(Point pColor, Color32 color, byte[] pixels)
    {
        int   num     = this.paintEngine.texWidth * pColor.i + pColor.j;
        short markTag = this.paintEngine.source[num];

        this.paintEngine.paintColor = color;
        ChopFillAlgorithm.FillCopy(pColor.j, pColor.i, this.paintEngine, pixels, markTag);
    }
Ejemplo n.º 3
0
    public void Create(Texture2D l, PaletteData p, bool writeData = true)
    {
        this.paletteData = p;
        this.lineTex     = l;
        Color[] pixels = this.lineTex.GetPixels();
        short[] array  = new short[pixels.Length];
        this.paintEngine           = new ChopMobilePaint();
        this.paintEngine.pixels    = new byte[this.lineTex.width * this.lineTex.height * 4];
        this.paintEngine.texHeight = this.lineTex.height;
        this.paintEngine.texWidth  = this.lineTex.width;
        this.paintEngine.source    = array;
        this.paintEngine.zones     = new List <List <int> >();
        this.drawText            = new Texture2D(this.lineTex.width, this.lineTex.height, TextureFormat.RGBA32, false);
        this.drawText.filterMode = FilterMode.Bilinear;
        this.drawText.wrapMode   = TextureWrapMode.Clamp;
        for (int i = 0; i < pixels.Length; i++)
        {
            if (pixels[i].a >= 0.99f)
            {
                array[i] = short.MaxValue;
            }
            else
            {
                array[i] = this.emptyPixelTag;
            }
        }
        this.paintEngine.paintColor = Color.black;
        ChopFillAlgorithm.FindAndFillId(this.paintEngine, this.paintEngine.pixels, short.MaxValue);
        if (writeData)
        {
            this.drawText.LoadRawTextureData(this.paintEngine.pixels);
            this.drawText.Apply();
        }
        PaletteData paletteData = p;
        short       num         = 0;

        for (int j = 0; j < paletteData.entities.Length; j++)
        {
            for (int k = 0; k < paletteData.entities[j].indexes.Length; k++)
            {
                Point      point = this.paintEngine.TextureArrayIndexToMatrix(paletteData.entities[j].indexes[k]);
                List <int> list  = ChopFillAlgorithm.MarkArea(point.j, point.i, this.paintEngine, this.emptyPixelTag, num);
                if (list != null && list.Count > 0)
                {
                    this.paintedMap.Add(false);
                    this.colorMap.Add(j);
                    this.paintEngine.zones.Add(list);
                    num += 1;
                }
                else
                {
                    UnityEngine.Debug.Log("Error marking area");
                }
            }
        }
    }
Ejemplo n.º 4
0
    public int FillPoint(Point pColor, Color32 color, bool writeData = true)
    {
        int   num  = this.paintEngine.texWidth * pColor.i + pColor.j;
        short num2 = this.paintEngine.source[num];

        this.paintEngine.paintColor = color;
        ChopFillAlgorithm.Fill(pColor.j, pColor.i, this.paintEngine, num2);
        if (writeData)
        {
            this.UpdateDrawTex();
        }
        this.paintedMap[(int)num2] = true;
        return((int)num2);
    }
Ejemplo n.º 5
0
 public void FillId(Color32 color, short id)
 {
     this.paintEngine.paintColor = color;
     ChopFillAlgorithm.Fill(0, 0, this.paintEngine, id);
 }