// create image and load external data imgSrc = vgCreateImage(VG_A_1, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight, VG_IMAGE_QUALITY_NONANTIALIASED); vgImageSubData(imgSrc, (const void *)imgBarbaraAlphaData, imgBarbaraAlphaDataStride, imgBarbaraAlphaFormat, 0, 0, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight); #if defined(OPENVG_VERSION_1_1) for (j = VG_sRGBX_8888; j <= VG_A_4; ++j) { #else for (j = VG_sRGBX_8888; j <= VG_BW_1; ++j) { #endif imgDst = vgCreateImage(j, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight, VG_IMAGE_QUALITY_NONANTIALIASED); vgCopyImage(imgDst, 0, 0, imgSrc, 0, 0, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight, VG_TRUE); vgGetImageSubData(imgDst, imgOutputDataRGBA, imgBarbaraAlphaDataStride, imgBarbaraAlphaFormat, 0, 0, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight); strcpy(imgFileName, "imgconv_A1_to_"); strcat(imgFileName, imageFormatToString(j)); strcat(imgFileName, "_dither.png"); strcpy(testDesc, "Image conversion from A_1 format to "); strcat(testDesc, imageFormatToString(j)); strcat(testDesc, " format, with dithering."); // pixel format without alpha channel will be saved forcing alpha to 0xFF switch (j) { case VG_sRGBX_8888: case VG_sRGB_565: case VG_sL_8: case VG_lRGBX_8888: case VG_lL_8: case VG_BW_1: saveImage32(f, imgFileName, testDesc, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight, imgOutputDataRGBA, 1); break; default: saveImage32(f, imgFileName, testDesc, imgBarbaraAlphaWidth, imgBarbaraAlphaHeight, imgOutputDataRGBA, 0); } vgDestroyImage(imgDst); } vgDestroyImage(imgSrc);