canvas教程

Canvas QML Type(2)

字号+ 作者:H5之家 来源:H5之家 2017-04-22 15:01 我要评论( )

This hint is supplied along with to the graphics context to determine the method of rendering. A renderStrategy, or a combination may not be supported by a graphics context, in which case the context

This hint is supplied along with to the graphics context to determine the method of rendering. A renderStrategy, 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.

The default value is Canvas.Immediate.

See also .


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 to the graphics context to determine the method of rendering. A , 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.


    Signal Documentation

    imageLoaded()

    This signal is emitted when an image has been loaded.

    The corresponding handler is onImageLoaded.

    See also .


    paint(rect region)

    This signal is emitted when the region needs to be rendered. If a context is active it can be referenced from the context property.

    This signal can be triggered by markdirty(), or by changing the current canvas window.

    The corresponding handler is onPaint.


    painted()

    This signal is emitted after all context painting commands are executed and the Canvas has been rendered.

    The corresponding handler is onPainted.


    Method Documentation

    cancelRequestAnimationFrame(long handle)

    This function will cancel the animation callback referenced by handle.


    (string contextId, ... args)

    Returns a drawing context, or null if no context is available.

    The contextId parameter names the required context. The Canvas item will return a context that implements the required drawing mode. After the first call to getContext, any subsequent call to getContext with the same contextId will return the same context object.

    If the context type is not supported or the canvas has previously been requested to provide a different and incompatible context type, null will be returned.

    Canvas only supports a 2d context.


    isImageError(url image)

    Returns true if the image failed to load.

    See also .


    isImageLoaded(url image)

    Returns true if the image is successfully loaded and ready to use.

    See also .


    isImageLoading(url image)

    Returns true if the image is currently loading.

    See also .


    loadImage(url image)

    Loads the given image asynchronously.

    When the image is ready, will be emitted. The loaded image can be unloaded by the method.

    Note: Only loaded images can be painted on the Canvas item.

    See also , , , , and .


    markDirty(rect area)

    Mark the given area as dirty, so that when this area is visible the canvas renderer will redraw it. This will trigger the paint signal.

    See also and .


    (callback)

    This function schedules callback to be invoked before composing the Qt Quick scene.


    requestPaint()

    Request the entire visible region be re-drawn.

    See also .


    (string filename)

    Save the current canvas content into an image file filename. The saved image format is automatically decided by the filename's suffix.

    Note: calling this method will force painting the whole canvas, not just the current canvas visible window.

    See also , , and .


    (string mimeType)

    Returns a data URL for the image in the canvas.

    The default mimeType is "image/png".

    See also .


    unloadImage(url image)

    Unloads the image.

    Once an image is unloaded it cannot be painted by the canvas context unless it is loaded again.

    See also , , , , and .


    2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

     

    1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

    相关文章
    • HTML5 canvas随机画线和小方块基础反弹运动实例

      HTML5 canvas随机画线和小方块基础反弹运动实例

      2017-04-21 16:07

    • JavaScript Canvas绘制圆形时钟效果

      JavaScript Canvas绘制圆形时钟效果

      2017-04-21 09:04

    • 从底层谈WebGIS 原理设计与实现(六):WebGIS中地图瓦片在Canvas上的拼接显示原理

      从底层谈WebGIS 原理设计与实现(六):WebGIS中地图瓦片在Canvas上的

      2017-04-21 09:00

    • HTML5 canvas平铺的代码详解

      HTML5 canvas平铺的代码详解

      2017-04-21 08:02

    网友点评
    ;