support fade in and fade out?

General TRichView support forum. Please post your questions here
Post Reply
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

support fade in and fade out?

Post by KFC123 »

Does trichview support a fade-in & fade-out text?

thx in advance
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, no.
But you can create image of TRichView document, place it on top of TRichView, and apply fade-in/fade-out effect to this image.
I created a demo: http://www.trichview.com/support/files/fade.zip

But if you need to apply this effect to text only (not to pictures, tables, etc.), and if this text is on the same background, you simply can modify RVStyle.TextStyles.Color (for all i) and repaint TRichView.
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

Post by KFC123 »

Wow, it's really great! Thanks a lot.
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

Post by KFC123 »

Sergey Tkachenko wrote:Sorry, no.
But you can create image of TRichView document, place it on top of TRichView, and apply fade-in/fade-out effect to this image.
I created a demo: http://www.trichview.com/support/files/fade.zip
That's great.
But if you need to apply this effect to text only (not to pictures, tables, etc.), and if this text is on the same background, you simply can modify RVStyle.TextStyles.Color (for all i) and repaint TRichView.

I only want to fade-in/fade-out line 2 (only text), but merely change the style can make a transparency effect? I try but seems not good
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If the background is a plain color (for example, white), you can make text color whiter and whiter, until it becomes white and completely disappears.
KFC123
Posts: 13
Joined: Fri Apr 21, 2006 7:27 am

Post by KFC123 »

Sergey Tkachenko wrote:If the background is a plain color (for example, white), you can make text color whiter and whiter, until it becomes white and completely disappears.
Thanks. I am not quite familiar with controling color, here is my code of handling TEXT in green on black background (change the brightness from bright to dark)

RVEdit.Clear;
RVEdit.AddNL('text', 0, 0);
RV.Format;
cColor := clBlack;

ccColor := Self.AnsRVStyle.TextStyles.Items[0].Color;
for i := 10 downto 0 do
begin
Level := 255*i div 10;
blue := ((cColor and $FF00FF) shr 16)*Level;
green := ((cColor and $00FFFF) shr 8)*Level;
red := (cColor and $0000FF)*Level;
Lev := 255-Level;
cBlue := ((ccColor and $FF00FF) shr 16)*Level;
cGreen := ((ccColor and $00FFFF) shr 8)*Level;
cRed := (ccColor and $0000FF)*Level;
cBlue := (cBlue *Lev + blue) div 255;
cGreen := (cGreen*Lev + green) div 255;
cRed := (cRed *Lev + red) div 255;
ccColor := cBlue*255*255 + cGreen*255 + cRed;
Self.AnsRVStyle.TextStyles.Items[0].Color := ccColor;
Sleep(100);
end;

But the it doesn't change the brightness smoothly and Sleep here seems block the program seriously while clicking other other buttons before the loop is finished. By the way, is it possible to make a specific line being fade-in/out rather than working on the whole richview?

Thanks in advance.
Post Reply