void CHuiRasterizedTextMesh::DrawPictographLines(CHuiGc& aGc, const THuiRealPoint& aOffset,
                                       THuiAlignHorizontal aLineAlignment) const
    {
    if (!iPictographInterface || iUsingPreRasterizedMesh)
        {
        return;    
        }
    
    
    TInt y = 0;

    // Draw the built lines using THuiImages.
    for(TInt i = 0; i < iPictographLines.Count(); ++i)
        {
        const SRasterizedLine& line = iPictographLines[i];
        if(line.iTexture)
            {

            THuiImage textImage(*line.iTexture);
            THuiRealPoint linePos(0.f, TReal32(y));
            THuiRealSize lineSize = line.iTexture->Size();

            // Choose the line-specific alignment.
            switch(aLineAlignment)
                {
                case EHuiAlignHRight:
                    linePos.iX = Extents().iWidth - lineSize.iWidth;
                    break;

                case EHuiAlignHCenter:
                    linePos.iX = (Extents().iWidth - lineSize.iWidth) / 2;
                    break;

                default:
                    break;
                }

            aGc.SetPenColor(KRgbWhite);
            aGc.DrawImage(textImage, linePos + aOffset, lineSize);

            // Move one line downwards.
            y += TInt(lineSize.iHeight) + line.iGap;
            }

        // Move extra gap downwards.
        y += line.iGap;
        
        // Add line spacing.
        y += iLineSpacing;
        }
    }
Пример #2
0
int main( int argc, char** argv )
{
    osg::ArgumentParser arguments( &argc, argv );
    
    osg::ref_ptr<osg::MatrixTransform> scene = new osg::MatrixTransform;
    scene->addChild( createImageQuad(gradientImage(), osg::Vec3()) );
    scene->addChild( createImageQuad(textImage(), osg::Vec3(1.1f, 0.0f, 0.0f)) );
    
    osgViewer::Viewer viewer;
    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
    viewer.addEventHandler( new osgViewer::StatsHandler );
    viewer.addEventHandler( new osgViewer::WindowSizeHandler );
    viewer.setSceneData( scene.get() );
    return viewer.run();
}
Пример #3
0
	void Test::putSomeText(String text, Mat frame, Point point) {
		stringstream textImage("");
		textImage << text;
		putText(frame, textImage.str(),Point(100,400), 1, 1.0, Scalar(50,50,50));
		cout << point << endl;
	}
void CHuiRasterizedTextMesh::DrawLines(CHuiGc& aGc, const THuiRealPoint& aOffset,
                                       THuiAlignHorizontal aLineAlignment, TReal32 aShadowOpacity) const
    {    
    TInt y = 0;

    // Draw the built lines using THuiImages.
    for(TInt i = 0; i < iLines.Count(); ++i)
        {
        const SRasterizedLine& line = iLines[i];
        if(line.iTexture)
            {

            THuiImage textImage(*line.iTexture);
            THuiRealPoint linePos(0.f, TReal32(y));
            THuiRealSize lineSize = line.iTexture->Size();
                   
            // Do a downward scaling for line texture from TV resolution to LCD resolution.
            if(iTextMeshScale != 1)
                {
                lineSize.iHeight = lineSize.iHeight/iTextMeshScale;
                lineSize.iWidth = lineSize.iWidth/iTextMeshScale;
                }
            
            // Choose the line-specific alignment.
            switch(aLineAlignment)
                {
                case EHuiAlignHRight:
                    linePos.iX = Extents().iWidth - lineSize.iWidth;
                    break;

                case EHuiAlignHCenter:
                    linePos.iX = (Extents().iWidth - lineSize.iWidth) / 2;
                    break;

                default:
                    break;
                }

            
            // Is there a shadow?
            if ( RasterizedShadow() )
                {
                const TInt requestedBlurredSize = HUI_ROUND_FLOAT_TO_INT( 2*iVisual->DropShadowHandler()->iRadius.Now() );
                THuiTextureHandle shadow;
                TBool haveShadowTexture = line.iTexture->GetShadowTexture(shadow,requestedBlurredSize );
                
                if ( haveShadowTexture )
                    {
                    THuiImage shadowImage(shadow);
                    const THuiRealRect shadowDrawingRect = iVisual->DropShadowHandler()->ShadowDrawingRealRect( 
                        linePos,
                        lineSize,
                        shadow.Size(),
                        *iVisual );
                    
                    const TRgb oldColor = aGc.PenColorAlpha();
                    aGc.SetPenColor(iVisual->DropShadowHandler()->Color());
                    aGc.SetPenAlpha(HUI_ROUND_FLOAT_TO_INT(aShadowOpacity * 255.0f));
                    
                    const THuiQuality oldQuality = aGc.Quality();
                    aGc.SetQuality(EHuiQualityFast);
                    
                    aGc.DrawImage(shadowImage, shadowDrawingRect.iTl + aOffset, shadowDrawingRect.Size());
                    
                    aGc.SetPenColorAlpha(oldColor);
                    aGc.SetQuality(oldQuality);
                    }
                }
                
            aGc.DrawImage(textImage, linePos + aOffset, lineSize);

            // Move one line downwards.
            y += TInt(lineSize.iHeight) + line.iGap;
            }

        // Move extra gap downwards.
        y += line.iGap;
        
        // Add line spacing.
        y += iLineSpacing;
        }
    }