ARGB32









How do I use A R G B32
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: ReorderableListResources.cs Copy
147         public static Texture2D CreatePixelTexture( string name, Color color )
148         {
149             var tex = new Texture2D( 1, 1, TextureFormat.ARGB32, false, true );
150             tex.name = name;
151             tex.hideFlags = HideFlags.HideAndDontSave;
152             tex.filterMode = FilterMode.Point;
153             tex.SetPixel( 0, 0, color );
154             tex.Apply();
155             return tex;
156         }
File name: ReorderableListResources.cs Copy
168         private static void LoadResourceAssets()
169         {
170             var skin = EditorGUIUtility.isProSkin ? s_DarkSkin : s_LightSkin;
171             s_Cached = new Texture2D[ skin.Length ];
172
173             for( int i = 0; i < s_Cached.Length; ++i )
174             {
175                 // Get image data (PNG) from base64 encoded strings.
176                 byte[] imageData = Convert.FromBase64String( skin[ i ] );
177
178                 // Gather image size from image data.
179                 int texWidth, texHeight;
180                 GetImageSize( imageData, out texWidth, out texHeight );
181
182                 // Generate texture asset.
183                 var tex = new Texture2D( texWidth, texHeight, TextureFormat.ARGB32, false, true );
184                 tex.hideFlags = HideFlags.HideAndDontSave;
185                 tex.name = "(Generated) ReorderableList:" + i;
186                 tex.filterMode = FilterMode.Point;
187                 tex.LoadImage( imageData );
188
189                 s_Cached[ i ] = tex;
190             }
191
192             s_LightSkin = null;
193             s_DarkSkin = null;
194         }

ARGB32 139 lượt xem

Gõ tìm kiếm nhanh...