Cocos AIR graphics and DOM
Stop once you can answer the task. Do not read another same-topic reference for the same question.
Scope: Graphics replay, raster textures, Sprite masks, UI blends, meshes and DOM bindings.
Environment: use package imports in apps; source paths require an AIR checkout. See context.
Quick Start
For complete setup and teardown, read Quick Start.
Siblings: direct dependencies; reuse loaded skills.
Triggers
- Draw solid vector shapes or export SVG
- Rasterize gradients, patterns or evenodd holes
- Show a borrowed texture in UI
- Mask one Sprite or blend a subtree
- Keep a DOM element aligned with a UI node
- Warp a textured UI quad
- Paint experimental live HTML into a texture
Exact API and symptom mappings: triggers.
Contracts
Use native Graphics for solid nonzero fills and rasterization for rich fills. Texture/element bindings borrow sources and need explicit updates and disposal. Experimental HTML helpers use the main cocosair.js entry, with direct-child leases and RGBA8 single-mip textures.
Read references/contracts.md only when the task needs exact option rules, limits, error behavior or source annotations. Prefer the topic references below for a narrower question.
Common Mistakes
- [HIGH] Rich fills and evenodd holes require rasterization.
- [HIGH] Masks, blends and overlays require explicit cleanup.
- [MEDIUM] Check SVG pattern-export constraints.
Read relevant wrong/right examples before implementation.
Reference map
- Draw or export? - Commands and SVG
- Rich fills? - Canvas2D, 8192 cap
- Mask one Sprite? - Channels and ownership
- Blend a subtree? - Opt-in inheritance
- Show a texture? - Borrow, refresh, dispose
- Warp a quad? - Geometry bounds
- Align DOM? - Planar-ortho mapping
- Live HTML texture? - Experimental requirements