简体   繁体   English

访问VGImage数据

[英]Accessing VGImage Data

Using OpenVG 1.1 I am trying to dump a VGImage to a file to confirm things are working but I am unsure how to access the raw RGBA data of the VGImage. 使用OpenVG 1.1,我试图将VGImage转储到文件中以确认一切正常,但是我不确定如何访问VGImage的原始RGBA数据。 Using vgReadPixels to capture the data to a char array does somewhat work but before I spend much more time getting the formatting correct on this I'd like to know if there's a better way to capture the VGImage data as captured with vgGetPixels. 使用vgReadPixels将数据捕获到char数组确实有些奏效,但是在我花更多的时间使格式正确之前,我想知道是否有更好的方法来捕获用vgGetPixels捕获的VGImage数据。

This is being done on an i.MX53 in Linux using Freescale's BSP. 这是使用飞思卡尔的BSP在Linux上的i.MX53上完成的。

vgReadPixels lets you access data from the current drawing surface bypassing any VGImage. vgReadPixels允许您绕过任何VGImage从当前图形表面访问数据。 This function lets you dump the current image that would be presented into a color-image. 此功能使您可以将要呈现的当前图像转储为彩色图像。

If you want to dump the content of an VGImage object vgReadPixels is not the function you want to use. 如果要转储VGImage对象的内容,则vgReadPixels不是您要使用的函数。

Instead call vgGetImageSubData on the VGImage object. 而是在VGImage对象上调用vgGetImageSubData。 For best precision you should use the same format as used in the vgCreate command. 为了获得最佳精度,您应该使用与vgCreate命令中使用的格式相同的格式。 If you use a different format you will still get the content of the image, but it will be processed using a color-conversion process which might slightly degrade the image quality due to round-off effects that may happen during conversion. 如果使用其他格式,您仍将获得图像的内容,但是将使用颜色转换过程对其进行处理,由于转换过程中可能会产生舍入效应,因此颜色转换过程可能会稍微降低图像质量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM