Rank: Newbie
Groups: Guest
Joined: 6/24/2009(UTC) Posts: 3
|
Using the latest version of GraphicsMill and .NET 4.0, I am getting the following error. I get the same error on the business card sample as well out of the box. Code:Aurigma.GraphicsMill.BitmapEmptyException was unhandled by user code
Message=Bitmap object has not been filled up with data.
Source=Aurigma.GraphicsMill
StackTrace:
at Aurigma.GraphicsMill.Bitmap.ThrowIfEmpty()
at Aurigma.GraphicsMill.Bitmap.Draw(Bitmap destinationBitmap, Int32 destinationX, Int32 destinationY, Int32 destinationWidth, Int32 destinationHeight, CombineMode combine, Single opacity, InterpolationMode interpolationMode)
at AurigmaImageTest.imagegen.RasterizePsd(String inputFilename, Hashtable updatedLayers) in C:\Matthew Williams\Sandbox\AurigmaImageTest\imagegen.aspx.cs:line 122
at AurigmaImageTest.imagegen.Page_Load(Object sender, EventArgs e) in C:\Matthew Williams\Sandbox\AurigmaImageTest\imagegen.aspx.cs:line 24
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
Here is the code I am using which is just a shameless copy from the business card sample project. Code:using System;
using Aurigma.GraphicsMill;
namespace AurigmaImageTest
{
public partial class imagegen : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.Hashtable updatedLayers = new System.Collections.Hashtable();
updatedLayers.Add("FullName", "John Doe");
Bitmap Bmp = RasterizePsd(@"c:\ImageTemplates\BusinessCard.psd", updatedLayers);
}
public static Aurigma.GraphicsMill.Bitmap RasterizePsd(string inputFilename, System.Collections.Hashtable updatedLayers)
{
Aurigma.GraphicsMill.Codecs.AdvancedPsdReader reader =
new Aurigma.GraphicsMill.Codecs.AdvancedPsdReader(inputFilename);
Aurigma.GraphicsMill.Bitmap resultBitmap =
new Aurigma.GraphicsMill.Bitmap();
Aurigma.GraphicsMill.Codecs.AdvancedPsdFrame frame;
frame = (Aurigma.GraphicsMill.Codecs.AdvancedPsdFrame)reader.LoadFrame(1);
frame.GetBitmap(resultBitmap);
frame.Dispose();
resultBitmap.Channels.DiscardAlpha(Aurigma.GraphicsMill.RgbColor.White);
Aurigma.GraphicsMill.Bitmap currentLayerBitmap =
new Aurigma.GraphicsMill.Bitmap();
for (int i = 2; i < reader.FrameCount; i++)
{
frame = (Aurigma.GraphicsMill.Codecs.AdvancedPsdFrame)reader.LoadFrame(i);
if (frame.Type != Aurigma.GraphicsMill.Codecs.PsdFrameType.Unknown)
{
bool isPlaceholder = updatedLayers[frame.Name] != null;
if (isPlaceholder && frame.Type == Aurigma.GraphicsMill.Codecs.PsdFrameType.Text)
{
Aurigma.GraphicsMill.Codecs.AdvancedPsdTextFrame textFrame;
Aurigma.GraphicsMill.Drawing.GdiGraphics graphics;
textFrame = (Aurigma.GraphicsMill.Codecs.AdvancedPsdTextFrame)frame;
float y = textFrame.Top - textFrame.Font.GetBlackBox(textFrame.Text.Trim()).Top;
graphics = resultBitmap.GetGdiGraphics();
graphics.DrawString((string)(updatedLayers[frame.Name]), textFrame.Font, textFrame.TextBrush, textFrame.Left, y);
graphics.Dispose();
}
else
{
if (isPlaceholder)
{
((Aurigma.GraphicsMill.Bitmap)(updatedLayers[frame.Name])).Draw(resultBitmap,
frame.Left, frame.Top,
frame.Width, 0,
Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, 1.0f,
Aurigma.GraphicsMill.Transforms.InterpolationMode.LowQuality);
}
else
{
frame.GetBitmap(currentLayerBitmap);
currentLayerBitmap.Draw(resultBitmap,
frame.Left, frame.Top,
0, 0,
Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, 1.0f,
Aurigma.GraphicsMill.Transforms.InterpolationMode.LowQuality);
}
}
}
}
currentLayerBitmap.Dispose();
reader.Close();
return resultBitmap;
}
}
}
Edited by user 15 years ago
| Reason: Not specified
|