This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, October 22, 2008 12:06:28 PM(UTC)
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
#2
Posted
:
Thursday, October 23, 2008 5:52:13 AM(UTC)
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)
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):
#4
Posted
:
Friday, October 31, 2008 6:15:50 AM(UTC)
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)
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)
Groups: Registered
Posts: 5
Yasir,
Here is a test project.
Thanks,
Pauly
#7
Posted
:
Tuesday, November 4, 2008 6:02:40 AM(UTC)
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.
#8
Posted
:
Tuesday, November 4, 2008 9:27:30 AM(UTC)
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.