This is my first attempt at PhotoPaint macros. I write them all the time for Draw, but it's a little different in Paint. I'm using X7.
Code:
Sub ClipWhite()
Dim doc As Document, lyr As Layer
Set doc = ActiveDocument
Set lyr = doc.ActiveLayer
doc.Mask.Invert
'create new object from selection
'create mask from active object
lyr.CreateMask
doc.CropToMask
'delete original object
lyr.Delete
doc.Save
If Application.Documents.Count = 0 Then
Set doc = Nothing
Application.Quit
End If
End Sub
I have this code that inverts the active mask and crops the image to the mask, but now I want to edit it to create a new object from the mask after the invert, delete the original background layer.
I'm doing it this way rather than making the background layer and object, since that effectively removes the mask selection.