public static AsTexture fromColor(int width, int height, uint color, bool optimizeForRenderTexture, float scale)
        {
            if (scale <= 0)
            {
                scale = AsStarling.getContentScaleFactor();
            }
            AsBitmapData bitmapData = new AsBitmapData(width * scale, height * scale, true, color);
            AsTexture    texture    = fromBitmapData(bitmapData, false, optimizeForRenderTexture, scale);

            if (!AsStarling.getHandleLostContext())
            {
                bitmapData.dispose();
            }
            return(texture);
        }
        public static AsTexture fromBitmapData(AsBitmapData data, bool generateMipMaps, bool optimizeForRenderTexture, float scale)
        {
            int          origWidth   = data.getWidth();
            int          origHeight  = data.getHeight();
            int          legalWidth  = AsGlobal.getNextPowerOfTwo(origWidth);
            int          legalHeight = AsGlobal.getNextPowerOfTwo(origHeight);
            AsContext3D  context     = AsStarling.getContext();
            AsBitmapData potData     = null;

            if (context == null)
            {
                throw new AsMissingContextError();
            }
            bc.flash.display3D.textures.AsTexture nativeTexture = context.createTexture(legalWidth, legalHeight, AsContext3DTextureFormat.BGRA, optimizeForRenderTexture);
            if (legalWidth > origWidth || legalHeight > origHeight)
            {
                potData = new AsBitmapData(legalWidth, legalHeight, true, 0);
                potData.copyPixels(data, data.getRect(), sOrigin);
                data = potData;
            }
            uploadBitmapData(nativeTexture, data, generateMipMaps);
            AsConcreteTexture concreteTexture = new AsConcreteTexture(nativeTexture, AsContext3DTextureFormat.BGRA, legalWidth, legalHeight, generateMipMaps, true, optimizeForRenderTexture, scale);

            if (AsStarling.getHandleLostContext())
            {
                concreteTexture.restoreOnLostContext(data);
            }
            else
            {
                if (potData != null)
                {
                    potData.dispose();
                }
            }
            if (origWidth == legalWidth && origHeight == legalHeight)
            {
                return(concreteTexture);
            }
            else
            {
                return(new AsSubTexture(concreteTexture, new AsRectangle(0, 0, origWidth / scale, origHeight / scale), true));
            }
        }
        public static AsTexture fromAtfData(AsByteArray data, float scale)
        {
            AsContext3D context = AsStarling.getContext();

            if (context == null)
            {
                throw new AsMissingContextError();
            }
            AsAtfData atfData = new AsAtfData(data);

            bc.flash.display3D.textures.AsTexture nativeTexture = context.createTexture(atfData.getWidth(), atfData.getHeight(), atfData.getFormat(), false);
            uploadAtfData(nativeTexture, data);
            AsConcreteTexture concreteTexture = new AsConcreteTexture(nativeTexture, atfData.getFormat(), atfData.getWidth(), atfData.getHeight(), atfData.getNumTextures() > 1, false, false, scale);

            if (AsStarling.getHandleLostContext())
            {
                concreteTexture.restoreOnLostContext(atfData);
            }
            return(concreteTexture);
        }