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 : Wednesday, October 22, 2008 12:06:28 PM(UTC)
paulywally

Groups: Registered
Posts: 5


Hi,

I have LEAD tool pro v15.

I am having problems with increasing the canvas size of an image and filling with white. The fill is never shown in the result, only empty space.

Here is my code...

RasterImage destImage = new RasterImage(RasterMemoryFlags.Conventional, width, height, rasterImage.BitsPerPixel, rasterImage.Order, rasterImage.ViewPerspective, rasterImage.GetPalette(), IntPtr.Zero, 0);

FillCommand fillCommand = new FillCommand(new RasterColor(System.Drawing.Color.White));
fillCommand.Run(destImage);

// Combine them
CombineFastCommand combineCommand = new CombineFastCommand();
combineCommand.DestinationRectangle = new System.Drawing.Rectangle(-x, -y, rasterImage.Width, rasterImage.Height);
combineCommand.SourcePoint = System.Drawing.Point.Empty;
combineCommand.DestinationImage = destImage;
combineCommand.Flags = CombineFastCommandFlags.SourceCopy; //CombineFastCommandFlags.OperationAdd | CombineFastCommandFlags.Destination0;
combineCommand.Run(rasterImage);

// convert back to an ImageSource
SelectedWorkbook.WorkingImageSource = RasterImageMediaConverter.ConvertFrom(destImage, RasterImageMediaConverterFromFlags.None);


Any help would be appreciated.

Thanks,
Pauly
 

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 : Thursday, October 23, 2008 5:52:13 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

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

Your code appears to be OK. What exactly do you mean by "The fill is never shown in the result, only empty space"? In LEADTOOLS, there's no definition for an "empty" part of an image. Every pixel in the image must have a value. If you create a new bitmap and don't fill its pixels with any color, they would be normally filled by zeroes, which in most cases corresponds to pure black color.
 
#3 Posted : Friday, October 31, 2008 5:36:56 AM(UTC)
paulywally

Groups: Registered
Posts: 5


It may have something goofy to do with WPF and binding. I will try to save the file and see what I get. In the meantime, here is a picture of what I am talking about. The space between the picture and the black border should have been filled with white.

Thanks,
Pauly

paulywally attached the following image(s):
Untitled.jpg
 
#4 Posted : Friday, October 31, 2008 6:15:50 AM(UTC)
paulywally

Groups: Registered
Posts: 5


The saved image does look correct. I have a WPF image control bound to an ImageSource that is being changed. Somehow the control is getting confused.

Thanks for your help,
Pauly
 
#5 Posted : Sunday, November 2, 2008 5:02:30 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

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

Pauly,

I wan to reproduce this at my side and see what went wrong.

Please put your code in a small working project (not your full application), pack you project in a ZIP or RAR file and post it here. Please make sure to remove any serial number and unlock keys from your project.

If you don't wan to post your project here, then send it to support@leadtools.com and mention this forum post in the email.
 
#6 Posted : Monday, November 3, 2008 8:50:17 AM(UTC)
paulywally

Groups: Registered
Posts: 5


Yasir,

Here is a test project.

Thanks,
Pauly
File Attachment(s):
ImageResize.zip (53kb) downloaded 25 time(s).
 
#7 Posted : Tuesday, November 4, 2008 6:02:40 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

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

When the image is converted it will be converted to 32-bit image with alpha channel transparency. That's why it will appear as transparent.

You need to convert the image to 24-bit and in this case the white fill will appear.

I have modified the project you sent me and attached it to this post.
File Attachment(s):
ImageResizeModified.zip (73kb) downloaded 31 time(s).
 
#8 Posted : Tuesday, November 4, 2008 9:27:30 AM(UTC)
paulywally

Groups: Registered
Posts: 5


Works perfectly. Thanks Yasir!
 
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.116 seconds.