Sunday, April 4, 2010

How to get layer size in filter?

I want get layer size and position in filter.

top, bottom, left, and right.

on automation, I can get those informations by sPSActionControl suite, but I can not access this suite in filter.

thanks
How to get layer size in filter?
In PS,it's easy to get the size of a document through FilterRecord-%26gt;documentInfo,but always we want to get the size%26amp;position of the layer(or maybe a layerset) in a document in order to do something with the layer(such as get RGB channel data and Transparency channel data).So just as what liuhui asked,we haven't found the method in filter,will somebody know and pls show your precious opinion?

Nice question! Paying attention...
How to get layer size in filter?
Is it now possible to have filters as part of the filter record. It appears from this code that you can now do it out side of channeldata and could add dummy layers for use later.



This really does not match the documentation but I can find any example that really uses the following data:



int16 inLayerPlanes; /**%26lt; The number of target layer planes for the input data.

If all the input plane values are zero,

then the plug-in should assume the host has not set them.







@note When processing layer data, Photoshop structures

its input and output data for plug-ins as follows:

- target layer channels

- transparency mask for target layer

- layer mask channels for target layer

- inverted layer mask channels for target layer

- non-layer channels



The output planes are a prefix of the input planes.

For example, in the protected transparency case, the input

can contain a transparency mask and a layer mask while the

output can contain just the layerPlanes.







When processing non-layer data (including running a filter

on the layer mask alone), Photoshop structures the data

as consisting only of non-layer channels. It indicates

this structure through a series of short counts. The

transparency count must be either 0 or 1.

*/

int16 inTransparencyMask; /**%26lt; The number of transparency masks for the input target

layer data.

See @ref inLayerPlanes for additional information. */

int16 inLayerMasks; /**%26lt; The number of layer mask channels for the input

target layer.

See @ref inLayerPlanes for additional information.*/

int16 inInvertedLayerMasks; /**%26lt; The number of inverted layer mask channels for the

input target layer.



With the inverted layer masks, 0 = fully visible

and 255 = completely hidden. See @ref inLayerPlanes for

additional information.*/

int16 inNonLayerPlanes; /**%26lt; The number of non-layer channels for the input data.

See @ref inLayerPlanes for additional information. */



int16 outLayerPlanes; /**%26lt; The number of target layer planes for the output data.

See @ref inLayerPlanes for additional information about

the structure of the output data. */

int16 outTransparencyMask; /**%26lt; The number of transparency masks for the output data.

See @ref inLayerPlanes for additional information about

the structure of the output data. */

int16 outLayerMasks; /**%26lt; The number of layer mask channels for the output data.

See @ref inLayerPlanes for additional information about

the structure of the output data. */

int16 outInvertedLayerMasks; /**%26lt; The number of inverted layer mask channels for the output data.

See @ref inLayerPlanes for additional information about

the structure of the output data. */

int16 outNonLayerPlanes; /**%26lt; The number of non-layer channels for the output data.

See @ref inLayerPlanes for additional information about

the structure of the output data. */



int16 absLayerPlanes; /**%26lt; The number of target layer planes for the input data,

used for the structure of the input data when

\c wantsAbsolute is TRUE.

See @ref inLayerPlanes for additional information about

the structure of the input data. */

int16 absTransparencyMask; /**%26lt; The number of transparency masks for the input data,

used for the structure of the input data when

\c wantsAbsolute is TRUE.

See @ref inLayerPlanes for additional information about

the structure of the input data. */

int16 absLayerMasks; /**%26lt; The number of layer mask channels for the input data,

used for the structure of the input data when

\c wantsAbsolute is TRUE.

See @ref inLayerPlanes for additional information about

the structure of the input data. */

int16 absInvertedLayerMasks; /**%26lt; The number of inverted layer mask channels for the input

data, used for the structure of the input data when

\c wantsAbsolute is TRUE.

See @ref inLayerPlanes for additional information about

the structure of the input data. */

int16 absNonLayerPlanes; /**%26lt; The number of target layer planes for the input data,

used for the structure of the input data when

\c wantsAbsolute is TRUE.

See @ref inLayerPlanes for additional information about

the structure of the input data. */



/* We allow for extra planes in the input and the output. These planes

will be filled with dummyPlaneValue at those times when we build the

buffers. These features will only be available if supportsDummyPlanes

is TRUE. */



int16 inPreDummyPlanes; /**%26lt; The number of extra planes before

the input data. Only available if

\c supportsDummyChannels=TRUE. Used for

things like forcing RGB data to appear as RGBA. */

int16 inPostDummyPlanes; /**%26lt; The number of extra planes after

the input data. Only available if

\c supportsDummyChannels=TRUE. Used for

things like forcing RGB data to appear as RGBA. */



int16 outPreDummyPlanes; /**%26lt; The number of extra planes before

the output data. Only available if

\c supportsDummyChannels=TRUE. */

int16 outPostDummyPlanes; /**%26lt; The number of extra planes after

the output data. Only available if

\c supportsDummyChannels=TRUE. */

No comments:

Post a Comment