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

How can I dispaly alpha Channels to proxy and show transparency correctly?

New Here ,
Dec 30, 2010 Dec 30, 2010

Copy link to clipboard

Copied

Hi all! I have a problem. Please help me. Thank you very much.
I want to display alpha Channels to proxy and show transparency correctly. I have get the datas of alpha Channels and RGB color. Following are the codes:
**************************************************************************************************************
void HiddenData::PaintPreview()
{
if( !channelData ) return;
PSPixelMap pixels;
int spotChannelCount = gFilterRecord->documentInfo->alphaChannelCount;
pixels.version       = ( spotChannelCount > 0 ) ? 2 : 1;
pixels.bounds.left   = proxyRect.left;
pixels.bounds.right  = proxyRect.right;
pixels.bounds.top    = proxyRect.top;
pixels.bounds.bottom = proxyRect.bottom;
int32 proxyWidth  = proxyRect.right - proxyRect.left;
int32 proxyHeight = proxyRect.bottom - proxyRect.top;
pixels.imageMode     = gFilterRecord->documentInfo->imageMode;
pixels.rowBytes      = proxyWidth * gFilterRecord->documentInfo->depth / 8;
pixels.colBytes   = 1;
pixels.planeBytes    = proxyWidth * proxyHeight;
pixels.baseAddr   = channelData;

// new for version 2 of PSPixelMap
PSPixelOverlay* overlay = NULL;
if( spotChannelCount > 0 ){
  overlay = new PSPixelOverlay[ spotChannelCount ];
  if( overlay ){
   int j = 0;
   for( int i = 0; i < spotChannelCount; i++ ){
    overlay.data = channelData + pixels.planeBytes * (4 + i);
    overlay.rowBytes = pixels.rowBytes;
    overlay.colBytes = 1;
    overlay.r = (unsigned8)spotColorList[j++];
    overlay.g = (unsigned8)spotColorList[j++];
    overlay.b = (unsigned8)spotColorList[j++];
    overlay.opacity = 50 * 2.55;
    overlay.overlayAlgorithm = kStandardAlphaOverlay;
    overlay.next = ( i == (spotChannelCount - 1)) ? NULL : overlay + i + 1;
   }
   pixels.pixelOverlays = overlay;
   pixels.colorManagementOptions = kViewAsStandardRGB/*kViewAsMask*/;
  }
}
pixels.mat = NULL;
pixels.masks = NULL;
pixels.maskPhaseRow = 0;
pixels.maskPhaseCol = 0;
(gFilterRecord->displayPixels)(&pixels, &pixels.bounds, 0, 0, (void *)hdc);
delete[] overlay;
}
***********************************************************************************************************
But there is a problem.The image of alpha Channels in proxy is not clear, because overlay.opacity = 50 * 2.55.
It looks like  diffrent from displaying in photoshop.I do not know how to use pixels.mat and pixels.masks.
Thanks!
TOPICS
SDK

Views

1.5K

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
Participant ,
Dec 31, 2010 Dec 31, 2010

Copy link to clipboard

Copied

I have published working code for this; see: http://telegraphics.com.au/svn/filterfoundry/trunk/preview.c

You can find the related plugin, Filter Foundry, at http://telegraphics.com.au/sw/#filterfoundry

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
New Here ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

Hi! Thanks for your reply.But I can not find how to display alpha channels to proxy in your example.What about transparency?. Can you tell me?

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
Participant ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

Alpha handling is all there in the code. Download and run the plugin to see it in action.

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
New Here ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

I run the plugin. But It can not show alpha channels. Can you show the code in your example clearly.Thanks! Following are the frames.

The original document:                                 

1.jpg

The result:

2.jpg

Can not show the alpha channels.

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
Participant ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

Your image is CMYK.

FilterFoundry renders RGB+A proxy images, not CMYK+A which I've never attempted. If it's possible at all, then it should be a simple adaptation of this code.

To see the rendering of alpha with RGB, take an image with one non-background layer and run the plugin again. The fourth box will be the expression for Alpha; enter some value of intermediate opacity, e.g. 128

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
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

I think he's talking about alpha channels and spot color channels, not transparency/opacity.

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
New Here ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

Hi, Chris.I have get the datas of CMYK channels and alpha channels in a Filter plugin. And also get RGB value and opacity(=50%) for each of alpha channels.

I think you have seen the code above.The problem is how to handle opacity of  alpha channels.The image of alpha channels proxy looks like different from

which displayed in ps.It is not clear becase opacity=50%.Can you tell me how to solve this problem.Thanks!

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
Jan 04, 2011 Jan 04, 2011

Copy link to clipboard

Copied

I'm actually not sure - I've never tried to display alpha channels in an SDK plugin, just color and transparency.

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
New Here ,
Jan 04, 2011 Jan 04, 2011

Copy link to clipboard

Copied

LATEST

Thanks all the same. Can you give me some code about how to handle color and transparency on proxy?

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
New Here ,
Jan 03, 2011 Jan 03, 2011

Copy link to clipboard

Copied

I try another document.Can not see any alpha channel on proxy. Your plugin just show the channels of selected layer ,and only can select one layer a time.The alpha channels are not in layers.How can you get and display the alpha channels. I use PSPixelOverlay to show alpha channels, but I can not see PSPixelOverlay in your code.Can we show The datas of alpha channels without PSPixelOverlay. what datas shall be fill to masks, the data of transparency?

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