Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

#web-2-print-editor

Options
Go to last post Go to first unread
corlin  
#1 Posted : Saturday, May 1, 2010 9:07:31 PM(UTC)
corlin

Rank: Newbie

Groups: Member
Joined: 1/9/2010(UTC)
Posts: 7

Hi,

how should I save the complete edited image - in the gift editor sample.

I would prefer simply to save it as a new image - but I am not sure that is possible?

I have tried to serialize the canvas - but when i deserialize the getRegions() in the photoLabelControl.ascx fails

yield return new NamedRectangleRegion(l.Name, new RectangleF(l.Region.Left, l.Region.Top, l.Region.Width, l.Region.Height));

with
an:
{"Object reference not set to an instance of an object."}


It seems as if the layer (__backgroundImageLayer) has no regions?

Any idea what is happening - or should i use a different way to save the complete image ?

best regards
Claus

Edited by moderator Monday, May 28, 2012 8:51:48 PM(UTC)  | Reason: Not specified

andreym  
#2 Posted : Monday, May 3, 2010 1:03:46 PM(UTC)
andreym

Rank: Advanced Member

Groups:
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Hi Claus!

We have the RenderRegion method in the PhotoLabelControl.aspx.cs which allows to get every region as bitmap. To save the whole canvas as bitmap you can add new public method in the PhotoLabelControl.aspx.cs. There is the code snippet for this method below:
Code:

	public Aurigma.GraphicsMill.Bitmap RenderCanvas(float dpi)
	{
		Layer _regionLayer = this.CanvasViewer.Canvas.Layers.GetLayersByName(_regionLayerName)[0];
		
		// Hide layer with region's rectangles.
		_regionLayer.Visible = false;
		
		Bitmap bp = this.CanvasViewer.Canvas.RenderWorkspace(dpi, Aurigma.GraphicsMill.ColorSpace.Rgb);
		
		// Show regions layer back.
		_regionLayer.Visible = true;

		return bp;
	}


To save bitmap as an image file use Save method:
Code:

	protected void renderBtn_Click(object sender, EventArgs e)
	{
		using (Bitmap bp = photoLabel.RenderCanvas(300))
		{
			bp.Save(MapPath("~/Saves/1.png"));
		}
	}



And yes, there is an error occurs while canvas deserialization. We will fix it.
Users browsing this topic
Forum Jump  
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.