public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length < 2 ||
                values[0] == DependencyProperty.UnsetValue ||
                values[1] == DependencyProperty.UnsetValue)
            {
                return(null);
            }

            OptFile optFile = values[1] as OptFile;

            if (optFile == null)
            {
                return(null);
            }

            Texture texture = optFile.Textures.ContainsKey((string)values[0]) ? optFile.Textures[(string)values[0]] : null;

            return(TextureUtils.BuildOptTexture(texture));
        }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length < 3 ||
                values[0] == DependencyProperty.UnsetValue ||
                values[1] == null)
            {
                return(null);
            }

            string pal         = (string)values[1];
            int    mipmapLevel = (int)(double)values[2];

            if (pal == "Default")
            {
                return(TextureUtils.BuildOptTexture(values[0] as Texture, TextureUtils.DefaultPalette, mipmapLevel - 1));
            }
            else
            {
                return(TextureUtils.BuildOptTexture(values[0] as Texture, int.Parse(pal), mipmapLevel - 1));
            }
        }
Example #3
0
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     return(TextureUtils.BuildOptTexture(value as Texture));
 }