API Reference > imodeljs-frontend > Rendering > DecorateContext DecorateContext Class Provides context for a Decorator to add Decorations to be rendered within a Viewport. Extends RenderContext Methods Name Description addCanvasDecoration(decoration: CanvasDecoration, atFront: boolean = false): void Add a CanvasDecoration to be drawn in this context's Viewport. addDecoration(type: GraphicType, decoration: RenderGraphic): void Adds a graphic to the set of Decorations to be drawn in this context's Viewport. addDecorationFromBuilder(builder: GraphicBuilder): void Calls GraphicBuilder.finish on the supplied builder to obtain a RenderGraphic, then adds the graphic to the appropriate list of addHtmlDecoration(decoration: HTMLElement): void Add an HTMLElement to be drawn as a decoration in this context's Viewport. createGraphicBuilder(type: GraphicType, transform?: Transform, id?: Id64String): GraphicBuilder Create a builder for creating a RenderGraphic of the specified type appropriate for rendering within this context's Viewport. setSkyBox(graphic: RenderGraphic): void Display skyBox graphic that encompasses entire scene and rotates with camera. setViewBackground(graphic: RenderGraphic): void Set the graphic to be displayed behind all other geometry as the background of this context's Viewport. Inherited methods Name Inherited from Description createBranch(branch: GraphicBranch, location: Transform): RenderGraphic RenderContext Create a RenderGraphic which groups a set of graphics into a node in a scene graph, applying to each a transform and optional clip volume and symbology overrides. createSceneGraphicBuilder(transform?: Transform): GraphicBuilder RenderContext Create a builder for creating a GraphicType.Scene RenderGraphic for rendering within this context's Viewport. getPixelSizeAtPoint(inPoint?: Primitives.Point3d): number RenderContext Given a point in world coordinates, determine approximately how many pixels it occupies on screen based on this context's frustum. Properties Name Type Description decorationDiv HTMLDivElement The HTMLDivElement which overlays the Viewport's HTMLCanvasElement, to which HTML decorations are added. screenViewport Accessor ReadOnly ScreenViewport The ScreenViewport in which this context's Decorations will be drawn. Inherited properties Name Type Inherited from Description frustum Frustum RenderContext Frustum extracted from the context's Viewport. frustumPlanes FrustumPlanes RenderContext Frustum planes extracted from the context's Viewport. viewFlags ViewFlags RenderContext ViewFlags extracted from the context's Viewport. viewport Viewport RenderContext The Viewport associated with this context. Defined in core/frontend/src/ViewContext.ts Line 107 Last Updated: 13 June, 2024