Exemplo n.º 1
0
/*******************************************************************************
 * Function Name  : ReleaseView
 * Returns        : Nothing
 * Description    : Code in ReleaseView() will be called by the Shell before
 *					changing to a new rendering context.
 *******************************************************************************/
bool CTransforms::ReleaseView()
{
	// Cleanup: destroy paths and paint
	vgDestroyPath(m_avgPaths[0]);
	vgDestroyPath(m_avgPaths[1]);
	vgDestroyPaint(m_vgPaint);
	// Cleanup for custom text drawing
	m_PrintVG.Terminate();

	return true;
}
Exemplo n.º 2
0
/*******************************************************************************
 * Function Name  : ReleaseView
 * Returns        : true if no error occured
 * Description    : Code in ReleaseView() will be called by the Shell before
 *					changing to a new rendering context.
 *******************************************************************************/
bool OVGMaskLayer::ReleaseView()
{
	// Cleanup: destroy the paths
	vgDestroyPath(m_avgPath[0]);
	vgDestroyPath(m_avgPath[1]);

	m_PrintVG.Terminate();

	// Destroy the mask layers
	vgDestroyMaskLayer(m_vgMaskLayer[0]);
	vgDestroyMaskLayer(m_vgMaskLayer[1]);
	return true;
}
Exemplo n.º 3
0
static void add_char ( VGFont font, FT_Face face, FT_ULong c )
{
  // Pango already provides us with the font index, not the glyph UNICODE
  // point.

  FT_Load_Glyph( face, c, FT_LOAD_DEFAULT );

  FT_Outline *outline = &face->glyph->outline;

  VGPath path;
  path = vgCreatePath( VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
		       1.f, 0.f, 0, 0, VG_PATH_CAPABILITY_ALL );
  // It could be a blank. If any character doesn't have a glyph, though,
  // nothing is drawn by vgDrawGlyphs.
  if ( outline->n_contours > 0 ) {
    convert_outline( outline->points, outline->tags, outline->contours,
		     outline->n_contours, outline->n_points );
    vgAppendPathData( path, segments_count, segments, coords );
  }

  VGfloat origin[] = { 0.f, 0.f };
  VGfloat escapement[] = { float_from_26_6(face->glyph->advance.x),
			   float_from_26_6(face->glyph->advance.y) };

  vgSetGlyphToPath( font, c, path, VG_TRUE, origin, escapement );

  vgDestroyPath( path );
}
Exemplo n.º 4
0
void PainterOpenVG::drawEllipse(const IntRect& rect, VGbitfield specifiedPaintModes)
{
    ASSERT(m_state);

    VGbitfield paintModes = 0;
    if (!m_state->strokeDisabled())
        paintModes |= VG_STROKE_PATH;
    if (!m_state->fillDisabled())
        paintModes |= VG_FILL_PATH;

    paintModes &= specifiedPaintModes;

    if (!paintModes)
        return;

    m_surface->makeCurrent();

    VGPath path = vgCreatePath(
        VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
        1.0 /* scale */, 0.0 /* bias */,
        4 /* expected number of segments */,
        12 /* expected number of total coordinates */,
        VG_PATH_CAPABILITY_APPEND_TO);
    ASSERT_VG_NO_ERROR();

    if (vguEllipse(path, rect.x() + rect.width() / 2.0, rect.y() + rect.height() / 2.0, rect.width(), rect.height()) == VGU_NO_ERROR) {
        vgDrawPath(path, paintModes);
        ASSERT_VG_NO_ERROR();
    }

    vgDestroyPath(path);
    ASSERT_VG_NO_ERROR();
}
Exemplo n.º 5
0
void PainterOpenVG::drawLine(const IntPoint& from, const IntPoint& to)
{
    ASSERT(m_state);

    if (m_state->strokeDisabled())
        return;

    m_surface->makeCurrent();

    VGPath path = vgCreatePath(
        VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
        1.0 /* scale */, 0.0 /* bias */,
        2 /* expected number of segments */,
        4 /* expected number of total coordinates */,
        VG_PATH_CAPABILITY_APPEND_TO);
    ASSERT_VG_NO_ERROR();

    VGUErrorCode errorCode;

    // Try to align lines to pixels, centering them between pixels for odd thickness values.
    if (fmod(m_state->strokeThickness + 0.5, 2.0) < 1.0)
        errorCode = vguLine(path, from.x(), from.y(), to.x(), to.y());
    else if ((to.y() - from.y()) > (to.x() - from.x())) // more vertical than horizontal
        errorCode = vguLine(path, from.x() + 0.5, from.y(), to.x() + 0.5, to.y());
    else
        errorCode = vguLine(path, from.x(), from.y() + 0.5, to.x(), to.y() + 0.5);

    if (errorCode == VGU_NO_ERROR) {
        vgDrawPath(path, VG_STROKE_PATH);
        ASSERT_VG_NO_ERROR();
    }

    vgDestroyPath(path);
    ASSERT_VG_NO_ERROR();
}
Exemplo n.º 6
0
PlatformPathOpenVG::~PlatformPathOpenVG()
{
    makeCompatibleContextCurrent();

    vgDestroyPath(m_vgPath);
    ASSERT_VG_NO_ERROR();
}
Exemplo n.º 7
0
SurfaceOpenVG::~SurfaceOpenVG()
{
    if (!isValid())
        return;

    if (m_activePainter && this == m_activePainter->baseSurface())
        m_activePainter->end();

    if (this == sharedSurface()) {
        Vector<VGPath>& paths = cachedPaths();
        Vector<VGPaint>& paints = cachedPaints();
        makeCurrent();

        for (int i = 0; i = paths.size(); ++i) {
            if (paths.at(i) != VG_INVALID_HANDLE)
                vgDestroyPath(paths.at(i));
        }
        for (int i = 0; i = paints.size(); ++i) {
            if (paints.at(i) != VG_INVALID_HANDLE)
                vgDestroyPaint(paints.at(i));
        }
    }

#if PLATFORM(EGL)
    EGLDisplayOpenVG::forDisplay(m_eglDisplay)->destroySurface(m_eglSurface);
    EGLDisplayOpenVG::unregisterPlatformSurface(this);
#else
    ASSERT_NOT_REACHED();
#endif
}
Exemplo n.º 8
0
void loadTiger()
{
  int i;
  VGPath temp;
  
  temp = testCreatePath();  
  tigerPaths = (VGPath*)malloc(pathCount * sizeof(VGPath));
  vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
  vgTranslate(-100,100);
  vgScale(1,-1);
  
  for (i=0; i<pathCount; ++i) {
    
    vgClearPath(temp, VG_PATH_CAPABILITY_ALL);
    vgAppendPathData(temp, commandCounts[i],
                     commandArrays[i], dataArrays[i]);
    
    tigerPaths[i] = testCreatePath();
    vgTransformPath(tigerPaths[i], temp);
  }
  
  tigerStroke = vgCreatePaint();
  tigerFill = vgCreatePaint();
  vgSetPaint(tigerStroke, VG_STROKE_PATH);
  vgSetPaint(tigerFill, VG_FILL_PATH);
  vgLoadIdentity();
  vgDestroyPath(temp);
}
Exemplo n.º 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);
}
Exemplo n.º 10
0
void SurfaceOpenVG::detach()
{
    if (!isValid())
        return;

    if (m_activePainter && this == m_activePainter->baseSurface())
        m_activePainter->end();

    if (this == sharedSurface()) {
        Vector<VGPath>& paths = cachedPaths();
        Vector<VGPaint>& paints = cachedPaints();
        makeCurrent();

        for (int i = 0; i = paths.size(); ++i) {
            if (paths.at(i) != VG_INVALID_HANDLE)
                vgDestroyPath(paths.at(i));
        }
        for (int i = 0; i = paints.size(); ++i) {
            if (paints.at(i) != VG_INVALID_HANDLE)
                vgDestroyPaint(paints.at(i));
        }
    }

#if PLATFORM(EGL)
    EGLDisplayOpenVG::forDisplay(m_eglDisplay)->removeSurface(m_eglSurface, m_doesOwnSurface);
    EGLDisplayOpenVG::unregisterPlatformSurface(this);
    m_eglDisplay = EGL_NO_DISPLAY;
    m_eglSurface = EGL_NO_SURFACE;
    m_eglContext = EGL_NO_CONTEXT;
#else
    ASSERT_NOT_REACHED();
#endif
}
Exemplo n.º 11
0
NwSvgFigure::~NwSvgFigure()
{
	if( VG_INVALID_HANDLE != m_path )
	{
		vgClearPath(m_path, VG_PATH_CAPABILITY_ALL);
		vgDestroyPath(m_path);
	}
}
Exemplo n.º 12
0
// poly makes either a polygon or polyline
void poly(VGfloat * x, VGfloat * y, VGint n, VGbitfield flag) {
	VGfloat points[n * 2];
	VGPath path = newpath();
	interleave(x, y, n, points);
	vguPolygon(path, points, n, VG_FALSE);
	vgDrawPath(path, flag);
	vgDestroyPath(path);
}
Exemplo n.º 13
0
/*******************************************************************************
 * Function Name  : ReleaseView
 * Returns        : Nothing
 * Description    : Code in ReleaseView() will be called by the Shell before
 *					changing to a new rendering context.
 *******************************************************************************/
