View Single Post
  #1  
Old 25-11-2014, 10:51
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default Create a New Object layer from Mask

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.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote