[vtkusers] Remove white outline on slider text
Frederic Perez
fredericpcx at gmail.com
Thu Jan 14 11:53:21 EST 2010
Hello again,
I've browsed the code, and found this definition of GetShadowColor:
void vtkTextProperty::GetShadowColor(double color[3])
{
#if 1
double average = (this->Color[0] + this->Color[1] + this->Color[2]) / 3.0;
#else
double average = (0.30 * this->Color[0] +
0.59 * this->Color[1] +
0.11 * this->Color[2]);
#endif
*double shadow_i = average > 0.5 ? 0.0 : 1.0;**
color[0] = color[1] = color[2] = shadow_i; *
}
>From this code looks like we can infer that the "shadow color" is computed
from the "text color" (ie. from the vtkProperty::Color[] attribute), that it
becomes just black or white, and there is no way to "change" it, as far as I
understand.
Regards,
Frederic Perez
On Thu, Jan 14, 2010 at 4:24 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:
> On Thu, Jan 14, 2010 at 10:06 AM, Frederic Perez <fredericpcx at gmail.com>
> wrote:
> > Hello David,
> >
> > probably the key is to retrieve the properties of the text associated
> with
> > the slider and modify it (with ShadowOff).
> >
> > I found this code of mine---perhaps it might help, I'm not sure:
> >
> > void
> > SetSomeTextProperties(
> > vtkTextProperty* a_pTextProperty,
> > size_t a_nTextSize,
> > double a_d3TextColor[3])
> > {
> > if (!a_pTextProperty)
> > return;
> > a_pTextProperty->SetFontFamilyToArial();
> > a_pTextProperty->BoldOff();
> > a_pTextProperty->ItalicOff();
> > a_pTextProperty->ShadowOff();
> > a_pTextProperty->SetFontSize(a_nTextSize);
> > // '- Fails to work (?).
> > // See http://markmail.org/message/xyx2y7cdwuj3aw55
> > a_pTextProperty->SetColor(a_d3TextColor);
> > a_pTextProperty->SetJustificationToCentered();
> > //a_pTextProperty->SetVerticalJustificationToCentered();
> > }
> >
> > Regards,
> >
> > Frederic Perez
> >
> > On Thu, Jan 14, 2010 at 3:57 PM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> >
> > wrote:
> >>
> >> To change the font color of a slider, I found to do this:
> >> sliderRep->GetTitleProperty()->SetColor(1,0,0);//red
> >>
> >> However, as this example demonstrates:
> >> http://www.cmake.org/Wiki/VTK/Examples/Widgets/Cxx/Slider2D
> >>
> >> there is a white outline around the red text:
> >> http://www.rpi.edu/~doriad/VTK_List/slider.jpg<http://www.rpi.edu/%7Edoriad/VTK_List/slider.jpg>
> >>
> >> Anyone know how to remove the outline and simply make the text red?
> >>
> >> Thanks,
> >>
> >> David
>
> Ah, that did the trick, thanks Frederic.
>
> However, in vtkTextProperty, I see GetShadowColor(), but no
> SetShadowColor(). Is there a way to change the shadow color to a color
> that makes sense rather than simply turn it off?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100114/87a54449/attachment.htm>
More information about the vtkusers
mailing list