• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Format plugin: simultaneous layers & channels support

Contributor ,
Nov 11, 2010 Nov 11, 2010

Copy link to clipboard

Copied

I hate to bring up this question again, but it seems that the previous discussion (titled "How can I see the alpha channel in the channels palette?") while mentioning the issue didn't really clarify it.

Our format filters create documents that theoretically may contain layers and channels; so far we only had cases when either one or another was required and therefore having FormatLayerSupport { doesSupportFormatLayers } in PIPL was sufficient to create layers while using gFormatRecord->planes allowed us to create multiple channels (apropo, in our case the channels have nothing to do with transparency and are actual data bands). Now we ran into a situation where a new format may contain one or more layers (therefore, FormatLayerSupport is added in PIPL) and multiple document-level bands, and we cannot make the two to  coexist successfully.

We see a few issues:

1) one is mentioned in the above discussion by Chris as a possible bug and its the fact that the last channel is always used as a transparency regardless of gFormatRecord->transparencyPlane setting. This is of course pretty irritating but its something we can probably get away with.

2) the second one seems to be much more serious: what we see is that if there are non-background layers in the document, Photoshop will add the requested channels but they always appear to be solid black, despite having proper data set for them. Commenting out FormatLayerSupport line or forcing CS5 to create background layer only immediately brings the alpha channels' data back.

The snippet of code from the SimplePlugin example slightly modified to handle layers:

    gFormatRecord->depth = header.depth;
    gFormatRecord->planes = header.planes;
    gFormatRecord->transparencyPlane = -1; // we don't want any trasparency
    gFormatRecord->transparencyMatting = 0; //DESIREDMATTING;
    gFormatRecord->layerData = 0; // ivar: no layers - only works in CS5
    gFormatRecord->isVisible = 1;

The result (correct):

NoLayers.jpg

There is only a background layer and there are 7 channels and Aplha 1  and Alpha 3 are white (all correct).

Now lets make a tiny change in the above example:

    gFormatRecord->layerData = 1; // ivar: ok, now there are layers

The result:

WithLayers.jpg

There is one non-background layer (correct); theoretically are still 7 channels (still correct), but what used to be the last one  (Alpha 4 in the previous figure with the "3" shape) is now invisible and is used as a trasparency that is applied to all RGB channels (bug 1); more importantly, ALL the non-RGB channels are now black (bug 2)!

A couple of questions:

a) is there anyhting we are doing wrong and if not is there ANY way to support both layers and (non-solid black ) channels in a document simultaneously?

b) if not, the first example provides a partial workaround for the case when the format theoretically may have layers (therefore FormatLayerSupport is set), but in fact it only has one and it can be used as a background, in which case channels however this seems to only work on CS5; setting gFormatRecord->layerData = 0 makes the reader completely fail in CS34 and CS4. Is there a way to tell Photoshop CS3/4 _in the code to create only a background layer if the PIPL specifies FormatLayerSuppor?

Thanks in advance!

ivar

TOPICS
SDK

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Contributor ,
Dec 07, 2010 Dec 07, 2010

Copy link to clipboard

Copied

Tom, Chris, any words of (Adobe) wisdom about it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2010 Dec 10, 2010

Copy link to clipboard

Copied

LATEST

I find the plane uses as transparent ( FormatRecord:: transparentPlane )  will not appear in the channel panel.

for example ,if you open one image in PNG format, the only RGB channels are visible, without any alpha channel.

I handle this problem in such way, make the transparent channel an fully copy,

and it seemed you must feed all the planes to photoshop in one summit request.

for example, if you want see the transparent channel as a alpha channel to appear, you will give ps more than one plane,

the alpha's copy, as an common plane.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines