Rank: Newbie
Groups: Guest
Joined: 10/9/2022(UTC) Posts: 3
|
Hello I'm test driving the library and so far it's pretty great, but I'm stuck on this one issue: There are complete examples on how to copy over existing clipping paths from one TIF (or jpg) to another, but what if you need to draw and add a completely new clipping path from scratch to the AdobeResources? How can i create a new Aurigma.GraphicsMill.Codecs.ClippingPath.Path given a series of points, and add it to the adobeResources of a new file? Thanks for any insights!
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Hello, Please check this code: Code:using (var bitmap = new Bitmap(400, 300, PixelFormat.Format24bppRgb, RgbColor.Red))
using (var path = new Aurigma.GraphicsMill.AdvancedDrawing.Path())
{
path.DrawEllipse(0, 0, bitmap.Width, bitmap.Height);
// 2000-2997 Clipping path information
// http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
const int firstPathId = 2000;
// Inside of Adobe Resource, all points are stored in relative values to the image dimensions, so you need to provide image with/height for conversion.
var pathData = AdobeResourceBlock.CreatePath(path, bitmap.Width, bitmap.Height);
var ar = new AdobeResourceDictionary();
ar.Add(firstPathId, new AdobeResourceBlock("MyPath", pathData));
bitmap.Save("out.jpg", new JpegSettings() { AdobeResources = ar });
}
|
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Rank: Newbie
Groups: Guest
Joined: 10/9/2022(UTC) Posts: 3
|
That works perfectly, thanks!
|
|
|
|
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.