Sunday, March 28, 2010

How to get image RGB/16????????

My problem is:%26lt;br /%26gt;1. When you start my project with Hidden. I customize it to:%26lt;br /%26gt; - get first memory address of image RGB/8 and store data of image in file ''abc.txt'':%26lt;br /%26gt;%26lt;br /%26gt;/////Code is customized/////////////////////////////////////////////////%26lt;br /%26gt;%26lt;br /%26gt;/////Declare global parameter///////%26lt;br /%26gt;#include ''PITerminology.h''%26lt;br /%26gt;#include %26lt;vector%26gt;%26lt;br /%26gt;#include %26lt;time.h%26gt;%26lt;br /%26gt;%26lt;br /%26gt;using namespace std;%26lt;br /%26gt;%26lt;br /%26gt;#define HERROR(FUNC) if (true) { error = FUNC; if (error) throw(this); } else%26lt;br /%26gt;ReadChannelDesc * readChannelDesc;/// code is customized%26lt;br /%26gt;/////end of Declare global parameter///////%26lt;br /%26gt;%26lt;br /%26gt;ReadChannelDesc * HiddenPlugin::FindChannelDesc(string %26amp; name)%26lt;br /%26gt;{%26lt;br /%26gt; ReadChannelDesc * readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetCompositeChannels;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetLayerMask;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetTransparency;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;alphaChannels;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;selection;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; return NULL;%26lt;br /%26gt;}%26lt;br /%26gt;%26lt;br /%26gt;void HiddenPlugin::Write(void)%26lt;br /%26gt;{%26lt;br /%26gt; // find out which channel we are writing to%26lt;br /%26gt; // this was already read in from the scripting parameters%26lt;br /%26gt; %26lt;br /%26gt; ReadChannelDesc * readChannelDesc = NULL;%26lt;br /%26gt; %26lt;br /%26gt; //if (channelName.empty())%26lt;br /%26gt; // readChannelDesc = FindChannelDesc(channelType);%26lt;br /%26gt; //else%26lt;br /%26gt; readChannelDesc = FindChannelDesc(channelName);%26lt;br /%26gt; if (readChannelDesc == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt; %26lt;br /%26gt;%26lt;br /%26gt; // check some things to see if we should continue%26lt;br /%26gt; if (readChannelDesc-%26gt;tileSize.v == 0)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; if (readChannelDesc-%26gt;tileSize.h == 0)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; Boolean canWrite = false;%26lt;br /%26gt; if (readChannelDesc-%26gt;writePort == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt; %26lt;br /%26gt; int32 bigError = sPSChannelProcs-%26gt;CanWrite(readChannelDesc-%26gt;writePort, %26amp;canWrite);%26lt;br /%26gt; if (bigError != 0 || !canWrite) %26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; // set up for tiling the document%26lt;br /%26gt; int32 docHeight = readChannelDesc-%26gt;bounds.bottom - readChannelDesc-%26gt;bounds.top;%26lt;br /%26gt; int32 docWidth = readChannelDesc-%26gt;bounds.right - readChannelDesc-%26gt;bounds.left;%26lt;br /%26gt; int32 tileHeight = docHeight;/*readChannelDesc-%26gt;tileSize.v;*/%26lt;br /%26gt; int32 tileWidth = docWidth;/*readChannelDesc-%26gt;tileSize.h;*/%26lt;br /%26gt; %26lt;br /%26gt; uint32 tilesVert = (tileHeight - 1 + docHeight) / tileHeight;%26lt;br /%26gt; %26lt;br /%26gt; uint32 tilesHoriz = (tileWidth - 1 + docWidth) / tileWidth;%26lt;br /%26gt;%26lt;br /%26gt; uint32 channelSize = tileHeight * tileWidth * readChannelDesc-%26gt;depth / 8;%26lt;br /%26gt;%26lt;br /%26gt; // get a buffer that we can read and write into%26lt;br /%26gt; Ptr pixelData = sPSBuffer-%26gt;New(NULL, channelSize); %26lt;br /%26gt; if (pixelData == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; // set up the PixelMemoryDesc for the channel ports suite%26lt;br /%26gt; PixelMemoryDesc pixelMemoryDesc;%26lt;br /%26gt; pixelMemoryDesc.data = pixelData;%26lt;br /%26gt; pixelMemoryDesc.colBits = readChannelDesc-%26gt;depth;%26lt;br /%26gt; pixelMemoryDesc.bitOffset = 0;%26lt;br /%26gt; pixelMemoryDesc.depth = readChannelDesc-%26gt;depth;%26lt;br /%26gt;/// Please read next

No comments:

Post a Comment