bool CStrokeStyles::ReleaseView()
{
	vgDestroyPath(m_vgPath);

	m_PrintVG.Terminate();

	return true;
}
Exemplo n.º 14
0
void NwSvgFigure::clearSvgFigure()
{
	if( VG_INVALID_HANDLE != m_path )
	{
		vgClearPath(m_path, VG_PATH_CAPABILITY_ALL);
		vgDestroyPath(m_path);
		m_path = VG_INVALID_HANDLE;
	}
	m_bHasData	= false;
}
Exemplo n.º 15
0
/*******************************************************************************
 * Function Name  : ReleaseView
 * Returns        : true if no error occured
 * Description    : Code in ReleaseView() will be called by the Shell before
 *					changing to a new rendering context.
 *******************************************************************************/
bool CIntroducingPVRShell::ReleaseView()
{
	// Cleanup: destroy OpenVG path and paint
	vgDestroyPath(m_vgPath);
	m_vgPath = 0;
	vgDestroyPaint(m_vgFillPaint);
	m_vgFillPaint = 0;

	return true;
}
Exemplo n.º 16
0
void PS_destruct(PS* ps)
{
	int i;
	assert(ps);
	for(i=0;i<ps->m_numPaths;i++)
	{
		vgDestroyPaint(ps->m_paths[i].m_fillPaint);
		vgDestroyPaint(ps->m_paths[i].m_strokePaint);
		vgDestroyPath(ps->m_paths[i].m_path);
	}
	free(ps->m_paths);
	free(ps);
}
Exemplo n.º 17
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);
}
Exemplo n.º 18
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);
}
Exemplo n.º 19
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);
}
Exemplo n.º 20
0
VCOS_STATUS_T vgft_font_convert_glyphs(VGFT_FONT_T *font, unsigned int char_height, unsigned int dpi_x, unsigned int dpi_y)
{
   FT_UInt glyph_index;
   FT_ULong ch;

   if (FT_Set_Char_Size(font->ft_face, 0, char_height, dpi_x, dpi_y))
   {
      FT_Done_Face(font->ft_face);
      vgDestroyFont(font->vg_font);
      return VCOS_EINVAL;
   }

   ch = FT_Get_First_Char(font->ft_face, &glyph_index);

   while (ch != 0)
   {
      if (FT_Load_Glyph(font->ft_face, glyph_index, FT_LOAD_DEFAULT)) {
         FT_Done_Face(font->ft_face);
         vgDestroyFont(font->vg_font);
         return VCOS_ENOMEM;
      }

      VGPath vg_path;
      FT_Outline *outline = &font->ft_face->glyph->outline;
      if (outline->n_contours != 0) {
         vg_path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
         assert(vg_path != VG_INVALID_HANDLE);

         convert_outline(outline->points, outline->tags, outline->contours, outline->n_contours, outline->n_points);
         vgAppendPathData(vg_path, segments_count, segments, coords);
      } else {
         vg_path = VG_INVALID_HANDLE;
      }

      VGfloat origin[] = { 0.0f, 0.0f };
      VGfloat escapement[] = { float_from_26_6(font->ft_face->glyph->advance.x), float_from_26_6(font->ft_face->glyph->advance.y) };
      vgSetGlyphToPath(font->vg_font, glyph_index, vg_path, VG_FALSE, origin, escapement);

      if (vg_path != VG_INVALID_HANDLE) {
         vgDestroyPath(vg_path);
      }
      ch = FT_Get_Next_Char(font->ft_face, ch, &glyph_index);
   }

   return VCOS_SUCCESS;
}
Exemplo n.º 21
0
void PainterOpenVG::drawPolygon(size_t numPoints, const FloatPoint* points, VGbitfield specifiedPaintModes)
{
    ASSERT(m_state);

    VGbitfield paintModes = 0;
    if (!m_state->strokeDisabled())
        paintModes |= VG_STROKE_PATH;
    if (!m_state->fillDisabled())
        paintModes |= VG_FILL_PATH;

    paintModes &= specifiedPaintModes;

    if (!paintModes)
        return;

    m_surface->makeCurrent();

    // Path segments: all points + "close path".
    const VGint numSegments = numPoints + 1;
    const VGint numCoordinates = numPoints * 2;

    VGPath path = vgCreatePath(
        VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
        1.0 /* scale */, 0.0 /* bias */,
        numSegments /* expected number of segments */,
        numCoordinates /* expected number of total coordinates */,
        VG_PATH_CAPABILITY_APPEND_TO);
    ASSERT_VG_NO_ERROR();

    Vector<VGfloat> vgPoints(numCoordinates);
    for (int i = 0; i < numPoints; ++i) {
        vgPoints[i*2]     = points[i].x();
        vgPoints[i*2 + 1] = points[i].y();
    }

    if (vguPolygon(path, vgPoints.data(), numPoints, VG_TRUE /* closed */) == VGU_NO_ERROR) {
        vgDrawPath(path, paintModes);
        ASSERT_VG_NO_ERROR();
    }

    vgDestroyPath(path);
    ASSERT_VG_NO_ERROR();
}
Exemplo n.º 22
0
/*!***************************************************************************
 @Function		~CPVRTPVGObject
 @Description	CPVRTPVGObject class destructor where Paths and Paints are deallocated
*****************************************************************************/
CPVRTPVGObject::~CPVRTPVGObject()
{
	if(m_bInitialized)
	{
		m_bInitialized = false;

		for(int i = 0; i < m_i32NumPaints; ++i)
		{
			vgDestroyPaint(m_pPaints[i]);
		}

		for(int j = 0; j < m_i32NumPaths; ++j)
		{
			vgDestroyPath(m_pPaths[j].m_path);
		}

		free(m_pPaths);
		free(m_pPaints);
	}
}
Exemplo n.º 23
0
CTSmallWindowOpenVG::~CTSmallWindowOpenVG()
	{
	// Make sure that this egl status is active
	eglMakeCurrent(iDisplay, iSurface, iSurface, iContextVG);
    vgDestroyPaint(iFillPaint);
    vgDestroyPaint(iStrokePaint);
    vgDestroyPath(iPath);
	if (iContextVG != EGL_NO_CONTEXT)
		{
		eglDestroyContext(iDisplay,iContextVG);
		}
	if (iSurface != EGL_NO_SURFACE)
		{
		eglDestroySurface(iDisplay,iSurface);
		}	
	// Call eglMakeCurrent() to ensure the surfaces and contexts are truly destroyed. 
	eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
	//eglTerminate(iDisplay);
	eglReleaseThread();
	}
