MCPcopy Create free account
hub / github.com/melonjs/melonJS / preDraw

Method preDraw

packages/melonjs/src/renderable/imagelayer.js:241–260  ·  view source on GitHub ↗

* Override the default preDraw to skip the base class's anchor offset * translation and `autoTransform` application — `ImageLayer.draw()` * computes its own world-space position from the viewport, the parallax * `ratio`, anchor, and zoom, so applying anchor/transform here would * double-tran

(renderer)

Source from the content-addressed store, hash-verified

239 * @ignore
240 */
241 preDraw(renderer) {
242 // save the context
243 renderer.save();
244
245 // apply the defined alpha value
246 renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());
247
248 // delegate post-effect setup to the renderer (custom shader / postEffects)
249 if (!this._postEffectManaged) {
250 renderer.beginPostEffect(this);
251 }
252
253 // apply the defined tint
254 renderer.setTint(this.tint);
255
256 // apply blending if different from "normal"
257 if (this.blendMode !== renderer.getBlendMode()) {
258 renderer.setBlendMode(this.blendMode);
259 }
260 }
261
262 /**
263 * draw this ImageLayer (automatically called by melonJS)

Callers

nothing calls this directly

Calls 8

globalAlphaMethod · 0.80
getOpacityMethod · 0.80
setTintMethod · 0.80
getBlendModeMethod · 0.80
saveMethod · 0.45
setGlobalAlphaMethod · 0.45
beginPostEffectMethod · 0.45
setBlendModeMethod · 0.45

Tested by

no test coverage detected