예제 #1
0
    // Token: 0x060001BF RID: 447 RVA: 0x00010918 File Offset: 0x0000EB18
    public static Image blend(Image img0, float level, int rgb)
    {
        int   num   = rgb & 255;
        int   num2  = rgb >> 8 & 255;
        int   num3  = rgb >> 16 & 255;
        float num4  = (float)num / 256f;
        float num5  = (float)num2 / 256f;
        float num6  = (float)num3 / 256f;
        Color color = new Color(num6, num5, num4);

        Color[] pixels = img0.texture.GetPixels();
        float   num7   = color.r;
        float   num8   = color.g;
        float   num9   = color.b;

        for (int i = 0; i < pixels.Length; i++)
        {
            Color color2 = pixels[i];
            if (mGraphics.isNotTranColor(color2))
            {
                float num10 = (num7 - color2.r) * level + color2.r;
                float num11 = (num8 - color2.g) * level + color2.g;
                float num12 = (num9 - color2.b) * level + color2.b;
                if (num10 > 255f)
                {
                    num10 = 255f;
                }
                if (num10 < 0f)
                {
                    num10 = 0f;
                }
                if (num11 > 255f)
                {
                    num11 = 255f;
                }
                if (num11 < 0f)
                {
                    num11 = 0f;
                }
                if (num12 < 0f)
                {
                    num12 = 0f;
                }
                if (num12 > 255f)
                {
                    num12 = 255f;
                }
                pixels[i].r = num10;
                pixels[i].g = num11;
                pixels[i].b = num12;
            }
        }
        Image image = Image.createImage(img0.getRealImageWidth(), img0.getRealImageHeight());

        image.texture.SetPixels(pixels);
        Image.setTextureQuality(image.texture);
        image.texture.Apply();
        Cout.LogError2("BLEND ----------------------------------------------------");
        return(image);
    }