Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, February 22, 2008 1:47:13 AM(UTC)

Keith  
Keith

Groups: Registered
Posts: 9


Hi,

I'm using the raster component to display a slideshow. I would like to be able to display debug information during the slideshow which I can show and hide with a keypress. I have implemented this just using a .net label control but it looks a bit messy and doesn't paint well during the transitions.

I have looked at the Draw3dText method and I can get text to display either before or after a transition but not during. I have also had a brief look into the annotations class but I'm not sure I'm looking in the write direction with this and if I am then it looks like I'd have a lot of learning to do before I achieved my goal.

The code I am using to do the transitions is:

'dispose of the image if its not nothing
If Not m_objRasterImage Is Nothing Then
    m_objRasterImage.Dispose()
End If

'load the image to display
m_objRasterImage = m_objRasterCodecs.Load(strPathAndFilename)

'set the raster operation
objRasterPaintProperties.RasterOperation = RasterPaintProperties.SourceCopy

'transition in the image
m_objSpecialEffectsProcessor.PaintImage(objGraphics, m_objRasterImage, Rectangle.Empty, Rectangle.Empty, objClientRectangle, objClientRectangle, objSpecialEffectsType, lngEffectGrain, lngEffectDelay, 0, 0, 1, 1, False, Color.Empty, 0, Color.Empty, objRasterPaintProperties, Nothing)

'dispose of the graphics object cos the transition is complete
objGraphics.Dispose()

Is there any way that I could add some black text in a white rectangle (rectangle to auto size to size of text if possible) in the bottom right corner of an image on the fly so that the text is included in the transition?

Thanks for your time in advance

Keith

PS. It would be great if there was a command as simple as m_objRasterImage.AddText ;-)

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, February 22, 2008 11:33:55 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Keith,
Like you found out, you can draw text on the Graphics object before or after the transition has completed, but not during that.

You can also draw text on the bitmap image itself (modify the pixel data). If this gives you acceptable results, the only way to turn the text off is to save the region where the text is written in a secondary image object, then copy it back into the main image when you want to remove the text.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Friday, February 22, 2008 8:27:55 PM(UTC)

Keith  
Keith

Groups: Registered
Posts: 9


Please can you point me in the right direction for drawing text on the image itself. A small bit of sample code would be great ;-)

Cheers

Keith
 
#4 Posted : Sunday, February 24, 2008 12:29:26 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Keith,
To write text (or any GDI object) on the image, you can do it like this:

Leadtools.RasterImageGdiPlusGraphicsContainer GdiPlusGraphicsContainer = LeadRasterImage.CreateGdiPlusGraphics();
GdiPlusGraphicsContainer.Graphics.DrawString("Just a string", new Font("Times New Roman", 14), Brushes.Black, new PointF(10, 10));
GdiPlusGraphicsContainer.Dispose();

If the text written this way gives you acceptable results, and you don't want it to be permanent, you will need first to copy the portion of the image before you write the text, and later restore it to the same location.
To do that, you can create a secondary image using RasterImage.Clone(Rectangle) function, and later restore the data from it using the Leadtools.ImageProcessing.CombineFastCommand() method.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#5 Posted : Sunday, February 24, 2008 4:46:33 AM(UTC)

Keith  
Keith

Groups: Registered
Posts: 9


Amin,

Thanks. That worked perfectly.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.082 seconds.