Пример #1
0
void createRadial()
{
  VGfloat stops[] = {
    0.0, 1.0, 0.0, 0.0, 1,
    0.5, 0.0, 1.0, 0.0, 1,
    1.0, 0.0, 0.0, 1.0, 1};
  
  VGint numstops = sizeof(stops) / sizeof(VGfloat);
  
  VGfloat radial[5];
  radial[0] = cx;
  radial[1] = cy;
  radial[2] = fx;
  radial[3] = fy;
  radial[4] = r;
  
  vgSetParameteri(radialFill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spread[sindex]);
  vgSetParameteri(radialFill, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
  vgSetParameterfv(radialFill, VG_PAINT_RADIAL_GRADIENT, 5, radial);
  vgSetParameterfv(radialFill, VG_PAINT_COLOR_RAMP_STOPS, numstops, stops);

  vgClearPath(center, VG_PATH_CAPABILITY_ALL);
  createCross(center, cx, cy);
  
  vgClearPath(focus, VG_PATH_CAPABILITY_ALL);
  vguEllipse(focus, fx, fy, 8,8);
  
  vgClearPath(radius, VG_PATH_CAPABILITY_ALL);
  vguEllipse(radius, cx, cy, r*2, r*2);
}
Пример #2
0
//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();
}
Пример #3
0
static void initialise_renderer(envelope_render_internal_t *renderer)
{
    renderer->state.display_update = 1;
    renderer->state.line_paint = vgCreatePaint();
    vgSetParameteri(renderer->state.line_paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
    vgSetParameterfv(renderer->state.line_paint, VG_PAINT_COLOR, 4, renderer->definition.line_colour);
    renderer->state.text_paint = vgCreatePaint();
    vgSetParameteri(renderer->state.text_paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
    vgSetParameterfv(renderer->state.text_paint, VG_PAINT_COLOR, 4, renderer->definition.text_colour);
    renderer->state.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_S_16, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_APPEND_TO);
}
Пример #4
0
	// C function:: void vgSetParameterfv(VGHandle object, VGint paramType, VGint
	// count, const VGfloat * values);
	JNIEXPORT jint JNICALL 
	Java_com_example_startvg_VG11_vgSetParameterfv(
	  JNIEnv* env, jobject obj, 
	  jlong object, jint paramType, jint count, jobject values){
		
		jarray _array = (jarray) 0;
		jint _remaining;
		char *data = (char*) 0;
		jint vgSetParameterfv_ret = FALSE;

		data = (char*)getPointer(env, values, &_array, &_remaining);
	  if (_remaining < 0){
			env->ThrowNew(AIOOBEClass, "In vgSetfv():: Empty Buffer -- _remaining < 0.");
		}

			vgSetParameterfv(
			(VGHandle) object, 
			(VGint) paramType, 
			(VGint) count, 
			(const VGfloat *) data
			);
		
		vgSetParameterfv_ret = SUCCESS;

	exit:
			if ( _array ){
				releasePointer(env, _array, data, JNI_FALSE);
			}
			return vgSetParameterfv_ret;



	}
Пример #5
0
static void initialise_renderer(setting_render_internal_t* renderer)
{
	renderer->state.display_update = 1;
	renderer->state.text_paint = vgCreatePaint();
	vgSetParameteri(renderer->state.text_paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
	vgSetParameterfv(renderer->state.text_paint, VG_PAINT_COLOR, 4, renderer->definition.text_colour);
}
Пример #6
0
// setstroke sets the stroke color
void setstroke(VGfloat color[4]) {
	VGPaint strokePaint = vgCreatePaint();
	vgSetParameteri(strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
	vgSetParameterfv(strokePaint, VG_PAINT_COLOR, 4, color);
	vgSetPaint(strokePaint, VG_STROKE_PATH);
	vgDestroyPaint(strokePaint);
}
Пример #7
0
// setfill sets the fill color
void setfill(VGfloat color[4]) {
	VGPaint fillPaint = vgCreatePaint();
	vgSetParameteri(fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
	vgSetParameterfv(fillPaint, VG_PAINT_COLOR, 4, color);
	vgSetPaint(fillPaint, VG_FILL_PATH);
	vgDestroyPaint(fillPaint);
}
Пример #8
0
struct TEXT_WIDGET_HANDLE text_widget_init ( float x_mm, float y_mm,
					     float width_mm,
					     float height_mm,
					     float dpmm_x,
					     float dpmm_y )
{
  struct TEXT_WIDGET_HANDLE handle;
  handle.d = malloc( sizeof( struct TEXT_WIDGET_PRIVATE ) );
  handle.d->x_mm = x_mm;
  handle.d->y_mm = y_mm;
  handle.d->dpmm_x = dpmm_x;
  handle.d->dpmm_y = dpmm_y;
  handle.d->font_map = pango_ft2_font_map_new();

  // Note: FreeType works in DPI.
  pango_ft2_font_map_set_resolution( (PangoFT2FontMap*)handle.d->font_map,
				     dpmm_x * 25.4, dpmm_y * 25.4 );

  handle.d->context  = pango_font_map_create_context( handle.d->font_map );
  handle.d->layout   = pango_layout_new( handle.d->context );

  // Pango works in Pango Units. Not exactly clear how the resolution of
  // the font and the size of the rendering box fit together.
  int width = pango_units_from_double( dpmm_x * width_mm );
  int height = pango_units_from_double( dpmm_y * height_mm );
  pango_layout_set_width( handle.d->layout, width );
  pango_layout_set_height( handle.d->layout, height );

  handle.d->foreground = vgCreatePaint();
  vgSetParameterfv( handle.d->foreground, VG_PAINT_COLOR, 4, DEFAULT_FOREGROUND );

  return handle;
}
Пример #9
0
static void draw_point(VGfloat x, VGfloat y)
{

   static const VGubyte cmds[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
                                  VG_LINE_TO_ABS, VG_CLOSE_PATH};
   const VGfloat coords[]   = {  x - 2,  y - 2,
                                 x + 2,  y - 2,
                                 x + 2,  y + 2,
                                 x - 2,  y + 2};
   VGPath path;
   VGPaint fill;

   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
                       VG_PATH_CAPABILITY_ALL);
   vgAppendPathData(path, 5, cmds, coords);

   fill = vgCreatePaint();
   vgSetParameterfv(fill, VG_PAINT_COLOR, 4, black_color);
   vgSetPaint(fill, VG_FILL_PATH);

   vgDrawPath(path, VG_FILL_PATH);

   vgDestroyPath(path);
   vgDestroyPaint(fill);
}
Пример #10
0
int main(int argc, char **argv)
{
  testInit(argc, argv, 400,400, "ShivaVG: Linear Gradient Test");
  testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display);
  testCallback(TEST_CALLBACK_BUTTON, (CallbackFunc)click);
  testCallback(TEST_CALLBACK_DRAG, (CallbackFunc)drag);
  testCallback(TEST_CALLBACK_KEY, (CallbackFunc)key);
  testCallback(TEST_CALLBACK_RESHAPE, (CallbackFunc)reshape);
  
  p = testCreatePath();
  org = testCreatePath();
  
  blackFill = vgCreatePaint();
  vgSetParameterfv(blackFill, VG_PAINT_COLOR, 4, black);
  
  backImage = createImageFromJpeg(IMAGE_DIR"test_img_violin.jpg");
  patternImage = createImageFromJpeg(IMAGE_DIR"test_img_shivavg.jpg");
  patternFill = vgCreatePaint();
  
  createSquare(p);
  createOrigin(org);
  createPattern();
  
  testOverlayString("Press H for a list of commands");
  testOverlayColor(1,1,1,1);
  testRun();
  
  return EXIT_SUCCESS;
}
Пример #11
0
int main(int argc, char **argv)
{
  testInit(argc, argv, 400,400, "ShivaVG: Radial Gradient Test");
  testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display);
  testCallback(TEST_CALLBACK_BUTTON, (CallbackFunc)click);
  testCallback(TEST_CALLBACK_DRAG, (CallbackFunc)drag);
  testCallback(TEST_CALLBACK_KEY, (CallbackFunc)key);
  
  p = testCreatePath();
  center = testCreatePath();
  focus = testCreatePath();
  radius = testCreatePath();
  
  cx = testWidth()/2;
  cy = testHeight()/2;
  fx = cx;
  fy = cy;
  r = sqx/2;
  
  radialFill = vgCreatePaint();
  blackFill = vgCreatePaint();
  vgSetParameterfv(blackFill, VG_PAINT_COLOR, 4, black);
  
  createSquare(p);
  createRadial();
  
  testOverlayString("Press H for a list of commands");
  testOverlayColor(1,1,1,1);
  testRun();
  
  return EXIT_SUCCESS;
}
Пример #12
0
// setstops sets color stops for gradients
void setstop(VGPaint paint, VGfloat * stops, int n) {
	VGboolean multmode = VG_FALSE;
	VGColorRampSpreadMode spreadmode = VG_COLOR_RAMP_SPREAD_REPEAT;
	vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spreadmode);
	vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, multmode);
	vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, 5 * n, stops);
	vgSetPaint(paint, VG_FILL_PATH);
}
Пример #13
0
// LinearGradient fills with a linear gradient
void FillLinearGradient(VGfloat x1, VGfloat y1, VGfloat x2, VGfloat y2, VGfloat * stops, int ns) {
	VGfloat lgcoord[4] = { x1, y1, x2, y2 };
	VGPaint paint = vgCreatePaint();
	vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
	vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, lgcoord);
	setstop(paint, stops, ns);
	vgDestroyPaint(paint);
}
Пример #14
0
void text_widget_set_foreground ( struct TEXT_WIDGET_HANDLE handle,
				  float color[4] )
{
  if ( handle.d == NULL )
    return;

  vgSetParameterfv( handle.d->foreground, VG_PAINT_COLOR, 4, color );
}
Пример #15
0
// RadialGradient fills with a linear gradient
void FillRadialGradient(VGfloat cx, VGfloat cy, VGfloat fx, VGfloat fy, VGfloat radius, VGfloat * stops, int ns) {
	VGfloat radialcoord[5] = { cx, cy, fx, fy, radius };
	VGPaint paint = vgCreatePaint();
	vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
	vgSetParameterfv(paint, VG_PAINT_RADIAL_GRADIENT, 5, radialcoord);
	setstop(paint, stops, ns);
	vgDestroyPaint(paint);
}
Пример #16
0
	void OpenVG_SVGHandler::onPathFillColor( unsigned int color ) {
		if( _mode == kGroupParseMode ) {
			_current_group->fill = vgCreatePaint();
			VGfloat fcolor[4] = { VGfloat( (color & 0xff000000) >> 24)/255.0f, 
				VGfloat( (color & 0x00ff0000) >> 16)/255.0f, 
				VGfloat( (color & 0x0000ff00) >> 8)/255.0f, 
				_use_opacity };
			vgSetParameterfv( _current_group->fill, VG_PAINT_COLOR, 4, &fcolor[0]);

		} else {
Пример #17
0
void CNVGCSIcon::DrawColorRampL(VGPaint aPaint)
    {
    TInt stopCount = iNVGIconData->ReadInt32L();
    VGfloat * colorRamps = new (ELeave) VGfloat[stopCount];
    CleanupStack::PushL(TCleanupItem(CleanupArray, colorRamps));

    iNVGIconData->ReadL((TUint8 *)colorRamps, stopCount * sizeof(VGfloat));
    vgSetParameteri(aPaint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
    vgSetParameterfv(aPaint, VG_PAINT_COLOR_RAMP_STOPS, stopCount, colorRamps);                    
    
    CleanupStack::PopAndDestroy();
    }
Пример #18
0
static void
draw(void)
{
    VGint WINDSIZEX = window_width();
    VGint WINDSIZEY = window_height();

    VGPaint fill;
    VGPath box;
    VGfloat color[4]		= {1.f, 0.f, 0.f, 1.f};
    VGfloat bgCol[4]		= {0.7f, 0.7f, 0.7f, 1.0f};
    VGfloat transCol[4]         = {0.f, 0.f, 0.f, 0.f};
    VGImage image = vgCreateImage(VG_sRGBA_8888, img_width, img_height,
                                  VG_IMAGE_QUALITY_NONANTIALIASED);

    /* Background clear */
    fill = vgCreatePaint();
    vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
    vgSetPaint(fill, VG_FILL_PATH);

    box = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
                       1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
    /* Rectangle to cover completely 16x16 pixel area. */
    RectToPath(box, 0, 0, 64, 64);

    vgSetfv(VG_CLEAR_COLOR, 4, transCol);
    vgClearImage(image, 0, 0, img_width, img_height);
    vgSetfv(VG_CLEAR_COLOR, 4, color);
    vgClearImage(image, 10, 10, 12, 12);
    //vgImageSubData(image, pukki_64x64_data, pukki_64x64_stride,
    //               VG_sRGBA_8888, 0, 0, 32, 32);
    vgSeti(VG_MASKING, VG_TRUE);
    vgLoadIdentity();

    vgSetfv(VG_CLEAR_COLOR, 4, bgCol);
    vgClear(0, 0, WINDSIZEX, WINDSIZEY);


    vgMask(image, VG_FILL_MASK, 0, 0, window_width(), window_height());
    vgMask(image, VG_SET_MASK, x_pos, y_pos, 100, 100);

    vgDrawPath(box, VG_FILL_PATH);

    //vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
    //vgTranslate(-10, -10);
    //vgDrawImage(image);


    vgDestroyPaint(fill);
    vgDestroyPath(box);
}
Пример #19
0
static void
init(void)
{
   VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
   VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
   static const VGubyte segments[4] = {VG_MOVE_TO_ABS,
                                       VG_SCCWARC_TO_ABS,
                                       VG_SCCWARC_TO_ABS,
                                       VG_CLOSE_PATH};
   VGfloat data[12];
   const VGfloat cx = 0, cy=29, width=80, height=40;
   const VGfloat hw = width * 0.5f;
   const VGfloat hh = height * 0.5f;

   data[0] = cx + hw;
   data[1] = cy;
   data[2] = hw;
   data[3] = hh;
   data[4] = 0;
   data[5] = cx - hw;
   data[6] = cy;
   data[7] = hw;
   data[8] = hh;
   data[9] = 0;
   data[10] = data[0];
   data[11] = cy;

   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
   vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);


   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
                       1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
   if (path == VG_INVALID_HANDLE) {
      return;
   }
   paint = vgCreatePaint();
   if (paint == VG_INVALID_HANDLE) {
      vgDestroyPath(path);
      return;
   }

   vgAppendPathData(path, 4, segments, data);
   vgSetParameterfv(paint, VG_PAINT_COLOR, 4, fillColor);
   vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
   vgSetPaint(paint, VG_FILL_PATH);
}
Пример #20
0
static void
draw(void)
{
    VGPath line;
    VGPaint fillPaint;
    VGubyte lineCommands[3] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS};
    VGfloat lineCoords[] =   {-2.0f,-1.0f, 0.0f,0.0f, -1.0f, -2.0f};
    VGfloat clearColor[] = {0.0f, 0.0f, 0.0f, 1.0f};/* black color */
    VGfloat fillColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
    //VGfloat testRadius = 60.0f;
    VGfloat testRadius = 10.0f;
    int WINDSIZEX = window_width();
    int WINDSIZEY = window_height();

    line = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
                        1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
    fillPaint = vgCreatePaint();

    vgSetf(VG_STROKE_LINE_WIDTH, 1.0f);
    //vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_ROUND);
    vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
    vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
    //vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);

    vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_BETTER);

    vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
    vgLoadIdentity();
    vgTranslate(60, 60);
    vgScale(testRadius * 2, testRadius * 2);

    vgAppendPathData(line, 3, lineCommands, lineCoords);

    vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

    vgSetPaint(fillPaint, VG_STROKE_PATH);

    vgSetParameterfv(fillPaint, VG_PAINT_COLOR, 4, fillColor);
    vgSetParameteri( fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);

    vgClear(0, 0, WINDSIZEX, WINDSIZEY);
    vgDrawPath(line, VG_STROKE_PATH);

    vgDestroyPath(line);
    vgDestroyPaint(fillPaint);
}
Пример #21
0
	OpenVG_SVGHandler::OpenVG_SVGHandler()
	:	ISVGHandler()
	,	_mode( kGroupParseMode )
	,	_current_group( &_root_group ) 
	,	_blackBackFill( 0 )
	,	_batch( 0 )
	,	_use_opacity( 1 )
	,   _has_transparent_colors( false )
	{
		_blackBackFill = vgCreatePaint();
		VGfloat fcolor[4] = { 0,0,0,1 };
		vgSetParameterfv( _blackBackFill, VG_PAINT_COLOR, 4, &fcolor[0]);
		_use_transform.setIdentity();

		//_root_transform.setScale( 1, -1 );
		
	}
