[vtkusers] Bug vtkTextActor ShadowOn

Jon Waite JonW at pathsurg.com
Tue May 12 17:43:32 EDT 2009


Bug found:

In vtkFreeTypeUtilities::PopulateImageData, the rgb values are always
set equal to the current text being rendered and ignores any
previously drawn text, [like the shadow].  This results in the blended
edge pixels of the foreground text to render at the full opacity where
it overlaps with the shadow text.  This creates an artifact of the
shadowed text being colored by the shading of the foreground text.


On Mon, May 11, 2009 at 4:10 PM, Jon Waite <JonW at pathsurg.com> wrote:
> All,
>
> The text actor's shadow is not rendering correctly, creating a cropped
> and hard to read display. [see code below]
>
> Jon
>
> --------------------------------
>
> #include "vtkRenderWindowInteractor.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkActor.h"
> #include "vtkWin32OpenGLRenderWindow.h"
> #include "vtkWin32RenderWindowInteractor.h"
> #include "vtkTextProperty.h"
> #include "vtkTextActor.h"
> #include "vtkCoordinate.h"
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>        vtkWin32OpenGLRenderWindow *renWin = vtkWin32OpenGLRenderWindow::New();
>        vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
>        iren->SetRenderWindow(renWin);
>        iren->Initialize();
>
>        vtkRenderer *renderer = vtkRenderer::New();
>        renWin->AddRenderer(renderer);
>        if(1)
>        {
>                if (1)
>                {
>                        vtkTextActor* InfoTipTextActor = vtkTextActor::New();
>                        InfoTipTextActor->SetInput("Error");
>                        vtkTextProperty* textprop  = InfoTipTextActor->GetTextProperty();
>                        textprop->SetColor(1,1,1);
>                        textprop->SetFontSize(16);
>                        textprop->ShadowOn();
>                        textprop->SetJustificationToLeft();
>                        textprop->SetVerticalJustificationToBottom();
>
>                        vtkCoordinate* coord = InfoTipTextActor->GetPositionCoordinate();
>                        coord->SetCoordinateSystemToNormalizedViewport();
>                        coord->SetValue(0.5,0.5);
>
>                        renderer->AddViewProp(InfoTipTextActor);
>                        InfoTipTextActor->Delete();
>                }
>
>                renderer->ResetCamera();
>                renderer->Render();
>        }
>
>        iren->Start();
>
>        renderer->Delete();
>        renWin->Delete();
>        iren->Delete();
>
>        return 0;
> }
>



More information about the vtkusers mailing list