OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   Macros/Add-ons (http://forum.oberonplace.com/forumdisplay.php?f=41)
-   -   Create a New Object layer from Mask (http://forum.oberonplace.com/showthread.php?t=24708)

ddonnahoe 25-11-2014 11:51

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.


All times are GMT -5. The time now is 05:03.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com