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

Notification

Icon
Error

Options
Go to last post Go to first unread
WalterM  
#1 Posted : Sunday, October 9, 2022 11:31:51 AM(UTC)
WalterM

Rank: Newbie

Groups: Member
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!

Eugene Kosmin  
#2 Posted : Sunday, October 9, 2022 8:07:49 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 487

Was thanked: 30 time(s) in 30 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

WalterM  
#3 Posted : Sunday, October 9, 2022 11:20:45 PM(UTC)
WalterM

Rank: Newbie

Groups: Member
Joined: 10/9/2022(UTC)
Posts: 3

That works perfectly, thanks!
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.