Obsolete Members for Canvas

The following members of QML type Canvas 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

特性

特性文档编制

available : bool

Indicates when Canvas is able to provide a drawing context to operate on.


canvasSize : size

Holds the logical canvas size that the context paints on.

By default, the canvas size is the same size as the current canvas item size.

By setting the canvasSize, tileSize and canvasWindow, the Canvas item can act as a large virtual canvas with many separately rendered tile rectangles. Only those tiles within the current canvas window are painted by the Canvas render engine.

另请参阅 tileSize and canvasWindow .


context : object

Holds the active drawing context.

If the canvas is ready and there has been a successful call to getContext() contextType property has been set with a supported context type, this property will contain the current drawing context, otherwise null.


contextType : string

The type of drawing context to use.

This property is set to the name of the active context type.

If set explicitly the canvas will attempt to create a context of the named type after becoming available.

The type name is the same as used in the getContext() call, for the 2d canvas the value will be "2d".

另请参阅 getContext() and available .


renderStrategy : enumeration

Holds the current canvas rendering strategy.

  • Canvas.Immediate - context will perform graphics commands immediately in the main UI thread.
  • Canvas.Threaded - context will defer graphics commands to a private rendering thread.
  • Canvas.Cooperative - context will defer graphics commands to the applications global render thread.

This hint is supplied along with renderTarget to the graphics context to determine the method of rendering. A renderStrategy, renderTarget or a combination may not be supported by a graphics context, in which case the context will choose appropriate options and Canvas will signal the change to the properties.

Configuration or runtime tests may cause the QML Scene Graph to render in the GUI thread. Selecting Canvas.Cooperative , does not guarantee rendering will occur on a thread separate from the GUI thread.

默认值为 Canvas.Immediate .

另请参阅 renderTarget .


renderTarget : enumeration

Holds the current canvas render target.

  • Canvas.Image - render to an in memory image buffer.
  • Canvas.FramebufferObject - render to an OpenGL frame buffer

This hint is supplied along with renderStrategy to the graphics context to determine the method of rendering. A renderStrategy , renderTarget or a combination may not be supported by a graphics context, in which case the context will choose appropriate options and Canvas will signal the change to the properties.

The default render target is Canvas.Image .