Commit 2dc2ecf0 authored by Sebastien Barre's avatar Sebastien Barre

enh: the shadow offset can be specified

parent b3682032
......@@ -91,7 +91,7 @@ vtkOpenGLFreeTypeTextMapper_GetGL2PSFontName(vtkTextProperty *tprop,
//----------------------------------------------------------------------------
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLFreeTypeTextMapper, "1.41");
vtkCxxRevisionMacro(vtkOpenGLFreeTypeTextMapper, "1.42");
vtkStandardNewMacro(vtkOpenGLFreeTypeTextMapper);
#endif
......@@ -413,7 +413,9 @@ void vtkOpenGLFreeTypeTextMapper::RenderOverlay(vtkViewport* viewport,
// Required for clipping to work correctly
glRasterPos2i(0, 0);
glBitmap(0, 0, 0, 0, xoff + 1, yoff - 1, NULL);
glBitmap(0, 0, 0, 0,
xoff + tprop->GetShadowOffset()[0],
yoff + tprop->GetShadowOffset()[1], NULL);
// Draw the shadow text
......
......@@ -15,7 +15,7 @@
#include "vtkTextProperty.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkTextProperty, "1.10");
vtkCxxRevisionMacro(vtkTextProperty, "1.11");
vtkStandardNewMacro(vtkTextProperty);
//----------------------------------------------------------------------------
......@@ -33,6 +33,8 @@ vtkTextProperty::vtkTextProperty()
this->Bold = 0;
this->Italic = 0;
this->Shadow = 0;
this->ShadowOffset[0] = 1;
this->ShadowOffset[1] = -1;
this->Justification = VTK_TEXT_LEFT;
this->VerticalJustification = VTK_TEXT_BOTTOM;
......@@ -101,6 +103,8 @@ void vtkTextProperty::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Bold: " << (this->Bold ? "On\n" : "Off\n");
os << indent << "Italic: " << (this->Italic ? "On\n" : "Off\n");
os << indent << "Shadow: " << (this->Shadow ? "On\n" : "Off\n");
os << indent << "ShadowOffset: (" << this->ShadowOffset[0] << ", "
<< this->ShadowOffset[1] << ")\n";
os << indent << "Justification: "
<< this->GetJustificationAsString() << "\n";
......
......@@ -38,7 +38,7 @@ public:
static vtkTextProperty *New();
// Description:
// Set the color of the text..
// Set the color of the text.
vtkSetVector3Macro(Color,double);
vtkGetVectorMacro(Color,double,3);
......@@ -59,7 +59,7 @@ public:
char *GetFontFamilyAsString();
// Description:
// Set/Get the font size (in pixels).
// Set/Get the font size (in points).
vtkSetClampMacro(FontSize,int,0,VTK_LARGE_INTEGER);
vtkGetMacro(FontSize, int);
......@@ -76,11 +76,17 @@ public:
vtkBooleanMacro(Italic, int);
// Description:
// Enable/disable text shadows.
// Enable/disable text shadow.
vtkSetMacro(Shadow, int);
vtkGetMacro(Shadow, int);
vtkBooleanMacro(Shadow, int);
// Description:
// Set/Get the shadow offset, i.e. the distance from the text to
// its shadow, in the same unit as FontSize.
vtkSetVector2Macro(ShadowOffset,int);
vtkGetVectorMacro(ShadowOffset,int,2);
// Description:
// Get the shadow color. It is computed from the Color ivar
void GetShadowColor(double color[3]);
......@@ -142,6 +148,7 @@ protected:
int Bold;
int Italic;
int Shadow;
int ShadowOffset[2];
int Justification;
int VerticalJustification;
double Orientation;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment