public virtual void addQuad(AsQuad quad, float parentAlpha, AsTexture texture, String smoothing, AsMatrix modelViewMatrix, String blendMode) { if (modelViewMatrix == null) { modelViewMatrix = quad.getTransformationMatrix(); } bool tinted = texture != null?quad.getTinted() || parentAlpha != 1.0f : false; float alpha = parentAlpha * quad.getAlpha(); int vertexID = mNumQuads * 4; if (mNumQuads + 1 > mVertexData.getNumVertices() / 4) { expand(); } if (mNumQuads == 0) { this.setBlendMode(blendMode != null ? blendMode : quad.getBlendMode()); mTexture = texture; mTinted = tinted; mSmoothing = smoothing; mVertexData.setPremultipliedAlpha(texture != null ? texture.getPremultipliedAlpha() : true, false); } quad.copyVertexDataTo(mVertexData, vertexID); mVertexData.transformVertex(vertexID, modelViewMatrix, 4); if (alpha != 1.0f) { mVertexData.scaleAlpha(vertexID, alpha, 4); } mSyncRequired = true; mNumQuads++; }
public AsImage(AsTexture texture) : base(texture.getFrame() != null ? texture.getFrame().width : texture.getWidth(), texture.getFrame() != null ? texture.getFrame().height : texture.getHeight(), 0xffffff, texture.getPremultipliedAlpha()) { bool pma = texture.getPremultipliedAlpha(); mVertexData.setTexCoords(0, 0.0f, 0.0f); mVertexData.setTexCoords(1, 1.0f, 0.0f); mVertexData.setTexCoords(2, 0.0f, 1.0f); mVertexData.setTexCoords(3, 1.0f, 1.0f); mTexture = texture; mSmoothing = AsTextureSmoothing.BILINEAR; mVertexDataCache = new AsVertexData(4, pma); mVertexDataCacheInvalid = true; }
public virtual void setTexture(AsTexture _value) { if (_value == null) { throw new AsArgumentError("Texture cannot be null"); } else { if (_value != mTexture) { mTexture = _value; mVertexData.setPremultipliedAlpha(mTexture.getPremultipliedAlpha()); onVertexDataChanged(); } } }