UnityEditor.TextureUtil.IsAlphaOnlyTextureFormat C# (CSharp) Method

IsAlphaOnlyTextureFormat() private method

private IsAlphaOnlyTextureFormat ( TextureFormat format ) : bool
format TextureFormat
return bool
        public static extern bool IsAlphaOnlyTextureFormat(TextureFormat format);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

 public void OnPreviewSettings(UnityEngine.Object[] targets)
 {
     if (ShaderUtil.hardwareSupportsRectRenderTexture)
     {
         GUI.enabled = true;
         this.InitPreview();
         bool flag  = true;
         bool flag2 = true;
         bool flag3 = false;
         int  a     = 8;
         foreach (Texture texture in targets)
         {
             a = Mathf.Max(a, TextureUtil.GetMipmapCount(texture));
             Cubemap cubemap = texture as Cubemap;
             if (cubemap != null)
             {
                 TextureFormat format = cubemap.format;
                 if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
                 {
                     flag2 = false;
                 }
                 if (TextureUtil.HasAlphaTextureFormat(format) && (TextureUtil.GetUsageMode(texture) == TextureUsageMode.Default))
                 {
                     flag3 = true;
                 }
             }
             else
             {
                 flag3 = true;
                 flag2 = false;
             }
         }
         if (flag2)
         {
             this.m_PreviewType = PreviewType.Alpha;
             flag = false;
         }
         else if (!flag3)
         {
             this.m_PreviewType = PreviewType.RGB;
             flag = false;
         }
         if (flag)
         {
             GUIContent[] contentArray = new GUIContent[] { Styles.RGBIcon, Styles.alphaIcon };
             int          previewType  = (int)this.m_PreviewType;
             if (GUILayout.Button(contentArray[previewType], Styles.preButton, new GUILayoutOption[0]))
             {
                 this.m_PreviewType = (PreviewType)(++previewType % contentArray.Length);
             }
         }
         GUI.enabled = a != 1;
         GUILayout.Box(Styles.smallZoom, Styles.preLabel, new GUILayoutOption[0]);
         GUI.changed = false;
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(64f) };
         this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(a - 1), 0f, Styles.preSlider, Styles.preSliderThumb, options));
         GUILayout.Box(Styles.largeZoom, Styles.preLabel, new GUILayoutOption[0]);
         GUI.enabled = true;
     }
 }
All Usage Examples Of UnityEditor.TextureUtil::IsAlphaOnlyTextureFormat