No subject
Wed Oct 7 22:37:18 EDT 2009
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
>
--001485f44e76b7854c047d22baa0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello again,<br><br>I've browsed the code, and found this definition of=
GetShadowColor:<br><br><div style=3D"margin-left: 40px;"><span style=3D"fo=
nt-family: courier new,monospace;">void vtkTextProperty::GetShadowColor(dou=
ble color[3])</span><br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">{</span><br style=3D"fo=
nt-family: courier new,monospace;"><span style=3D"font-family: courier new,=
monospace;">#if 1</span><br style=3D"font-family: courier new,monospace;"><=
span style=3D"font-family: courier new,monospace;">=A0 double average =3D (=
this->Color[0] + this->Color[1] + this->Color[2]) / 3.0;</span><br=
style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">#else</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 double average =3D (0.30 * this->Color[0] + </span=
><br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 0.59 * this->Color[1] + </span><br =
style=3D"font-family: courier new,monospace;"><span style=3D"font-family: c=
ourier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 0.11 * this->Color[2]);</span><br style=3D"font-family: courier n=
ew,monospace;">
<span style=3D"font-family: courier new,monospace;">#endif</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 <b>double shadow_i =3D average > 0.5 ? 0.0 : 1.0;<=
/b></span><b><br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">=A0 color[0] =3D color[=
1] =3D color[2] =3D shadow_i; </span></b><br style=3D"font-family: courier =
new,monospace;"><span style=3D"font-family: courier new,monospace;">}</span=
><br></div>
<br>From this code looks like we can infer that the "shadow color"=
; is computed from the "text color" (ie. from the <span style=3D"=
font-family: courier new,monospace;">vtkProperty::Color[] </span>attribute)=
, that it becomes just black or white, and there is no way to "change&=
quot; it, as far as I understand.<br>
<br>Regards,<br><br>Frederic Perez<br><br><div class=3D"gmail_quote">On Thu=
, Jan 14, 2010 at 4:24 PM, David Doria <span dir=3D"ltr"><<a href=3D"mai=
lto:daviddoria%2Bvtk at gmail.com">daviddoria+vtk at gmail.com</a>></span> wro=
te:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><=
div class=3D"h5">On Thu, Jan 14, 2010 at 10:06 AM, Frederic Perez <<a hr=
ef=3D"mailto:fredericpcx at gmail.com">fredericpcx at gmail.com</a>> wrote:<br=
>
> Hello David,<br>
><br>
> probably the key is to retrieve the properties of the text associated =
with<br>
> the slider and modify it (with ShadowOff).<br>
><br>
> I found this code of mine---perhaps it might help, I'm not sure:<b=
r>
><br>
> =A0=A0=A0 void<br>
> =A0=A0=A0 SetSomeTextProperties(<br>
> =A0=A0=A0 =A0=A0=A0 vtkTextProperty* a_pTextProperty,<br>
> =A0=A0=A0 =A0=A0=A0 size_t a_nTextSize,<br>
> =A0=A0=A0 =A0=A0=A0 double a_d3TextColor[3])<br>
> =A0=A0=A0 {<br>
> =A0=A0=A0 =A0=A0=A0 if (!a_pTextProperty)<br>
> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 return;<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->SetFontFamilyToArial();<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->BoldOff();<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->ItalicOff();<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->ShadowOff();<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->SetFontSize(a_nTextSize);<br>
> =A0=A0=A0 =A0=A0=A0 // '- Fails to work (?).<br>
> =A0=A0=A0 =A0=A0=A0 //=A0=A0=A0 See <a href=3D"http://markmail.org/mes=
sage/xyx2y7cdwuj3aw55" target=3D"_blank">http://markmail.org/message/xyx2y7=
cdwuj3aw55</a><br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->SetColor(a_d3TextColor);<br>
> =A0=A0=A0 =A0=A0=A0 a_pTextProperty->SetJustificationToCentered();<=
br>
> =A0=A0=A0 =A0=A0=A0 //a_pTextProperty->SetVerticalJustificationToCe=
ntered();<br>
> =A0=A0=A0 }<br>
><br>
> Regards,<br>
><br>
> Frederic Perez<br>
><br>
> On Thu, Jan 14, 2010 at 3:57 PM, David Doria <<a href=3D"mailto:dav=
iddoria%2Bvtk at gmail.com">daviddoria+vtk at gmail.com</a>><br>
> wrote:<br>
>><br>
>> To change the font color of a slider, I found to do this:<br>
>> sliderRep->GetTitleProperty()->SetColor(1,0,0);//red<br>
>><br>
>> However, as this example demonstrates:<br>
>> <a href=3D"http://www.cmake.org/Wiki/VTK/Examples/Widgets/Cxx/Slid=
er2D" target=3D"_blank">http://www.cmake.org/Wiki/VTK/Examples/Widgets/Cxx/=
Slider2D</a><br>
>><br>
>> there is a white outline around the red text:<br>
>> <a href=3D"http://www.rpi.edu/%7Edoriad/VTK_List/slider.jpg" targe=
t=3D"_blank">http://www.rpi.edu/~doriad/VTK_List/slider.jpg</a><br>
>><br>
>> Anyone know how to remove the outline and simply make the text red=
?<br>
>><br>
>> Thanks,<br>
>><br>
>> David<br>
<br>
</div></div>Ah, that did the trick, thanks Frederic.<br>
<br>
However, in vtkTextProperty, I see GetShadowColor(), but no<br>
SetShadowColor(). Is there a way to change the shadow color to a color<br>
that makes sense rather than simply turn it off?<br>
<div><div></div><div class=3D"h5"><br>
Thanks,<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href=3D"http://www.kitware.com" target=3D"_blank">www.kitware=
.com</a><br>
<br>
Visit other Kitware open-source projects at <a href=3D"http://www.kitware.c=
om/opensource/opensource.html" target=3D"_blank">http://www.kitware.com/ope=
nsource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href=3D"http://w=
ww.vtk.org/Wiki/VTK_FAQ" target=3D"_blank">http://www.vtk.org/Wiki/VTK_FAQ<=
/a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href=3D"http://www.vtk.org/mailman/listinfo/vtkusers" target=3D"_blank">=
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>
--001485f44e76b7854c047d22baa0--
More information about the vtkusers
mailing list