Commit f70709ec authored by wjf's avatar wjf

l

parent 51a8cb4c
import {ObservablePoint, Point, Rectangle} from '../math';
import {sign, TextureCache} from '../utils';
import { ObservablePoint, Point, Rectangle } from '../math';
import { sign, TextureCache } from '../utils';
// import { BLEND_MODES } from '../const';
import Texture from '../texture/Texture';
import {Event} from '../events/Event';
import { Event } from '../events/Event';
import Container from './Container';
import {DisplayObject} from "./DisplayObject";
import { DisplayObject } from "./DisplayObject";
import CanvasRenderer from '../renderers/CanvasRenderer';
import {SCALE_MODES} from '../const';
import {WebglRenderer} from '../renderers/WebglRenderer';
import { SCALE_MODES } from '../const';
import { WebglRenderer } from '../renderers/WebglRenderer';
const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
/**
......@@ -22,6 +22,18 @@ export default class Sprite extends Container {
*
*/
private _anchorTexture: ObservablePoint;
/**
* 色值调色
*/
private _tint: number;
/**
* RGB形式色值,webgl用
*/
_tintRGB: number;
/**
* 和_tint比较用,用于canvas调色缓存
*/
_cachedTint: number;
/**
* 使用的贴图
* @member {Texture}
......@@ -86,6 +98,11 @@ export default class Sprite extends Container {
this._height = 0;
this._tint = null;
this._tintRGB = null;
this.tint = 0xFFFFFF;
this._cachedTint = 0xFFFFFF;
this.uvs = null;
// 下面texture set时用到
......@@ -121,6 +138,7 @@ export default class Sprite extends Container {
//保证顶点要更新
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 0xFFFFFF;
//可用才赋值uv
if (this._texture.valid) this.uvs = this._texture._uvs.uvsFloat32;
//设置过宽高的话,就需要改变缩放值,废弃先
......@@ -424,6 +442,7 @@ export default class Sprite extends Container {
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 0xFFFFFF;
if (value) {
if (value.baseTexture.hasLoaded) {
......@@ -434,6 +453,14 @@ export default class Sprite extends Container {
}
}
get tint() {
return this._tint;
}
set tint(value) {
if (value === this._tint) return;
this._tint = value;
this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);
}
//一些静态类方法
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment