/// <summary> /// Converts the given 32-bit unsigned integer from being /// a packed value to an XNA Color instance. /// </summary> /// <param name="color"> /// The 32-bit unsigned integer representing the packed value /// of a color. /// </param> /// <returns> /// An XNA Color instnace. /// </returns> public static Color UINTToColor(uint color) { byte r = DocColor.rgba_getr(color); byte g = DocColor.rgba_getg(color); byte b = DocColor.rgba_getb(color); byte a = DocColor.rgba_geta(color); // Aseprite doesn't premultily alpha return(Color.FromNonPremultiplied(r, g, b, a)); }
/// <summary> /// Converts the given R, G, B, and A color values into a /// 32-bit unsigned integer packed color value. /// </summary> /// <param name="r"> /// The Red component value of the color. /// </param> /// <param name="g"> /// The Green component value of the color. /// </param> /// <param name="b"> /// The Blue component value of the color. /// </param> /// <param name="a"> /// The Alpha component value of the color. /// </param> /// <returns> /// A 32-bit unsigned integer representation of the color. /// </returns> public static uint BytesToPacked(byte r, byte g, byte b, byte a) { return(DocColor.rgba(r, g, b, a)); }