Qt 4.6支持OpenVG

Recently we’ve been working on writing an OpenVG graphics system for Qt 4.6, and now it is all ready to go!

Qt 4.5 added support for pluggable graphics systems, which allow the window drawing surfaces and their associated paint engines to be redirected to a plugin for handling. There are graphics systems for OpenGL 1.x and 2.x, and now for OpenVG!

The new graphics system supports OpenVG 1.0 and 1.1, and uses the Khronos EGL API’s to access VG contexts and low-level window surfaces. It directly converts QPaintEngine requests into the equivalent OpenVG requests - the two API’s are very similar in functionality, so it was relatively easy to do this. It has been tested using X11/EGL and S60. There is also a demonstration plugin that uses ShivaVG, which shows how to use a non-EGL VG implementation.

What’s supported?

  • Single-context vs multi-context - the default configuration uses a single VG context and multiple window surfaces. This improves performance by sharing VG paths, images, and paint objects. But you can switch it to one VG context per window if your engine requires that behaviour.
  • All Qt transformations are supported, both affine and projective. However projective path transformations need to be done client-side, so they won’t perform as well as affine transformations. Images support both affine and projective path transformations server-side.
  • Pen and brush styles except conical gradients, which don’t have a VG equivalent. Opacity is supported for all drawing operations.
  • All the usual Qt primitives: lines, rectangles, points, polygons, ellipses, etc. For rectangles and other simple objects, path objects are reused to reduce the overhead of recreating them every time.
  • Clipping uses both masking and scissoring, or just scissoring if your engine doesn’t support masking. Scissoring will generally be preferred for simple rectangular clipping.
  • Text drawing is very dependent upon the features in your VG engine. For OpenVG 1.0 it uses the default vector path rendering in Qt, which may not give the best result. For OpenVG 1.1 systems that support VGfont objects, you have a choice of image-based or path-based glyph uploading. Image-based glyphs are the default.
  • Pixmaps are represented as VGImage objects (in single-context mode only) and so they can be drawn and transformed very quickly. The pixmap filters from Qt 4.5 (convolution, drop shadow, and colorize) are supported using VG functions.

What’s left to do?

  • Testing, testing, testing! Every VG engine has its subtle quirks so help us narrow them down.
  • Rendering into a QPixmap using VG - at present it drops back to the raster paint engine.
  • Text drawing with image glyphs under OpenVG 1.0.
  • Qt/Embedded support - some experimental screen drivers have been written internally but every vendor’s EGL is different, which makes Qt/Embedded difficult to support for both OpenVG and OpenGL/ES.

Where to get it?

You can get the engine from the public Qt repository. To build it, you’ll need to edit your mkspecs to specify the include directories and libraries to link against for EGL and OpenVG. And then configure Qt with the “-openvg” option. Once it has built, use “app -graphicssystem OpenVG” to run an app using the graphics system plugin (or “app -graphicssystem shivavg” for the ShivaVG version).

From:http://labs.trolltech.com/blogs/2009/06/24/openvg-support-in-qt-46/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值