本文整理汇总了C++中FTPoint类的典型用法代码示例。如果您正苦于以下问题:C++ FTPoint类的具体用法?C++ FTPoint怎么用?C++ FTPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FTPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ftglGetGlyphBBox
void ftglGetGlyphBBox(FTGLglyph *g, float bounds[6])
{
FTBBox ret = _ftglGetGlyphBBox(g);
FTPoint lower = ret.Lower(), upper = ret.Upper();
bounds[0] = lower.Xf(); bounds[1] = lower.Yf(); bounds[2] = lower.Zf();
bounds[3] = upper.Xf(); bounds[4] = upper.Yf(); bounds[5] = upper.Zf();
}
示例2: ftgGetlLayoutBBox
void ftgGetlLayoutBBox(FTGLlayout *l, const char * s, float c[6])
{
FTBBox ret = _ftgGetlLayoutBBox(l, s);
FTPoint lower = ret.Lower(), upper = ret.Upper();
c[0] = lower.Xf(); c[1] = lower.Yf(); c[2] = lower.Zf();
c[3] = upper.Xf(); c[4] = upper.Yf(); c[5] = upper.Zf();
}
示例3: glGetFloatv
void FTPolygonGlyphImpl::DoRender()
{
GLfloat colors[4];
const FTMesh *mesh = vectoriser->GetMesh();
for(unsigned int t = 0; t < mesh->TesselationCount(); ++t)
{
const FTTesselation* subMesh = mesh->Tesselation(t);
unsigned int polygonType = subMesh->PolygonType();
glGetFloatv(GL_CURRENT_COLOR, colors);
glBindTexture(GL_TEXTURE_2D, 0);
ftglBegin(polygonType);
ftglColor4f(colors[0], colors[1], colors[2], colors[3]);
for(unsigned int i = 0; i < subMesh->PointCount(); ++i)
{
FTPoint point = subMesh->Point(i);
ftglTexCoord2f(point.Xf() / hscale, point.Yf() / vscale);
ftglVertex3f(point.Xf() / 64.0f, point.Yf() / 64.0f, 0.0f);
}
ftglEnd();
}
}
示例4: glNormal3f
void FTExtrudeGlyphImpl::RenderFront()
{
vectoriser->MakeMesh(1.0, 1, frontOutset);
glNormal3f(0.0, 0.0, 1.0);
GLfloat colors[4];
const FTMesh *mesh = vectoriser->GetMesh();
for(unsigned int j = 0; j < mesh->TesselationCount(); ++j)
{
const FTTesselation* subMesh = mesh->Tesselation(j);
unsigned int polygonType = subMesh->PolygonType();
glGetFloatv(GL_CURRENT_COLOR, colors);
glBindTexture(GL_TEXTURE_2D, 0);
ftglBegin(polygonType);
ftglColor4f(colors[0], colors[1], colors[2], colors[3]);
for(unsigned int i = 0; i < subMesh->PointCount(); ++i)
{
FTPoint pt = subMesh->Point(i);
ftglTexCoord2f(pt.Xf() / hscale,
pt.Yf() / vscale);
ftglVertex3f(pt.Xf() / 64.0f,
pt.Yf() / 64.0f,
0.0f);
}
ftglEnd();
}
}
示例5: glNormal3d
void FTExtrudeGlyphImpl::RenderFront()
{
vectoriser->MakeMesh(1.0, 1, frontOutset);
glNormal3d(0.0, 0.0, 1.0);
const FTMesh *mesh = vectoriser->GetMesh();
for(unsigned int j = 0; j < mesh->TesselationCount(); ++j)
{
const FTTesselation* subMesh = mesh->Tesselation(j);
unsigned int polygonType = subMesh->PolygonType();
glBegin(polygonType);
for(unsigned int i = 0; i < subMesh->PointCount(); ++i)
{
FTPoint pt = subMesh->Point(i);
glTexCoord2f(pt.Xf() / hscale,
pt.Yf() / vscale);
glVertex3f(pt.Xf() / 64.0f,
pt.Yf() / 64.0f,
0.0f);
}
glEnd();
}
}
示例6: ftglGetFontBBox
void ftglGetFontBBox(FTGLfont *f, const char* s, int len, float c[6])
{
FTBBox ret = _ftglGetFontBBox(f, s, len);
FTPoint lower = ret.Lower(), upper = ret.Upper();
c[0] = lower.Xf(); c[1] = lower.Yf(); c[2] = lower.Zf();
c[3] = upper.Xf(); c[4] = upper.Yf(); c[5] = upper.Zf();
}
示例7: ftglRenderGlyph
void ftglRenderGlyph(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
int renderMode, FTGL_DOUBLE *advancex,
FTGL_DOUBLE *advancey)
{
FTPoint pen(penx, peny);
FTPoint ret = _ftglRenderGlyph(g, pen, renderMode);
*advancex = ret.X();
*advancey = ret.Y();
}
示例8: MeasureText
Gwen::Point Chowdren::MeasureText( Gwen::Font* pFont,
const Gwen::UnicodeString & text )
{
FTSimpleLayout layout;
layout.SetLineLength(10000);
layout.SetFont(get_font(pFont->size));
FTBBox bbox = layout.BBox(text.c_str());
FTPoint size = bbox.Upper() - bbox.Lower();
return Gwen::Point((int)ceil(size.X()), (int)ceil(size.Y()));
}
示例9: switch
void OgreFTPolygonGlyphImpl::DoRender(const FTPoint& pen)
{
vectoriser->MakeMesh(1.0, 1, outset);
const FTMesh *mesh = vectoriser->GetMesh();
for(unsigned int t = 0; t < mesh->TesselationCount(); ++t)
{
const FTTesselation* subMesh = mesh->Tesselation(t);
unsigned int polygonType = subMesh->PolygonType();
Ogre::RenderOperation renderOperation;
switch (polygonType) {
case GL_TRIANGLE_STRIP:
renderOperation.operationType = Ogre::RenderOperation::OT_TRIANGLE_STRIP;
break;
case GL_TRIANGLE_FAN:
renderOperation.operationType = Ogre::RenderOperation::OT_TRIANGLE_FAN;
break;
}
manualObject->begin("BaseWhite", renderOperation.operationType);
for(unsigned int i = 0; i < subMesh->PointCount(); ++i)
{
FTPoint point = subMesh->Point(i);
manualObject->index(i);
manualObject->textureCoord(pen.Xf() + (point.Xf() / hscale), pen.Yf() + (point.Yf() / vscale));
manualObject->position(pen.Xf() + (point.Xf() / 64.0f), pen.Yf() + (point.Yf() / 64.0f), 0.0f);
}
manualObject->end();
}
}
示例10: FTGlyph
FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph, bool useDisplayList)
: FTGlyph( glyph),
glList(0)
{
if( ft_glyph_format_outline != glyph->format)
{
err = 0x14; // Invalid_Outline
return;
}
FTVectoriser vectoriser( glyph);
if(( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3))
{
return;
}
unsigned int horizontalTextureScale = glyph->face->size->metrics.x_ppem * 64;
unsigned int verticalTextureScale = glyph->face->size->metrics.y_ppem * 64;
vectoriser.MakeMesh( 1.0);
if( useDisplayList)
{
glList = glGenLists( 1);
glNewList( glList, GL_COMPILE);
}
const FTMesh* mesh = vectoriser.GetMesh();
for( unsigned int index = 0; index < mesh->TesselationCount(); ++index)
{
const FTTesselation* subMesh = mesh->Tesselation( index);
unsigned int polyonType = subMesh->PolygonType();
glBegin( polyonType);
for( unsigned int pointIndex = 0; pointIndex < subMesh->PointCount(); ++pointIndex)
{
FTPoint point = subMesh->Point(pointIndex);
glTexCoord2f( point.X() / horizontalTextureScale,
point.Y() / verticalTextureScale);
glVertex3f( point.X() / 64.0f,
point.Y() / 64.0f,
0.0f);
}
glEnd();
}
if(useDisplayList)
{
glEndList();
}
}
示例11: testSetters
void testSetters()
{
FTPoint point;
FTPoint point1(1, 2, 3);
point.X(1);
point.Y(2);
point.Z(3);
CPPUNIT_ASSERT(point == point1);
}
示例12: printText
void cFont::printText(LPCSTR text, FTPoint textPos, colour3f textColour)
{
glPushMatrix();
glTranslatef(textPos.X(), textPos.Y(), 0);
glScalef(1, -1, 1);
glColor3f(textColour.r, textColour.g, textColour.b);
theFont->Render(text);
glPopMatrix();
}
示例13: switch
/**\brief Internal rendering function.*/
int Font::RenderInternal( int x, int y, const string& text, int h, XPos xpos, YPos ypos) {
int xn = 0;
int yn = 0;
switch( xpos ) {
case LEFT:
xn = x;
break;
case CENTER:
xn = x - this->TextWidth(text) / 2;
break;
case RIGHT:
xn=x-this->TextWidth(text);
break;
default:
LogMsg(ERR, "Invalid xpos");
assert(0);
}
// Y coordinates are flipped
switch( ypos ) {
case TOP:
yn = -y - h - TO_INT(floor(this->font->Descender()));
break;
case MIDDLE:
yn = -y - h / 2 - TO_INT(floor(this->font->Descender()));
break;
case BOTTOM:
yn = -y - TO_INT(floor(this->font->Descender()));
break;
default:
LogMsg(ERR, "Invalid ypos");
assert(0);
}
glColor4f( r, g, b, a );
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPushMatrix(); // to save the current matrix
glScalef(1, -1, 1);
FTPoint newpoint = this->font->Render( text.c_str(), -1, FTPoint( xn, yn, 1) );
glPopMatrix(); // restore the previous matrix
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
return TO_INT(ceil(newpoint.Xf())) - x;
}
示例14: FTGlyph
FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph, bool useDisplayList)
: FTGlyph( glyph),
glList(0)
{
if( ft_glyph_format_outline != glyph->format)
{
err = 0x14; // Invalid_Outline
return;
}
FTVectoriser vectoriser( glyph);
size_t numContours = vectoriser.ContourCount();
if ( ( numContours < 1) || ( vectoriser.PointCount() < 3))
{
return;
}
if(useDisplayList)
{
// Check if we are out of display lists
if (glList == 0)
{
useDisplayList = false;
}
else
glNewList( glList, GL_COMPILE);
}
for( unsigned int c = 0; c < numContours; ++c)
{
const FTContour* contour = vectoriser.Contour(c);
glBegin( GL_LINE_LOOP);
for( unsigned int pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex)
{
FTPoint point = contour->Point(pointIndex);
glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);
}
glEnd();
}
if(useDisplayList)
{
glEndList();
}
}
示例15: glBegin
void FTOutlineGlyphImpl::DoRender()
{
for(unsigned int c = 0; c < vectoriser->ContourCount(); ++c)
{
const FTContour* contour = vectoriser->Contour(c);
glBegin(GL_LINE_LOOP);
for(unsigned int i = 0; i < contour->PointCount(); ++i)
{
FTPoint point = FTPoint(contour->Point(i).X() + contour->Outset(i).X() * outset,
contour->Point(i).Y() + contour->Outset(i).Y() * outset,
0);
glVertex2f(point.Xf() / 64.0f, point.Yf() / 64.0f);
}
glEnd();
}
}