MCPcopy Create free account
hub / github.com/ImpulseAdventure/JPEGsnoop / DecodePsd

Method DecodePsd

PsDecode.cpp:83–119  ·  view source on GitHub ↗

Determine if the file is a Photoshop PSD If so, parse the headers. Generally want to start at start of file (nPos=0).

Source from the content-addressed store, hash-verified

81// Determine if the file is a Photoshop PSD
82// If so, parse the headers. Generally want to start at start of file (nPos=0).
83bool CPsDecode::DecodePsd(unsigned long nPos)
84{
85 CString strTmp;
86
87 m_bPsd = false;
88
89 CString strSig;
90 unsigned nVer;
91
92 strSig = m_pWBuf->BufReadStrn(nPos,4); nPos+=4;
93 nVer = m_pWBuf->BufX(nPos,2,PS_BSWAP); nPos+=2;
94 if ((strSig == _T("8BPS")) && (nVer == 1)) {
95 m_bPsd = true;
96 m_pLog->AddLine(_T(""));
97 m_pLog->AddLineHdr(_T("*** Photoshop PSD File Decoding ***"));
98 m_pLog->AddLine(_T("Decoding Photoshop format..."));
99 m_pLog->AddLine(_T(""));
100 } else {
101 return false;
102 }
103
104 // Rewind back to header (signature)
105 nPos-=6;
106
107 PhotoshopParseFileHeader(nPos,3);
108 PhotoshopParseColorModeSection(nPos,3);
109 PhotoshopParseImageResourcesSection(nPos,3);
110
111 // TODO: Handle other sections here
112 // - Layer and Mask info
113 // - Image Data
114 PhotoshopParseReportNote(3,_T("..."));
115 PhotoshopParseReportNote(3,_T(""));
116
117 return true;
118
119}
120
121
122// Locate a field ID in the constant 8BIM / Image Resource array

Callers

nothing calls this directly

Calls 4

BufReadStrnMethod · 0.80
BufXMethod · 0.80
AddLineMethod · 0.80
AddLineHdrMethod · 0.80

Tested by

no test coverage detected