Results 1 to 5 of 5

Thread: GDI+ / AmanithVG / ShivaVG framework + question

  1. #1

    GDI+ / AmanithVG / ShivaVG framework + question


    First, a contribution. Here is the C++ graphics framework we're using in our project:

    It abstracts over GDI+ and OpenVG (supporting both AmanithVG and ShivaVG). Some of the features:
    - parsing of TrueType fonts with FreeType (so, people who wondered how to use fonts may use the code)
    - formatted text rendering
    - 9grid seamless image scaling (it was tricky. not so seamless with GDI+ currently, the working solution was damn slow)
    - image tinting

    Second, an inquiry. We use text functions and VG_COLOR_TRANSFORM defined in OpenVG 1.1, but:

    1.ShivaVG only supports OpenVG 1.0.1. Are there chances it will be updated? Are there alive developers somewhere in the universe?

    2.AmanithVG perfectly supports OpenVG 1.1. But they offer evaluation license only. I've contacted them and they tell they're targeted at hardware manufacturers and don't offer developer licenses. Guys, are there chances you will?

    Thanks in advance.

  2. #2

    Re: GDI+ / AmanithVG / ShivaVG framework + question

    Some info on the framework:

    1.To choose between GDI+ and OpenVG just instantiate the respective class: GraphicsGDIP or GraphicsOVG

    2.To choose between AmanithVG and ShivaVG change the #define at the top of GraphicsOVG.cpp

    3.The TrueType parsing code is located in _FontFileOVG.h/cpp:
    Code :
    VGFont font;
    map<wchar_t, float> advances;
    FT_Outline_Funcs FontFileOVG::outline_funcs =
    	0, 0
    bool FontFileOVG::Load(void *data, int size)
    	FT_Face face;
    	if (FT_New_Memory_Face(ft_library, (FT_Byte *)data, size, 0, &face))
    		return false;
    	if (!face->face_flags & FT_FACE_FLAG_SCALABLE)
    		return false;
    	units_per_EM = face->units_per_EM;
    	ascent = face->ascender;
    	descent = -face->descender;
    	height = face->height;
    	if (font) vgDestroyFont(font);
    	font = vgCreateFont(face->num_glyphs);	
    	FT_UInt glyph_index;
    	FT_ULong char_code = FT_Get_First_Char(face, &glyph_index);
    	while (glyph_index != 0)
    		// NO_SCALE = NO_HINTING, NO_BITMAP, and keeps font in design units
    		FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_SCALE);
    		PathOVG path;
    		FT_GlyphSlot glyph = face->glyph;
    		FT_Outline_Decompose(&glyph->outline, &outline_funcs, (void *)&path);
    		VGfloat glyph_origin[2] = { 0.0f, 0.0f };
    		VGfloat glyph_escapement[2] = { glyph->advance.x, glyph->advance.y };
    		vgSetGlyphToPath(font, char_code, path.Get(), VG_FALSE, glyph_origin, glyph_escapement);
    		advances[char_code] = glyph->advance.x;
    		char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
    	return true;
    int FontFileOVG::Outline_MoveTo(const FT_Vector *to, void *user)
    	PathOVG *path = (PathOVG *)user;
    	path->MoveTo(to->x, to->y);
    	return 0;
    int FontFileOVG::Outline_LineTo(const FT_Vector *to, void *user)
    	PathOVG *path = (PathOVG *)user;
    	path->LineTo(to->x, to->y);
    	return 0;
    int FontFileOVG::Outline_ConicTo(const FT_Vector *control, const FT_Vector *to, void *user)
    	VGPath path = ((PathOVG *)user)->Get();
    	VGubyte segments[1] = {VG_QUAD_TO_ABS};
    	VGfloat coords[4] = {control->x, control->y, to->x, to->y};
    	vgAppendPathData(path, 1, segments, coords);
    	return 0;
    int FontFileOVG::Outline_CubicTo(const FT_Vector* control1, const FT_Vector *control2, const FT_Vector* to, void *user)
    	PathOVG *path = (PathOVG *)user;
    	path->CubicTo(to->x, to->y, control1->x, control1->y, control2->x, control2->y);
    	return 0;

  3. #3

    Re: GDI+ / AmanithVG / ShivaVG framework + question

    Any tips on optimization from OpenVG experts are welcome!

  4. #4

    Re: GDI+ / AmanithVG / ShivaVG framework + question

    Quote Originally Posted by haaf
    - 9grid seamless image scaling (it was tricky. not so seamless with GDI+ currently, the working solution was damn slow)
    It is now seamless with GDI+ as well.

  5. #5

    Re: GDI+ / AmanithVG / ShivaVG framework + question

    Have you tried combining OpenVG with OpenGL? It may be desirable to apply shader effects on 2D objects via OpenGL ES 2.0. Any thoughts?


Similar Threads

  1. What is rasterizer in AmanithVG?
    By djgolu123 in forum OpenVG and VGU
    Replies: 0
    Last Post: 08-22-2011, 08:06 AM
  2. OpenGL ES with GDI problem. (eglMakeCurrent - bug?)
    By demi in forum OpenGL ES general technical discussions
    Replies: 4
    Last Post: 04-15-2009, 07:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts