Ejemplo n.º 1
0
void CProfileDumpView::OnInitialUpdate()
{
  CIccProfile *pIcc = GetDocument()->m_pProfile;
  icHeader *pHdr = &pIcc->m_Header;
  CIccInfo Fmt;
  char buf[64];
  int n;

  m_sHdrAttributes = Fmt.GetDeviceAttrName(pHdr->attributes);
  m_sHdrCmm = icGetSig(buf, pHdr->cmmId);
  m_sHdrCreationDate.Format("%d/%d/%d  %02u:%02u:%02u",
                            pHdr->date.month, pHdr->date.day, pHdr->date.year,
                            pHdr->date.hours, pHdr->date.minutes, pHdr->date.seconds);
  m_sHdrCreator = icGetSig(buf, pHdr->creator);
  m_sHdrDataColorspace = Fmt.GetColorSpaceSigName(pHdr->colorSpace);
  m_sHdrFlags = Fmt.GetProfileFlagsName(pHdr->flags);
  m_sHdrPcsColorSpace = Fmt.GetColorSpaceSigName(pHdr->pcs);
  m_sHdrPlatform = Fmt.GetPlatformSigName(pHdr->platform);
  m_sHdrRenderingIntent = Fmt.GetRenderingIntentName((icRenderingIntent)(pHdr->renderingIntent));
  m_sHdrSize.Format("%d(0x%x) bytes", pHdr->size, pHdr->size);
  m_sHdrType = Fmt.GetProfileClassSigName(pHdr->deviceClass);
  m_sHdrVersion = Fmt.GetVersionName(pHdr->version);
  m_sHdrIlluminant.Format("X=%.4lf, Y=%.4lf, Z=%.4lf",
                          icFtoD(pHdr->illuminant.X),
                          icFtoD(pHdr->illuminant.Y),
                          icFtoD(pHdr->illuminant.Z));
  m_sHdrProfileID.Empty();
  for (n=0; n<16; n++) {
    sprintf(buf, "%02x", pHdr->profileID.ID8[n]);
    if (n && !(n%4))
      m_sHdrProfileID += " ";
    m_sHdrProfileID += buf;
  }

  CFormView::OnInitialUpdate();
  ResizeParentToFit(FALSE);

  m_listTags.InsertColumn(0, "Tag ID", LVCFMT_LEFT, 200);
  m_listTags.InsertColumn(1, "Offset", LVCFMT_RIGHT, 75);
  m_listTags.InsertColumn(2, "Size", LVCFMT_RIGHT, 75);

  int item;
  TagEntryList::iterator i;
  CString Text;

  for (n=0, i=pIcc->m_Tags->begin(); i!=pIcc->m_Tags->end(); i++, n++) {
    item = m_listTags.InsertItem(n, Fmt.GetTagSigName(i->TagInfo.sig));

    Text.Format("%d", i->TagInfo.offset);
    m_listTags.SetItemText(item, 1, Text);

    Text.Format("%d", i->TagInfo.size);
    m_listTags.SetItemText(item, 2, Text);

    m_listTags.SetItemData(item, (DWORD)i->TagInfo.sig);
  }

}
Ejemplo n.º 2
0
bool ShowTag(CIccProfile *pIcc, icTagSignature sig)
{
  CIccTag *pTag = pIcc->FindTag(sig);
  icChar buf[64];
  CIccInfo Fmt;

  std::string contents;

  if (!pTag)
    return false;

  printf("\n************ Tag Contents **************\n");

  printf("\nContents of %s tag (%s)\n", Fmt.GetTagSigName(sig), icGetSig(buf, sig)); 
  printf("Type:   ");
  if (pTag->IsArrayType()) {
    printf("Array of ");
  }
  printf("%s\n", Fmt.GetTagTypeSigName(pTag->GetType()));
  pTag->Describe(contents);
  fwrite(contents.c_str(), contents.length(), 1, stdout);

  printf("\n****************************************\n");

  return true;
}
Ejemplo n.º 3
0
void ReadTag(CIccProfile *pIcc)
{
  CIccInfo Fmt;
  icChar buf[64];

  printf("\nProfile Tags\n");
  printf(  "------------\n");

  printf("%25s    ID    %8s\t%8s\n", "Tag", "Offset", "Size");
  printf("%25s  ------  %8s\t%8s\n", "----", "------", "----");

  TagEntryList::iterator i;

  for (i=pIcc->m_Tags->begin(); i!=pIcc->m_Tags->end(); i++) {
    printf("%25s  %s  %8d\t%8d\n", Fmt.GetTagSigName(i->TagInfo.sig),
                                     icGetSig(buf, i->TagInfo.sig, false), 
                                     i->TagInfo.offset, i->TagInfo.size);
  }

  printf("\nNote: The above Offset & Size parameters DO NOT reflect any unsaved changes to profile.\n");

  printf("\nEnter the tag ID : ");
  std::string TagID;
  TagID = GetUserInput();

  if(!ShowTag(pIcc, (icTagSignature)icGetSigVal(TagID.c_str())))
    printf("Tag (%s) not found in profile\n", TagID.c_str());

}
Ejemplo n.º 4
0
void ShowHeader(CIccProfile *pIcc)
{
  icHeader *pHdr = &pIcc->m_Header;
  CIccInfo Fmt;
  icChar buf[64];

  printf("\nHeader\n");
  printf(  "------\n");
  printf("Profile Size:     %d(0x%x) bytes\n", pHdr->size, pHdr->size);
  
  if(Fmt.IsProfileIDCalculated(&pHdr->profileID))
    printf("Profile ID:        %s\n", Fmt.GetProfileID(&pHdr->profileID));
  else
    printf("Profile ID:       Profile ID not calculated.\n");
  printf("Attributes:       %s\n", Fmt.GetDeviceAttrName(pHdr->attributes));
  printf("Cmm:              %s\n", Fmt.GetCmmSigName((icCmmSignature)(pHdr->cmmId)));
  printf("Creation Date:    %d/%d/%d  %02u:%02u:%02u\n",
                            pHdr->date.month, pHdr->date.day, pHdr->date.year,
                            pHdr->date.hours, pHdr->date.minutes, pHdr->date.seconds);
  printf("Creator:          %s\n", icGetSig(buf, pHdr->creator));
  printf("Data Color Space: %s\n", Fmt.GetColorSpaceSigName(pHdr->colorSpace));
  printf("Flags             %s\n", Fmt.GetProfileFlagsName(pHdr->flags));
  printf("PCS Color Space:  %s\n", Fmt.GetColorSpaceSigName(pHdr->pcs));
  printf("Platform:         %s\n", Fmt.GetPlatformSigName(pHdr->platform));
  printf("Rendering Intent: %s\n", Fmt.GetRenderingIntentName((icRenderingIntent)(pHdr->renderingIntent)));
  printf("Type:             %s\n", Fmt.GetProfileClassSigName(pHdr->deviceClass));
  printf("Version:          %s\n", Fmt.GetVersionName(pHdr->version));
  printf("Illuminant:       X=%.4lf, Y=%.4lf, Z=%.4lf\n",
                          icFtoD(pHdr->illuminant.X),
                          icFtoD(pHdr->illuminant.Y),
                          icFtoD(pHdr->illuminant.Z));

  printf("\nProfile Tags\n");
  printf(  "------------\n");

  printf("%25s    ID    %8s\t%8s\n", "Tag", "Offset", "Size");
  printf("%25s  ------  %8s\t%8s\n", "----", "------", "----");

  TagEntryList::iterator i;

  for (i=pIcc->m_Tags->begin(); i!=pIcc->m_Tags->end(); i++) {
    printf("%25s  %s  %8d\t%8d\n", Fmt.GetTagSigName(i->TagInfo.sig),
                                     icGetSig(buf, i->TagInfo.sig, false), 
                                     i->TagInfo.offset, i->TagInfo.size);
  }

}
Ejemplo n.º 5
0
void DumpTag(CIccProfile *pIcc, icTagSignature sig)
{
  CIccTag *pTag = pIcc->FindTag(sig);
  char buf[64];
  CIccInfo Fmt;

  std::string contents;

  if (pTag) {
    printf("\nContents of %s tag (%s)\n", Fmt.GetTagSigName(sig), icGetSig(buf, sig)); 
    printf("Type:   ");
    if (pTag->IsArrayType()) {
      printf("Array of ");
    }
    printf("%s\n", Fmt.GetTagTypeSigName(pTag->GetType()));
    pTag->Describe(contents);
    fwrite(contents.c_str(), contents.length(), 1, stdout);
  }
  else {
    printf("Tag (%s) not found in profile\n", icGetSig(buf, sig));
  }
}
Ejemplo n.º 6
0
/**
******************************************************************************
* Name: CIccMpeAcs::Describe
* 
* Purpose: 
* 
* Args: 
* 
* Return: 
******************************************************************************/
void CIccMpeAcs::Describe(std::string &sDescription)
{
  icChar sigBuf[30];

  if (GetBAcsSig())
    sDescription += "ELEM_bACS\r\n";
  else
    sDescription += "ELEM_eACS\r\n";

  icGetSig(sigBuf, m_signature);
  sDescription += "  Signature = ";
  sDescription += sigBuf;
  sDescription += "\r\n";

  if (m_pData) {
    sDescription += "\r\nData Follows:\r\n";

    icMemDump(sDescription, m_pData, m_nDataSize);
  }
}
Ejemplo n.º 7
0
int main(int argc, char* argv[])
{
  int nArg = 1;

  if (argc<=1) {
print_usage:
    printf("Usage: iccDumpProfile profile {tagId to dump/\"ALL\")\n");
    return -1;
  }

  CIccProfile *pIcc;
  std::string sReport;
  icValidateStatus nStatus;

  if (!strncmp(argv[1], "-V", 2) || !strncmp(argv[1], "-v", 2)) {
    if (argc<=2)
      goto print_usage;

    nArg = 2;

    pIcc = ValidateIccProfile(argv[nArg], sReport, nStatus);
  }
  else
    pIcc = OpenIccProfile(argv[nArg]);

  if (!pIcc) {
    printf("Unable to open '%s'\n", argv[nArg]);
  }
  else {
    icHeader *pHdr = &pIcc->m_Header;
    CIccInfo Fmt;
    char buf[64];

    printf("Profile:          '%s'\n", argv[nArg]);
    if(Fmt.IsProfileIDCalculated(&pHdr->profileID))
      printf("Profile ID:        %s\n", Fmt.GetProfileID(&pHdr->profileID));
    else
      printf("Profile ID:       Profile ID not calculated.\n");
    printf("Size:             %d(0x%x) bytes\n", pHdr->size, pHdr->size);

    printf("\nHeader\n");
    printf(  "------\n");
    printf("Attributes:       %s\n", Fmt.GetDeviceAttrName(pHdr->attributes));
    printf("Cmm:              %s\n", Fmt.GetCmmSigName((icCmmSignature)(pHdr->cmmId)));
    printf("Creation Date:    %d/%d/%d  %02u:%02u:%02u\n",
                              pHdr->date.month, pHdr->date.day, pHdr->date.year,
                              pHdr->date.hours, pHdr->date.minutes, pHdr->date.seconds);
    printf("Creator:          %s\n", icGetSig(buf, pHdr->creator));
    printf("Data Color Space: %s\n", Fmt.GetColorSpaceSigName(pHdr->colorSpace));
    printf("Flags             %s\n", Fmt.GetProfileFlagsName(pHdr->flags));
    printf("PCS Color Space:  %s\n", Fmt.GetColorSpaceSigName(pHdr->pcs));
    printf("Platform:         %s\n", Fmt.GetPlatformSigName(pHdr->platform));
    printf("Rendering Intent: %s\n", Fmt.GetRenderingIntentName((icRenderingIntent)(pHdr->renderingIntent)));
    printf("Type:             %s\n", Fmt.GetProfileClassSigName(pHdr->deviceClass));
    printf("Version:          %s\n", Fmt.GetVersionName(pHdr->version));
    printf("Illuminant:       X=%.4lf, Y=%.4lf, Z=%.4lf\n",
                            icFtoD(pHdr->illuminant.X),
                            icFtoD(pHdr->illuminant.Y),
                            icFtoD(pHdr->illuminant.Z));

    printf("\nProfile Tags\n");
    printf(  "------------\n");

    printf("%25s    ID    %8s\t%8s\n", "Tag", "Offset", "Size");
    printf("%25s  ------  %8s\t%8s\n", "----", "------", "----");

    int n;
    TagEntryList::iterator i;

    for (n=0, i=pIcc->m_Tags->begin(); i!=pIcc->m_Tags->end(); i++, n++) {
      printf("%25s  %s  %8d\t%8d\n", Fmt.GetTagSigName(i->TagInfo.sig),
                                   icGetSig(buf, i->TagInfo.sig, false), 
                                   i->TagInfo.offset, i->TagInfo.size);
    }

    if (argc>nArg+1) {
      if (!stricmp(argv[nArg+1], "ALL")) {
        for (n=0, i=pIcc->m_Tags->begin(); i!=pIcc->m_Tags->end(); i++, n++) {
          DumpTag(pIcc, i->TagInfo.sig);
        }
      }
      else {
        DumpTag(pIcc, (icTagSignature)icGetSigVal(argv[nArg+1]));
      }
    }
  }

  if (nArg>1) {
    printf("\nValidation Report\n");
    printf(  "-----------------\n");
    switch (nStatus) {
    case icValidateOK:
      printf("Profile is valid\n\n");
      break;
    case icValidateWarning:
      printf("Profile has warning(s)\n\n");
      break;
    case icValidateNonCompliant:
      printf("Profile violates ICC specification\n\n");
      break;
    case icValidateCriticalError:
      printf("Profile has Critical Error(s) that violate ICC specificaiton.\n\n");
      break;
    default:
      printf("Profile has unknown status.\n\n");
      break;
    }
    fwrite(sReport.c_str(), sReport.length(), 1, stdout);
  }

  delete pIcc;
  return 0;
}