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): 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: 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
... View more