Exemplo n.º 24
0
COpenVGHandleStore::~COpenVGHandleStore()
    {
    TInt handleListCount    = iHandles.Count();
    for (TInt i = 0; i < handleListCount; i++)
        {
        if (iHandles[i].iVGHandle)
            {
            switch (iHandles[i].iHandleType)
                {
                case TLVVGHandlePair::EVGPath:
                    vgDestroyPath(iHandles[i].iVGHandle);
                    break;
                case TLVVGHandlePair::EVGPaint:
                    vgDestroyPaint(iHandles[i].iVGHandle);
                    break;
                case TLVVGHandlePair::EVGImage:
                    vgDestroyImage(iHandles[i].iVGHandle);
                    break;
                }
            }
        }
    iHandles.Close();
    }
Exemplo n.º 25
0
void createPear(VGPath p)
{
  VGPath temp;

  VGubyte segs[] = {
    VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
    VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
    VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH,
    VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH };

  VGfloat data[] = {
    0.0625,-90.625001, -29.44062,-89.191161, -23.07159,-32.309301,
    -30.5625,-14.062501, -38.29681,4.7771994, -56.8077,20.767199,
    -56.46875,42.812499, -56.1298,64.502999, -40.15822,79.731799,
    -22.34375,79.812499, -4.17446,79.893199, -1.93369,71.113999,
    4.15625,71.156199, 10.49619,71.198499, 13.70293,80.336799,
    30.4375,80.281199, 42.49257,80.241199, 53.53251,70.782999,
    58.75,58.218799, 47.0442,54.768499, 38.5,43.943499,
    38.5,31.124999, 38.50001,22.754099, 42.14686,15.236999,
    47.9375,10.062499, 42.2834,1.5737994, 36.5413,-6.6199006,
    34.09375,-14.062501, 28.48694,-31.111801, 32.99356,-90.265511,
    1.5,-90.625001,

    5.1056438,-97.8762, -12.766585,-99.48239, -22.244878,-111.09615,
    -22.325466,-129.98288, -6.486451,-125.28908, 2.8790668,-113.87186,
    5.1056438,-97.8762 };

  temp = testCreatePath();
  vgAppendPathData(temp, sizeof(segs), segs, data);

  vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
  vgLoadIdentity();
  vgScale(1,-1);
  vgTransformPath(p, temp);
  vgDestroyPath(temp);
}
Exemplo n.º 26
0
void createApple(VGPath p)
{
  VGPath temp;

  VGubyte segs[] = {
    VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
    VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
    VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH,
    VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH };

  VGfloat data[] = {
    1.53125,-44.681982, -3.994719,-44.681982, -8.0085183,-50.562501,
    -26.5625,-50.562501, -42.918439,-50.562501, -56.46875,-34.239393,
    -56.46875,-12.187501, -56.46875,26.520416, -34.65822,61.731799,
    -16.84375,61.812499, -7.1741233,61.812499, -2.9337937,55.656199,
    4.15625,55.656199, 11.746294,55.656199, 17.981627,62.281199,
    25.4375,62.281199, 33.88615,62.281199, 50.53251,44.282999,
    58.75,15.718799, 47.751307,9.086518, 40.999985,-0.228074,
    41,-13.046574, 41,-27.849147, 46.64686,-34.763001,
    52.4375,-39.937501, 46.111827,-47.219094, 39.0413,-50.503784,
    29.09375,-50.446384, 11.146487,-50.342824, 8.6341912,-44.681982,
    1.53125,-44.681982,

    0.23972344,-52.075169, -2.8344902,-69.754133, 5.9303785,-81.915323,
    24.152707,-86.881406, 23.71828,-70.367255, 15.114064,-58.365865,
    0.23972344,-52.075169 };

  temp = testCreatePath();
  vgAppendPathData(temp, sizeof(segs), segs, data);

  vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
  vgLoadIdentity();
  vgScale(1,-1);
  vgTransformPath(p, temp);
  vgDestroyPath(temp);
}
Exemplo n.º 27
0
 ~BoxRenderer() {
   vgDestroyPath(path_);
   assert(!vgGetError());
   vgDestroyPaint(paint_);
   assert(!vgGetError());
 }
Exemplo n.º 28
0
// ArcOutline makes an elliptical arc at the specified location and dimensions, outlined
void ArcOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h, VGfloat sa, VGfloat aext) {
	VGPath path = newpath();
	vguArc(path, x, y, w, h, sa, aext, VGU_ARC_OPEN);
	vgDrawPath(path, VG_STROKE_PATH);
	vgDestroyPath(path);
}
Exemplo n.º 29
0
// EllipseOutline makes an ellipse at the specified location and dimensions, outlined
void EllipseOutline(VGfloat x, VGfloat y, VGfloat w, VGfloat h) {
	VGPath path = newpath();
	vguEllipse(path, x, y, w, h);
	vgDrawPath(path, VG_STROKE_PATH);
	vgDestroyPath(path);
}
Exemplo n.º 30
0
// unloadfont frees font path data
void unloadfont(VGPath * glyphs, int n) {
	int i;
	for (i = 0; i < n; i++) {
		vgDestroyPath(glyphs[i]);
	}
}