Krita Source Code Documentation
Loading...
Searching...
No Matches
RESN_INFO_1005 Struct Reference

#include <psd_resource_block.h>

+ Inheritance diagram for RESN_INFO_1005:

Public Types

enum  PSDUnit {
  PSD_UNIT_INCH = 1 , PSD_UNIT_CM = 2 , PSD_UNIT_POINT = 3 , PSD_UNIT_PICA = 4 ,
  PSD_UNIT_COLUMN = 5
}
 

Public Member Functions

bool createBlock (QByteArray &data) override
 
bool interpretBlock (QByteArray data) override
 
 RESN_INFO_1005 ()
 
- Public Member Functions inherited from PSDInterpretedResource
virtual QString displayText ()
 
virtual bool valid ()
 
virtual ~PSDInterpretedResource ()
 

Public Attributes

quint16 heightUnit
 
Fixed hRes
 
quint16 hResUnit
 
Fixed vRes
 
quint16 vResUnit
 
quint16 widthUnit
 
- Public Attributes inherited from PSDInterpretedResource
QString error
 

Additional Inherited Members

- Protected Member Functions inherited from PSDInterpretedResource
void startBlock (QBuffer &buf, PSDImageResourceSection::PSDResourceID id, quint32 size)
 

Detailed Description

Definition at line 137 of file psd_resource_block.h.

Member Enumeration Documentation

◆ PSDUnit

Enumerator
PSD_UNIT_INCH 
PSD_UNIT_CM 
PSD_UNIT_POINT 
PSD_UNIT_PICA 
PSD_UNIT_COLUMN 

Definition at line 139 of file psd_resource_block.h.

139 {
140 PSD_UNIT_INCH = 1, /* inches */
141 PSD_UNIT_CM = 2, /* cm */
142 PSD_UNIT_POINT = 3, /* points (72 points = 1 inch) */
143 PSD_UNIT_PICA = 4, /* pica ( 6 pica = 1 inch) */
144 PSD_UNIT_COLUMN = 5 /* columns ( column defined in ps prefs, default = 2.5 inches) */
145 };

Constructor & Destructor Documentation

◆ RESN_INFO_1005()

RESN_INFO_1005::RESN_INFO_1005 ( )
inline

Member Function Documentation

◆ createBlock()

bool RESN_INFO_1005::createBlock ( QByteArray & data)
overridevirtual

Reimplemented from PSDInterpretedResource.

Definition at line 330 of file psd_resource_block.cpp.

331{
332 dbgFile << "Writing RESN_INFO_1005";
333 QBuffer buf(&data);
334
336
337 // Convert to 16.16 fixed point
338 Fixed h = hRes * 65536.0 + 0.5;
339 dbgFile << "h" << h << "hRes" << hRes;
340 psdwrite(buf, h);
341 psdwrite(buf, hResUnit);
342 psdwrite(buf, widthUnit);
343
344 // Convert to 16.16 fixed point
345 Fixed v = vRes * 65536.0 + 0.5;
346 dbgFile << "v" << v << "vRes" << vRes;
347 psdwrite(buf, v);
348 psdwrite(buf, vResUnit);
349 psdwrite(buf, heightUnit);
350
351 buf.close();
352
353 return true;
354}
qreal v
void startBlock(QBuffer &buf, PSDImageResourceSection::PSDResourceID id, quint32 size)
#define dbgFile
Definition kis_debug.h:53
qint32 Fixed
Definition psd.h:31
std::enable_if_t< std::is_arithmetic< T >::value, bool > psdwrite(QIODevice &io, T v)
Definition psd_utils.h:170

References dbgFile, heightUnit, hRes, hResUnit, psdwrite(), PSDImageResourceSection::RESN_INFO, PSDInterpretedResource::startBlock(), v, vRes, vResUnit, and widthUnit.

◆ interpretBlock()

bool RESN_INFO_1005::interpretBlock ( QByteArray data)
overridevirtual

Reimplemented from PSDInterpretedResource.

Definition at line 307 of file psd_resource_block.cpp.

308{
309 dbgFile << "Reading RESN_INFO_1005";
310
311 // the resolution we set on the image should be dpi; we can also set the unit on the KisDocument.
312 QDataStream ds(data);
313 ds.setByteOrder(QDataStream::BigEndian);
314
315 ds >> hRes >> hResUnit >> widthUnit >> vRes >> vResUnit >> heightUnit;
316
317 /* Resolution always recorded as pixels / inch in a fixed point implied
318 decimal int32 with 16 bits before point and 16 after (i.e. cast as
319 double and divide resolution by 2^16 */
320 dbgFile << "hres" << hRes << "vres" << vRes;
321
322 hRes = hRes / 65536.0;
323 vRes = vRes / 65536.0;
324
326
327 return ds.atEnd();
328}

References dbgFile, heightUnit, hRes, hResUnit, vRes, vResUnit, and widthUnit.

Member Data Documentation

◆ heightUnit

quint16 RESN_INFO_1005::heightUnit

Definition at line 165 of file psd_resource_block.h.

◆ hRes

Fixed RESN_INFO_1005::hRes

Definition at line 160 of file psd_resource_block.h.

◆ hResUnit

quint16 RESN_INFO_1005::hResUnit

Definition at line 161 of file psd_resource_block.h.

◆ vRes

Fixed RESN_INFO_1005::vRes

Definition at line 163 of file psd_resource_block.h.

◆ vResUnit

quint16 RESN_INFO_1005::vResUnit

Definition at line 164 of file psd_resource_block.h.

◆ widthUnit

quint16 RESN_INFO_1005::widthUnit

Definition at line 162 of file psd_resource_block.h.


The documentation for this struct was generated from the following files: