UNPKG

@awayjs/scene

Version:
220 lines 13 kB
import { DisplayObject } from '../display/DisplayObject'; import { ColorTransform, Matrix, Rectangle, Point } from '@awayjs/core'; import { Stage, BitmapImage2D, Image2D } from '@awayjs/stage'; /** * */ export declare class SceneImage2D extends BitmapImage2D { static assetType: string; static getImage(width: number, height: number, transparent?: boolean, fillColor?: number, powerOfTwo?: boolean, stage?: Stage, msaa?: boolean): SceneImage2D; static tryStoreImage(image: Image2D, stage: Stage): void; private static getTemp; private static _renderer; private static _billboardRenderer; private static _view; private static _billboardView; private static _root; private static _rootNode; private static _billboardRoot; private static _billboard; protected _msaaNeedDrop: boolean; protected _enforceMSAASupport: boolean; protected _dropMSAA(): void; get canUseMSAAInternaly(): boolean; _antialiasQuality: number; get antialiasQuality(): number; /** * * @returns {string} */ get assetType(): string; /** * Creates a BitmapImage2D object with a specified width and height. If you * specify a value for the <code>fillColor</code> parameter, every pixel in * the bitmap is set to that color. * * <p>By default, the bitmap is created as transparent, unless you pass * the value <code>false</code> for the transparent parameter. After you * create an opaque bitmap, you cannot change it to a transparent bitmap. * Every pixel in an opaque bitmap uses only 24 bits of color channel * information. If you define the bitmap as transparent, every pixel uses 32 * bits of color channel information, including an alpha transparency * channel.</p> * * @param width The width of the bitmap image in pixels. * @param height The height of the bitmap image in pixels. * @param transparent Specifies whether the bitmap image supports per-pixel * transparency. The default value is <code>true</code> * (transparent). To create a fully transparent bitmap, * set the value of the <code>transparent</code> * parameter to <code>true</code> and the value of the * <code>fillColor</code> parameter to 0x00000000(or to * 0). Setting the <code>transparent</code> property to * <code>false</code> can result in minor improvements * in rendering performance. * @param fillColor A 32-bit ARGB color value that you use to fill the * bitmap image area. The default value is * 0xFFFFFFFF(solid white). */ constructor(width: number, height: number, transparent?: boolean, fillColor?: number, powerOfTwo?: boolean, stage?: Stage); private createRenderer; private createBillboardRenderer; /** * Frees memory that is used to store the BitmapImage2D object. * * <p>When the <code>dispose()</code> method is called on an image, the width * and height of the image are set to 0. All subsequent calls to methods or * properties of this BitmapImage2D instance fail, and an exception is thrown. * </p> * * <p><code>BitmapImage2D.dispose()</code> releases the memory occupied by the * actual bitmap data, immediately(a bitmap can consume up to 64 MB of * memory). After using <code>BitmapImage2D.dispose()</code>, the BitmapImage2D * object is no longer usable and an exception may be thrown if * you call functions on the BitmapImage2D object. However, * <code>BitmapImage2D.dispose()</code> does not garbage collect the BitmapImage2D * object(approximately 128 bytes); the memory occupied by the actual * BitmapImage2D object is released at the time the BitmapImage2D object is * collected by the garbage collector.</p> * */ dispose(): void; unload(): void; protected deepClone(from: BitmapImage2D): void; /** * Provides a fast routine to perform pixel manipulation between images with * no stretching, rotation, or color effects. This method copies a * rectangular area of a source image to a rectangular area of the same size * at the destination point of the destination BitmapImage2D object. * * <p>If you include the <code>alphaBitmap</code> and <code>alphaPoint</code> * parameters, you can use a secondary image as an alpha source for the * source image. If the source image has alpha data, both sets of alpha data * are used to composite pixels from the source image to the destination * image. The <code>alphaPoint</code> parameter is the point in the alpha * image that corresponds to the upper-left corner of the source rectangle. * Any pixels outside the intersection of the source image and alpha image * are not copied to the destination image.</p> * * <p>The <code>mergeAlpha</code> property controls whether or not the alpha * channel is used when a transparent image is copied onto another * transparent image. To copy pixels with the alpha channel data, set the * <code>mergeAlpha</code> property to <code>true</code>. By default, the * <code>mergeAlpha</code> property is <code>false</code>.</p> * * @param source The input bitmap image from which to copy pixels. * The source image can be a different BitmapImage2D * instance, or it can refer to the current * BitmapImage2D instance. * @param sourceRect A rectangle that defines the area of the source * image to use as input. * @param destPoint The destination point that represents the * upper-left corner of the rectangular area where * the new pixels are placed. * @param alphaBitmapData A secondary, alpha BitmapImage2D object source. * @param alphaPoint The point in the alpha BitmapImage2D object source * that corresponds to the upper-left corner of the * <code>sourceRect</code> parameter. * @param mergeAlpha To use the alpha channel, set the value to * <code>true</code>. To copy pixels with no alpha * channel, set the value to <code>false</code>. * @throws TypeError The sourceBitmapImage2D, sourceRect, destPoint are null. */ copyPixels(source: BitmapImage2D, sourceRect: Rectangle, destPoint: Point, alphaBitmapData?: BitmapImage2D, alphaPoint?: Point, mergeAlpha?: boolean): void; threshold(source: BitmapImage2D, sourceRect: Rectangle, destPoint: Point, operation: string, threshold: number, color: number, mask: number, copySource: boolean): void; applyFilter(source: BitmapImage2D, sourceRect: Rectangle, destPoint: Point, filter: any): boolean; colorTransform(rect: Rectangle, colorTransform: ColorTransform): void; setPixel(x: number, y: number, color: number): void; setPixel32(x: number, y: number, color: number): void; setPixels(rect: Rectangle, buffer: Uint8ClampedArray): void; private _clearFromDispose; clear(): void; /** * @inheritdoc */ getPixel32(x: number, y: number): number; /** * @inheritdoc */ getPixel(x: number, y: number): number; /** * Draws the <code>source</code> display object onto the bitmap image, using * the NME software renderer. You can specify <code>matrix</code>, * <code>colorTransform</code>, <code>blendMode</code>, and a destination * <code>clipRect</code> parameter to control how the rendering performs. * Optionally, you can specify whether the bitmap should be smoothed when * scaled(this works only if the source object is a BitmapImage2D object). * * <p>The source display object does not use any of its applied * transformations for this call. It is treated as it exists in the library * or file, with no matrix transform, no color transform, and no blend mode. * To draw a display object(such as a movie clip) by using its own transform * properties, you can copy its <code>transform</code> property object to the * <code>transform</code> property of the Bitmap object that uses the * BitmapImage2D object.</p> * * @param source The display object or BitmapImage2D object to draw to * the BitmapImage2D object.(The DisplayObject and * BitmapImage2D classes implement the IBitmapDrawable * interface.) * @param matrix A Matrix object used to scale, rotate, or translate * the coordinates of the bitmap. If you do not want to * apply a matrix transformation to the image, set this * parameter to an identity matrix, created with the * default <code>new Matrix()</code> constructor, or * pass a <code>null</code> value. * @param colorTransform A ColorTransform object that you use to adjust the * color values of the bitmap. If no object is * supplied, the bitmap image's colors are not * transformed. If you must pass this parameter but you * do not want to transform the image, set this * parameter to a ColorTransform object created with * the default <code>new ColorTransform()</code> * constructor. * @param blendMode A string value, from the flash.display.BlendMode * class, specifying the blend mode to be applied to * the resulting bitmap. * @param clipRect A Rectangle object that defines the area of the * source object to draw. If you do not supply this * value, no clipping occurs and the entire source * object is drawn. * @param smoothing A Boolean value that determines whether a BitmapImage2D * object is smoothed when scaled or rotated, due to a * scaling or rotation in the <code>matrix</code> * parameter. The <code>smoothing</code> parameter only * applies if the <code>source</code> parameter is a * BitmapImage2D object. With <code>smoothing</code> set * to <code>false</code>, the rotated or scaled * BitmapImage2D image can appear pixelated or jagged. For * example, the following two images use the same * BitmapImage2D object for the <code>source</code> * parameter, but the <code>smoothing</code> parameter * is set to <code>true</code> on the left and * <code>false</code> on the right: * * <p>Drawing a bitmap with <code>smoothing</code> set * to <code>true</code> takes longer than doing so with * <code>smoothing</code> set to * <code>false</code>.</p> * @throws ArgumentError The <code>source</code> parameter is not a * BitmapImage2D or DisplayObject object. * @throws ArgumentError The source is null or not a valid IBitmapDrawable * object. * @throws SecurityError The <code>source</code> object and(in the case of a * Sprite or MovieClip object) all of its child objects * do not come from the same domain as the caller, or * are not in a content that is accessible to the * caller by having called the * <code>Security.allowDomain()</code> method. This * restriction does not apply to AIR content in the * application security sandbox. */ draw(source: DisplayObject, matrix?: Matrix, colorTransform?: ColorTransform, blendMode?: string, clipRect?: Rectangle, smoothing?: boolean): any; draw(source: BitmapImage2D, matrix?: Matrix, colorTransform?: ColorTransform, blendMode?: string, clipRect?: Rectangle, smoothing?: boolean): any; private static _mapSupportedBlendMode; private _drawAsBitmap; private _drawAsDisplay; reset(): void; clone(): SceneImage2D; } //# sourceMappingURL=SceneImage2D.d.ts.map