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 : Thursday, February 14, 2008 10:33:11 PM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


How to set overlay image on rasterThumbnailBrowser's item image?

 

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 : Sunday, February 17, 2008 1:25:39 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

One way to do that is to combine the 2 images into one image (for example using the Combine or the Alpha Blend function), then take the resulting image and insert it into the Thumbnail browser instead of the original image.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Sunday, February 17, 2008 4:03:46 PM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


any example
thank you very muh

<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/cs/Themes/default/images/icon-quote.gif">&nbsp;<strong>Maen Hasan wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello,<br><br>One way to do that is to combine the 2 images into one image (for example using the Combine or the Alpha Blend function), then take the resulting image and insert it into the Thumbnail browser instead of the original image.<br><br>Thanks,<br>Maen Badwan<br>LEADTOOLS Technical Support</td></tr></table></td></tr></table></BLOCKQUOTE>
 
#4 Posted : Sunday, February 17, 2008 10:28:16 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

The following code shows how to get the image of the first item in the RasterThumbnailBrowser and combine it with the overlay image:
+-----------+
Dim ItemImage As RasterImage
Dim overlayImage As RasterImage

RasterCodecs.Startup()

Dim _codecs As New RasterCodecs

ItemImage = RasterThumbnailBrowser1.Items(0).Image.Clone()

overlayImage = _codecs.Load("c:\TempFiles\Sunset.jpg")

Dim command As CombineCommand = New CombineCommand
command.SourceImage = ItemImage.Clone()
command.DestinationRectangle = New System.Drawing.Rectangle(ItemImage.Width \ 8, ItemImage.Height \ 8, ItemImage.Width, ItemImage.Height)
command.SourcePoint = New System.Drawing.Point(100, 100)
command.Flags = CombineCommandFlags.OperationAdd Or CombineCommandFlags.Destination0 Or CombineCommandFlags.SourceRed Or CombineCommandFlags.DestinationGreen Or CombineCommandFlags.ResultBlue
command.Run(overlayImage)

RasterThumbnailBrowser1.Items(0).Image = overlayImage.Clone()
RasterThumbnailBrowser1.Refresh()
+-----------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Monday, February 18, 2008 1:51:54 AM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


how about SetAlphaImage? any emample?

thankyou
 
#6 Posted : Monday, February 18, 2008 2:17:42 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

About using AlphaBlendCommand Class, please read the following topic in the LEADTOOLS .Net documentation:
- AlphaBlendCommand Class

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Monday, February 18, 2008 2:29:01 AM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


sorry my question is how to set transparency color

<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/cs/Themes/default/images/icon-quote.gif">&nbsp;<strong>Maen Hasan wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello,<br><br>About using AlphaBlendCommand Class, please read the following topic in the LEADTOOLS .Net documentation:<br>- AlphaBlendCommand Class<br><br>Thanks,<br>Maen Badwan<br>LEADTOOLS Technical Support</td></tr></table></td></tr></table></BLOCKQUOTE>
 
#8 Posted : Monday, February 18, 2008 2:37:53 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

Please read the following topics in the LEADTOOLS .Net documentation:
- Implementing Transparency
- SetAlphaImage Method
- CreateAlphaImage Method

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Monday, February 18, 2008 2:53:05 AM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


ok
i follow the example program. it's work fine. but i want show the overlay image at the middle of the source?

source file 200x200
overlay image 100x100
 
#10 Posted : Monday, February 18, 2008 4:03:13 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

If you want to show the overlay image at the middle of the source image, you can use the CombineCommand class as follows:
+---------+
...
Dim command As CombineCommand = New CombineCommand
command.SourceImage = OverlayImage.Clone
command.DestinationRectangle = New System.Drawing.Rectangle(ItemImage.Width / 4, ItemImage.Height / 4, OverlayImage.Width, OverlayImage.Height)
command.SourcePoint = New System.Drawing.Point(100, 100)
command.Flags = CombineCommandFlags.OperationAdd Or CombineCommandFlags.Destination0 'Or CombineCommandFlags.SourceRed Or CombineCommandFlags.DestinationGreen Or CombineCommandFlags.ResultBlue
command.Run(ItemImage)

mBrowser.Items(0).Image = ItemImage.Clone()
...
+---------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#11 Posted : Monday, February 18, 2008 6:47:57 PM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


one more question. if my soure image size is 500x500 andoverlay image size is 32x32. the rasterthumbnail will scale the source image form 500x500 to 96x76. the prolem is when i cancel the overlay image:

sourceImage = _codecs.Load(rasterThumbnailBrowser1.Items[index].FileName);

rasterThumbnailBrowser1.Items[index].Image = sourceImage.Clone();

the rasterThumbnailBrowser item image will change to 500x500. How can i change it from 500x500 back to 96x76.

thnakyou
 
#12 Posted : Monday, February 18, 2008 11:47:08 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

Do you mean that the thumbnail of the source image will be 500x500 when you reload the source image?

Can you please send me a screenshot image that shows how the thumbnail appears on your side?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#13 Posted : Tuesday, February 19, 2008 12:40:09 AM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


yes
 
#14 Posted : Tuesday, February 19, 2008 1:47:00 AM(UTC)

kwongtk  
kwongtk

Groups: Registered
Posts: 12


screenshot at below
File Attachment(s):
problem.zip (196kb) downloaded 20 time(s).
 
#15 Posted : Tuesday, February 19, 2008 2:46:12 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

To keep the size of the item image, you can try one of the following:

- Don't reload the original image using the _codecs.Load method. Just copy the item source image to a temporary image, and then reassign the temporary image to the item when you want to cancel the overlay image:
+----------+
Private TempImage As RasterImage
...
mBrowser.LoadThumbnails(folderPath, "*.jpg", RasterThumbnailBrowserLoadFlags.Block)
TempImage = mBrowser.Items(0).Image.Clone()
...
mBrowser.Items(0).Image = TempImage.Clone()
+----------+

- Resize the image after loading it using the SizeCommand class:
+----------+
Dim TempImage As RasterImage

TempImage = _codecs.Load(mBrowser.Items(0).FileName)

Dim resize As New SizeCommand
resize.Width = 96
resize.Height = 76
resize.Flags = RasterSizeFlags.Resample
resize.Run(TempImage)

mBrowser.Items(0).Image = TempImage.Clone()
+----------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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.170 seconds.