//Display functions void display(float interval) { int i; const VGfloat *style; VGfloat clearColor[] = {1,1,1,1}; if (animate) { ang += interval * 360 * 0.1f; if (ang > 360) ang -= 360; } vgSetfv(VG_CLEAR_COLOR, 4, clearColor); vgClear(0,0,testWidth(),testHeight()); vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); vgLoadIdentity(); vgTranslate(testWidth()/2 + tx,testHeight()/2 + ty); vgScale(sx, sy); vgRotate(ang); for (i=0; i<pathCount; ++i) { style = styleArrays[i]; vgSetParameterfv(tigerStroke, VG_PAINT_COLOR, 4, &style[0]); vgSetParameterfv(tigerFill, VG_PAINT_COLOR, 4, &style[4]); vgSetf(VG_STROKE_LINE_WIDTH, style[8]); vgDrawPath(tigerPaths[i], (VGint)style[9]); // Bingo!!, Draw it!! } vgFlush(); }
int main(int, char **) { VGint i; i = 2; vgFlush(); return 0; }
int main(int, char **) { VGint i; i = 2; vgFlush(); vgDestroyContextSH(); return 0; }
static void draw(void) { vgClear(0, 0, window_width(), window_height()); vgDrawPath(path, VG_FILL_PATH); vgFlush(); }
static void draw(void) { vgClear(0, 0, window_width(), window_height()); vgLoadIdentity(); vgTranslate(50, 21); vgDrawPath(path, VG_FILL_PATH); vgFlush(); }
static void draw(void) { static const VGint red_pixel = 255 << 24 | 255 << 16 | 0 << 8 | 0; static const VGint blue_pixel = 255 << 24 | 0 << 16 | 0 << 8 | 255; VGint i; vgSetfv(VG_CLEAR_COLOR, 4, red_color); vgClear(0, 0, window_width(), window_height()); vgFlush(); memset(data, 0, window_width() * window_height() * sizeof(VGint)); vgReadPixels(data, window_width() * sizeof(VGint), VG_lARGB_8888, 0, 0, window_width(), window_height()); fprintf(stderr, "Red 0 = 0x%x and at 600 = 0x%x\n", data[0], data[600]); for (i = 0; i < window_width() * window_height(); ++i) { assert(data[i] == red_pixel); } vgSetfv(VG_CLEAR_COLOR, 4, blue_color); vgClear(50, 50, 50, 50); vgFlush(); memset(data, 0, window_width() * window_height() * sizeof(VGint)); vgReadPixels(data, 50 * sizeof(VGint), VG_lARGB_8888, 50, 50, 50, 50); fprintf(stderr, "Blue 0 = 0x%x and at 100 = 0x%x\n", data[0], data[100]); for (i = 0; i < 50 * 50; ++i) { assert(data[i] == blue_pixel); } }
void QVGEGLWindowSurfaceVGImage::endPaint (QWidget *widget, const QRegion& region, QImage *image) { Q_UNUSED(region); Q_UNUSED(image); QEglContext *context = ensureContext(widget); if (context) { if (backBufferSurface != EGL_NO_SURFACE) { if (isPaintingActive) vgFlush(); context->lazyDoneCurrent(); } isPaintingActive = false; } }
static void draw(void) { VGfloat point[2], tangent[2]; int i = 0; vgClear(0, 0, window_width(), window_height()); vgSetPaint(fill, VG_FILL_PATH); vgDrawPath(path, VG_FILL_PATH); draw_marks(path); vgFlush(); }
void QVGEGLWindowSurfaceDirect::endPaint (QWidget *widget, const QRegion& region, QImage *image) { Q_UNUSED(region); Q_UNUSED(image); QEglContext *context = ensureContext(widget); if (context) { if (needToSwap) { if (!isPaintingActive) context->makeCurrent(windowSurface); context->swapBuffers(windowSurface); context->lazyDoneCurrent(); } else if (isPaintingActive) { vgFlush(); context->lazyDoneCurrent(); } isPaintingActive = false; } }
// C function:: void vgFlush(void); JNIEXPORT jint JNICALL Java_com_example_startvg_VG11_vgFlush( JNIEnv* env, jobject obj ) { vgFlush(); }