Пример #22
0
static void
init(void)
{
   static const VGubyte cmds[6] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
                                   VG_LINE_TO_ABS, VG_CLOSE_PATH};
   static const VGfloat coords[]   = {  0,  200,
                                        300,  200,
                                        50,   0,
                                        150, 300,
                                        250,   0};
   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
                       VG_PATH_CAPABILITY_ALL);
   vgAppendPathData(path, 6, cmds, coords);

   fill = vgCreatePaint();
   vgSetParameterfv(fill, VG_PAINT_COLOR, 4, green_color);
   vgSetPaint(fill, VG_FILL_PATH);

   vgSetfv(VG_CLEAR_COLOR, 4, white_color);
}
Пример #23
0
LRESULT OnPaint(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	VGPaint strokePaint = vgCreatePaint();
	vgSetPaint(strokePaint, VG_STROKE_PATH);

	VGfloat color[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
	vgSetParameterfv(strokePaint, VG_PAINT_COLOR, 4, &color[0]);

	VGPath line = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
	vguLine(line, 20, 20, 130, 130);

	VGPath square = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
	vguRect(square, 10.0f, 10.0f, 130.0f, 50.0f);

	vgSetf(VG_STROKE_LINE_WIDTH, 7.0f);
	vgDrawPath(line, VG_STROKE_PATH);
	vgDrawPath(square, VG_STROKE_PATH);



	::ValidateRect(hWnd, NULL);
	return 0;
}
Пример #24
0
static void
init(void)
{
   static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
   static const VGfloat sqrCoords[5]   = {50.0f, 50.0f, 250.0f, 250.0f, 50.0f};
   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
                       VG_PATH_CAPABILITY_APPEND_TO);
   vgAppendPathData(path, 5, sqrCmds, sqrCoords);

   fill = vgCreatePaint();
   vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
   vgSetPaint(fill, VG_FILL_PATH);

   vgSetfv(VG_CLEAR_COLOR, 4, white_color);
   vgSetf(VG_STROKE_LINE_WIDTH, 10);
   vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
   vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
   vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);

   vgSeti(VG_MASKING, VG_TRUE);

   vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK,
          25, 25, 100, 100);
}
Пример #25
0
int main() {
	int running = GL_TRUE;
	int width = 640;
	int height = 480;
	int x = 50;
	int y = 50;
	int w = 10;
	int h = 10;
	/*
	Window *win = check_malloc (sizeof(Window));
	win->width = 640;
	win->height = 480;
	*/

	// Initialize GLFW, create a ShivaVG context, open a window

	if( !glfwInit() )
	{
		return 1; // Couldn't initialize GLFW
	}

	int n = glfwOpenWindow(width, height, 0,0,0,0,0,0, GLFW_WINDOW);
	if (!n) {
		glfwTerminate(); // Cleanup GLFW
		return 1; // Couldn't create a window
	}

	glfwSetWindowCloseCallback(window_close_callback);

	glfwSetWindowTitle("Shiva test");

	vgCreateContextSH(width, height); // XXX: TODO: handle errors!!!!
	
	/*
	Rect *r = make_rect(0,0,100,100,0,1,1,1);
	win->rect = r;
	*/
	
	//make color
	VGPaint paint;
	VGfloat paint_array[] = {1,0,1,1};
	paint = vgCreatePaint();
    vgSetParameterfv(paint, VG_PAINT_COLOR, 4, paint_array);
	
	//make rect

	VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
								1,0,0,0, VG_PATH_CAPABILITY_ALL);
	vguRect(path, 0, 0, w, h);


	VGfloat magenta[] = {0.9,0,0,1};
	

	while (running) {
			
		vgSetfv(VG_CLEAR_COLOR, 4, magenta);
		vgClear(0, 0, width, height);
		
		vgLoadIdentity();

		vgTranslate(x, y);
		vgSetPaint(paint, VG_FILL_PATH);
		vgDrawPath(path, VG_FILL_PATH);

		glfwSwapBuffers();	

		// Terminate when ESC is pressed or the window is closed
		running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
	}

	// Close the window, clean up the ShivaVG context, and clean up GLFW
	vgDestroyContextSH();

	// Close window and terminate GLFW
	glfwTerminate();

	
	return 0;
}
Пример #26
0
PS* PS_construct(const char* commands, int commandCount, const float* points, int pointCount)
{
	PS* ps = (PS*)malloc(sizeof(PS));
	int p = 0;
	int c = 0;
	int i = 0;
	int paths = 0;
	int maxElements = 0;
	unsigned char* cmd;
	UNREF(pointCount);

	while(c < commandCount)
	{
		int elements, e;
		c += 4;
		p += 8;
		elements = (int)points[p++];
		assert(elements > 0);
		if(elements > maxElements)
			maxElements = elements;
		for(e=0;e<elements;e++)
		{
			switch(commands[c])
			{
			case 'M': p += 2; break;
			case 'L': p += 2; break;
			case 'C': p += 6; break;
			case 'E': break;
			default:
				assert(0);		//unknown command
			}
			c++;
		}
		paths++;
	}

	ps->m_numPaths = paths;
	ps->m_paths = (PathData*)malloc(paths * sizeof(PathData));
	cmd = (unsigned char*)malloc(maxElements);

	i = 0;
	p = 0;
	c = 0;
	while(c < commandCount)
	{
		int elements, startp, e;
		float color[4];

		//fill type
		int paintMode = 0;
		ps->m_paths[i].m_fillRule = VG_NON_ZERO;
		switch( commands[c] )
		{
		case 'N':
			break;
		case 'F':
			ps->m_paths[i].m_fillRule = VG_NON_ZERO;
			paintMode |= VG_FILL_PATH;
			break;
		case 'E':
			ps->m_paths[i].m_fillRule = VG_EVEN_ODD;
			paintMode |= VG_FILL_PATH;
			break;
		default:
			assert(0);		//unknown command
		}
		c++;

		//stroke
		switch( commands[c] )
		{
		case 'N':
			break;
		case 'S':
			paintMode |= VG_STROKE_PATH;
			break;
		default:
			assert(0);		//unknown command
		}
		ps->m_paths[i].m_paintMode = (VGPaintMode)paintMode;
		c++;

		//line cap
		switch( commands[c] )
		{
		case 'B':
			ps->m_paths[i].m_capStyle = VG_CAP_BUTT;
			break;
		case 'R':
			ps->m_paths[i].m_capStyle = VG_CAP_ROUND;
			break;
		case 'S':
			ps->m_paths[i].m_capStyle = VG_CAP_SQUARE;
			break;
		default:
			assert(0);		//unknown command
		}
		c++;

		//line join
		switch( commands[c] )
		{
		case 'M':
			ps->m_paths[i].m_joinStyle = VG_JOIN_MITER;
			break;
		case 'R':
			ps->m_paths[i].m_joinStyle = VG_JOIN_ROUND;
			break;
		case 'B':
			ps->m_paths[i].m_joinStyle = VG_JOIN_BEVEL;
			break;
		default:
			assert(0);		//unknown command
		}
		c++;

		//the rest of stroke attributes
		ps->m_paths[i].m_miterLimit = points[p++];
		ps->m_paths[i].m_strokeWidth = points[p++];

		//paints
		color[0] = points[p++];
		color[1] = points[p++];
		color[2] = points[p++];
		color[3] = 1.0f;
		ps->m_paths[i].m_strokePaint = vgCreatePaint();
		vgSetParameteri(ps->m_paths[i].m_strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
		vgSetParameterfv(ps->m_paths[i].m_strokePaint, VG_PAINT_COLOR, 4, color);

		color[0] = points[p++];
		color[1] = points[p++];
		color[2] = points[p++];
		color[3] = 1.0f;
		ps->m_paths[i].m_fillPaint = vgCreatePaint();
		vgSetParameteri(ps->m_paths[i].m_fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
		vgSetParameterfv(ps->m_paths[i].m_fillPaint, VG_PAINT_COLOR, 4, color);

		//read number of elements

		elements = (int)points[p++];
		assert(elements > 0);
		startp = p;
		for(e=0;e<elements;e++)
		{
			switch( commands[c] )
			{
			case 'M':
				cmd[e] = VG_MOVE_TO | VG_ABSOLUTE;
				p += 2;
				break;
			case 'L':
				cmd[e] = VG_LINE_TO | VG_ABSOLUTE;
				p += 2;
				break;
			case 'C':
				cmd[e] = VG_CUBIC_TO | VG_ABSOLUTE;
				p += 6;
				break;
			case 'E':
				cmd[e] = VG_CLOSE_PATH;
				break;
			default:
				assert(0);		//unknown command
			}
			c++;
		}

		ps->m_paths[i].m_path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, (unsigned int)VG_PATH_CAPABILITY_ALL);
		vgAppendPathData(ps->m_paths[i].m_path, elements, cmd, points + startp);
		i++;
	}
	free(cmd);
	return ps;
}
Пример #27
0
/** Render text.
  *
  * FIXME: Not at all optimal - re-renders each time.
  * FIXME: Not UTF-8 aware
  * FIXME: better caching
  */
VCOS_STATUS_T gx_priv_render_text( GX_DISPLAY_T *disp,
                                   GRAPHICS_RESOURCE_HANDLE res,
                                   uint32_t x,
                                   uint32_t y,
                                   uint32_t width,
                                   uint32_t height,
                                   uint32_t fg_colour,
                                   uint32_t bg_colour,
                                   const char *text,
                                   uint32_t text_length,
                                   uint32_t text_size )
{
   VGfloat vg_colour[4];
   VGFT_FONT_T *font;
   VGPaint fg;
   GX_CLIENT_STATE_T save;
   VCOS_STATUS_T status = VCOS_SUCCESS;
   int clip = 1;

   vcos_demand(inited); // has gx_font_init() been called?

   gx_priv_save(&save, res);

   if (width == GRAPHICS_RESOURCE_WIDTH &&
       height == GRAPHICS_RESOURCE_HEIGHT)
   {
      clip = 0;
   }

   width = (width == GRAPHICS_RESOURCE_WIDTH) ? res->width : width;
   height = (height == GRAPHICS_RESOURCE_HEIGHT) ? res->height : height;
   font = find_font(text, text_size);
   if (!font)
   {
      status = VCOS_ENOMEM;
      goto finish;
   }

   // setup the clipping rectangle
   if (clip)
   {
      VGint coords[] = {x,y,width,height};
      vgSeti(VG_SCISSORING, VG_TRUE);
      vgSetiv(VG_SCISSOR_RECTS, 4, coords);
   }

   // setup the background colour if needed
   if (bg_colour != GRAPHICS_TRANSPARENT_COLOUR)
   {
      int err;
      VGfloat rendered_w, rendered_h;
      VGfloat vg_bg_colour[4];

      // setup the background colour...
      gx_priv_colour_to_paint(bg_colour, vg_bg_colour);
      vgSetfv(VG_CLEAR_COLOR, 4, vg_bg_colour);

      // fill in a rectangle...
      vgft_get_text_extents(font, text, text_length, (VGfloat)x, (VGfloat)y, &rendered_w, &rendered_h);

      if ( ( 0 < (VGint)rendered_w ) && ( 0 < (VGint)rendered_h ) )
      {
         vgClear(x, y, (VGint)rendered_w, (VGint)rendered_h);
         err = vgGetError();
         if (err)
         {
            GX_LOG("Error %d clearing bg text %d %d %g %g",
                   err, x, y, rendered_w, rendered_h);
            vcos_assert(0);
         } // if
      } // if
   } // if
   // setup the foreground colour
   fg = vgCreatePaint();
   if (!fg)
   {
      status = VCOS_ENOMEM;
      goto finish;
   }

   // draw the foreground text
   vgSetParameteri(fg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
   gx_priv_colour_to_paint(fg_colour, vg_colour);
   vgSetParameterfv(fg, VG_PAINT_COLOR, 4, vg_colour);
   vgSetPaint(fg, VG_FILL_PATH);

   vgft_font_draw(font, (VGfloat)x, (VGfloat)y, text, text_length, VG_FILL_PATH);

   vgDestroyPaint(fg);

   vcos_assert(vgGetError() == 0);
   vgSeti(VG_SCISSORING, VG_FALSE);

finish:
   gx_priv_restore(&save);

   return status;
}
Пример #28
0
static void *rpi_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
   int32_t success;
   EGLBoolean result;
   EGLint num_config;
   rpi_t *rpi = (rpi_t*)calloc(1, sizeof(rpi_t));
   *input = NULL;

   static EGL_DISPMANX_WINDOW_T nativewindow;

   DISPMANX_ELEMENT_HANDLE_T dispman_element;
   DISPMANX_DISPLAY_HANDLE_T dispman_display;
   DISPMANX_UPDATE_HANDLE_T dispman_update;
   DISPMANX_MODEINFO_T dispman_modeinfo;
   VC_RECT_T dst_rect;
   VC_RECT_T src_rect;

   static const EGLint attribute_list[] =
   {
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
      EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
      EGL_NONE
   };

   EGLConfig config;

   bcm_host_init();

   // get an EGL display connection
   rpi->mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
   rarch_assert(rpi->mDisplay != EGL_NO_DISPLAY);

   // initialize the EGL display connection
   result = eglInitialize(rpi->mDisplay, NULL, NULL);
   rarch_assert(result != EGL_FALSE);
   eglBindAPI(EGL_OPENVG_API);

   // get an appropriate EGL frame buffer configuration
   result = eglChooseConfig(rpi->mDisplay, attribute_list, &config, 1, &num_config);
   rarch_assert(result != EGL_FALSE);

   // create an EGL rendering context
   rpi->mContext = eglCreateContext(rpi->mDisplay, config, EGL_NO_CONTEXT, NULL);
   rarch_assert(rpi->mContext != EGL_NO_CONTEXT);

   // create an EGL window surface
   success = graphics_get_display_size(0 /* LCD */, &rpi->mScreenWidth, &rpi->mScreenHeight);
   rarch_assert(success >= 0);

   dst_rect.x = 0;
   dst_rect.y = 0;
   dst_rect.width = rpi->mScreenWidth;
   dst_rect.height = rpi->mScreenHeight;

   src_rect.x = 0;
   src_rect.y = 0;
   src_rect.width = rpi->mScreenWidth << 16;
   src_rect.height = rpi->mScreenHeight << 16;

   dispman_display = vc_dispmanx_display_open(0 /* LCD */);
   vc_dispmanx_display_get_info(dispman_display, &dispman_modeinfo);
   dispman_update = vc_dispmanx_update_start(0);

   dispman_element = vc_dispmanx_element_add(dispman_update, dispman_display,
      0 /*layer*/, &dst_rect, 0 /*src*/,
      &src_rect, DISPMANX_PROTECTION_NONE, 0 /*alpha*/, 0 /*clamp*/, DISPMANX_NO_ROTATE);

   nativewindow.element = dispman_element;
   nativewindow.width = rpi->mScreenWidth;
   nativewindow.height = rpi->mScreenHeight;
   vc_dispmanx_update_submit_sync(dispman_update);

   rpi->mSurface = eglCreateWindowSurface(rpi->mDisplay, config, &nativewindow, NULL);
   rarch_assert(rpi->mSurface != EGL_NO_SURFACE);

   // connect the context to the surface
   result = eglMakeCurrent(rpi->mDisplay, rpi->mSurface, rpi->mSurface, rpi->mContext);
   rarch_assert(result != EGL_FALSE);

   rpi->mTexType = video->rgb32 ? VG_sABGR_8888 : VG_sARGB_1555;
   rpi->mKeepAspect = video->force_aspect;

   // check for SD televisions: they should always be 4:3
   if (dispman_modeinfo.width == 720 && (dispman_modeinfo.height == 480 || dispman_modeinfo.height == 576))
      rpi->mScreenAspect = 4.0f / 3.0f;
   else
      rpi->mScreenAspect = (float)dispman_modeinfo.width / dispman_modeinfo.height;

   VGfloat clearColor[4] = {0, 0, 0, 1};
   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

   rpi->mTextureWidth = rpi->mTextureHeight = video->input_scale * RARCH_SCALE_BASE;
   // We can't use the native format because there's no sXRGB_1555 type and
   // emulation cores can send 0 in the top bit. We lose some speed on
   // conversion but I doubt it has any real affect, since we are only drawing
   // one image at the end of the day. Still keep the alpha channel for ABGR.
   rpi->mImage = vgCreateImage(video->rgb32 ? VG_sABGR_8888 : VG_sXBGR_8888,
         rpi->mTextureWidth, rpi->mTextureHeight,
         video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
   rpi_set_nonblock_state(rpi, !video->vsync);

   linuxraw_input_t *linuxraw_input = (linuxraw_input_t*)input_linuxraw.init();
   if (linuxraw_input)
   {
      *input = (const input_driver_t *)&input_linuxraw;
      *input_data = linuxraw_input;
   }

#ifdef HAVE_FREETYPE
   if (g_settings.video.font_enable)
   {
      rpi->mFont = vgCreateFont(0);
      rpi->mFontHeight = g_settings.video.font_size * (g_settings.video.font_scale ? (float) rpi->mScreenWidth / 1280.0f : 1.0f);

      const char *path = g_settings.video.font_path;
      if (!*path || !path_file_exists(path))
         path = font_renderer_get_default_font();

      rpi->mFontRenderer = font_renderer_new(path, rpi->mFontHeight);

      if (rpi->mFont != VG_INVALID_HANDLE && rpi->mFontRenderer)
      {
         rpi->mFontsOn = true;

         rpi->mPaintFg = vgCreatePaint();
         rpi->mPaintBg = vgCreatePaint();
         VGfloat paintFg[] = { g_settings.video.msg_color_r, g_settings.video.msg_color_g, g_settings.video.msg_color_b, 1.0f };
         VGfloat paintBg[] = { g_settings.video.msg_color_r / 2.0f, g_settings.video.msg_color_g / 2.0f, g_settings.video.msg_color_b / 2.0f, 0.5f };

         vgSetParameteri(rpi->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(rpi->mPaintFg, VG_PAINT_COLOR, 4, paintFg);

         vgSetParameteri(rpi->mPaintBg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(rpi->mPaintBg, VG_PAINT_COLOR, 4, paintBg);
      }
   }
#endif

   struct sigaction sa;
   sa.sa_handler = rpi_kill;
   sa.sa_flags = SA_RESTART;
   sigemptyset(&sa.sa_mask);
   sigaction(SIGINT, &sa, NULL);
   sigaction(SIGTERM, &sa, NULL);

   return rpi;
}
Пример #29
0
void CNVGCSIcon::DrawPaintL(VGPaint aPaint, VGMatrixMode aMatrixMode, TUint & aLastPaintType, TUint & aLastPaintColor, VGPaintMode aPaintMode)
    {
    VGPaintType paintType = (VGPaintType)iNVGIconData->ReadInt32L();
    
    if (paintType == VG_PAINT_TYPE_LINEAR_GRADIENT ||
        paintType == VG_PAINT_TYPE_RADIAL_GRADIENT)
        {
        VGPaintParamType paintPType = VG_PAINT_LINEAR_GRADIENT;
        if (paintType == VG_PAINT_TYPE_RADIAL_GRADIENT)
            {
            paintPType = VG_PAINT_RADIAL_GRADIENT;
            }
        
        VGPaint paintHandle = iNVGIconData->ReadInt32L();
        TInt count = iNVGIconData->ReadInt32L();
        VGfloat gradientData[5];
        VGfloat gradientMatrix[9];
        
        iNVGIconData->ReadL((TUint8 *)gradientData, count * sizeof(VGfloat));
        iNVGIconData->ReadL((TUint8 *)gradientMatrix, 9 * sizeof(VGfloat));
        
        if (paintHandle)
            {
            vgSetPaint(paintHandle,   aPaintMode);
            vgSeti(VG_MATRIX_MODE, aMatrixMode);
            vgLoadMatrix(gradientMatrix);
            if (aPaintMode == VG_FILL_PATH)
                {
                iResetFillPaint = 1;
                }
            else
                {
                iResetStrokePaint = 1;
                }
            }
        else
            {
        if (aLastPaintType != paintType)
            {
            vgSetParameteri(aPaint, VG_PAINT_TYPE, paintType);
            }
        vgSetParameterfv(aPaint, paintPType, count, gradientData);
        
        vgSeti(VG_MATRIX_MODE, aMatrixMode);
        vgLoadMatrix(gradientMatrix);
            }
        vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
        }
    else if (paintType == VG_PAINT_TYPE_COLOR)
        {
        if (aPaintMode == VG_FILL_PATH && iResetFillPaint)
            {
            iResetFillPaint = 0;
            vgSetPaint(aPaint, aPaintMode);
            }
        else if (aPaintMode == VG_STROKE_PATH && iResetStrokePaint)
            {
            iResetStrokePaint = 0;
            vgSetPaint(aPaint, aPaintMode);
            }
        TUint color = static_cast<TUint>(iNVGIconData->ReadInt32L());
        if (aLastPaintType != paintType)
            {
            vgSetParameteri(aPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
            vgSetColor(aPaint, color);
            }
        else
            {
            if (aLastPaintColor != color)
                {
                vgSetColor(aPaint, color);
                }
            }
        aLastPaintColor = color;
        }
    else
        {
        User::Leave(KErrCorrupt);
        }
    aLastPaintType = paintType;
    }
Пример #30
0
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
   vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
   if (!vg)
      return NULL;

   vg->driver = gfx_ctx_init_first(GFX_CTX_OPENVG_API, 0, 0);

   if (!vg->driver)
   {
      free(vg);
      return NULL;
   }

   vg->driver->get_video_size(&vg->mScreenWidth, &vg->mScreenHeight);
   RARCH_LOG("Detecting screen resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);

   vg->driver->swap_interval(video->vsync ? 1 : 0);
   vg->driver->update_window_title();

   vg->mTexType = video->rgb32 ? VG_sXRGB_8888 : VG_sRGB_565;
   vg->mKeepAspect = video->force_aspect;

   unsigned win_width  = video->width;
   unsigned win_height = video->height;
   if (video->fullscreen && (win_width == 0) && (win_height == 0))
   {
      win_width  = vg->mScreenWidth;
      win_height = vg->mScreenHeight;
   }

   if (!vg->driver->set_video_mode(win_width, win_height, video->fullscreen))
   {
      free(vg);
      return NULL;
   }

   vg->driver->get_video_size(&vg->mScreenWidth, &vg->mScreenHeight);
   RARCH_LOG("Verified window resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);
   vg->should_resize = true;

   if (vg->driver->translate_aspect)
      vg->mScreenAspect = vg->driver->translate_aspect(vg->mScreenWidth, vg->mScreenHeight);
   else
      vg->mScreenAspect = (float)vg->mScreenWidth / vg->mScreenHeight;

   VGfloat clearColor[4] = {0, 0, 0, 1};
   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

   vg->mTextureWidth = vg->mTextureHeight = video->input_scale * RARCH_SCALE_BASE;
   vg->mImage = vgCreateImage(vg->mTexType, vg->mTextureWidth, vg->mTextureHeight,
         video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
   vg_set_nonblock_state(vg, !video->vsync);

   vg->driver->input_driver(input, input_data);

   if (g_settings.video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer))
   {
      vg->mFont = vgCreateFont(0);

      if (vg->mFont != VG_INVALID_HANDLE)
      {
         vg->mFontsOn = true;

         vg->mFontHeight = g_settings.video.font_size * (g_settings.video.font_scale ? (float) vg->mScreenWidth / 1280.0f : 1.0f);

         vg->mPaintFg = vgCreatePaint();
         vg->mPaintBg = vgCreatePaint();
         VGfloat paintFg[] = { g_settings.video.msg_color_r, g_settings.video.msg_color_g, g_settings.video.msg_color_b, 1.0f };
         VGfloat paintBg[] = { g_settings.video.msg_color_r / 2.0f, g_settings.video.msg_color_g / 2.0f, g_settings.video.msg_color_b / 2.0f, 0.5f };

         vgSetParameteri(vg->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintFg, VG_PAINT_COLOR, 4, paintFg);

         vgSetParameteri(vg->mPaintBg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintBg, VG_PAINT_COLOR, 4, paintBg);
      }
   }

   if (vg_query_extension("KHR_EGL_image") && vg->driver->init_egl_image_buffer(video))
   {
      pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)vg->driver->get_proc_address("vgCreateEGLImageTargetKHR");

      if (pvgCreateEGLImageTargetKHR)
      {
         RARCH_LOG("[VG] Using EGLImage buffer\n");
         vg->mEglImageBuf = true;
      }
   }

#if 0
   const char *ext = (const char*)vgGetString(VG_EXTENSIONS);
   if (ext)
      RARCH_LOG("[VG] Supported extensions: %s\n", ext);
#endif

   return vg;
}