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

#include <psd_additional_layer_info_block.h>

Public Member Functions

bool canMakeParametricShape ()
 
QDomDocument getASL ()
 
void OriginalSizeAndAngle (QSizeF &size, double &angle)
 
void setOriginBoxCorners (QPointF p)
 
void setOriginPolySides (int sides)
 
void setOriginPolyStarRatio (double ratio)
 
void setOriginPolyTightBoxCorners (QPointF p)
 
void setOriginPolyTrueRectCorners (QPointF p)
 
void setOriginResolution (double res)
 
void setOriginShapeBBox (QRectF ShapeBBox)
 
void setOriginType (int type)
 
void setTransform (QTransform t)
 
QString shapeName ()
 

Static Public Member Functions

static void setupCatcher (const QString path, KisAslCallbackObjectCatcher &catcher, psd_vector_origination_data *data)
 

Public Attributes

bool isStar = false
 
QPolygonF originBoxCorners
 post-transform bbox as a polygon, seen on 1, 7, 8 and 9.
 
int originIndex = 0
 
double originPolyPixelHSF = 1.0
 Only 7 and 8, no clue.
 
QPolygonF originPolyPreviousTightBoxCorners
 Only 7 an 8, same as originBoxCorners.
 
int originPolySides = 0
 Only for 7 and 8.
 
double originPolyStarRatio = 100.0
 Only for 8, percentage of small radius to big radius.
 
QPolygonF originPolyTrueRectCorners
 Only 7 an 8, same as originBoxCorners.
 
double originResolution = 72.0
 Resolution of the coordinates.
 
QRectF originShapeBBox
 pre-transform bbox.
 
int originType = -1
 1 = rect, 2 = rounded rect?, 3 = ? 4 = ? 5 = ellipse, 6 = ?, 7 = polygon, 8 = star, 9 = premade path shape.
 
QTransform transform
 
const QMap< int, QString > typeToName
 

Detailed Description

Definition at line 1190 of file psd_additional_layer_info_block.h.

Member Function Documentation

◆ canMakeParametricShape()

bool psd_vector_origination_data::canMakeParametricShape ( )
inline

Definition at line 1319 of file psd_additional_layer_info_block.h.

1319 {
1320 bool p = !shapeName().isEmpty();
1321 return p;
1322 }
const Params2D p

References p, and shapeName().

◆ getASL()

QDomDocument psd_vector_origination_data::getASL ( )
inline

Definition at line 1274 of file psd_additional_layer_info_block.h.

1274 {
1276 w.enterDescriptor("", "", "null");
1277
1278 w.enterList("keyDescriptorList");
1279
1280 w.enterDescriptor("", "", "null");
1281
1282 w.writeInteger("keyOriginType", originType);
1283 w.writeDouble("keyOriginResolution", originResolution);
1284
1285 if (originType == 1 || originType == 5) {
1286 w.writeUnitRect("keyOriginShapeBBox", "#Pxl", originShapeBBox);
1287 w.writePointRect("keyOriginBoxCorners", originBoxCorners);
1288 } else if (originType == 7 || originType == 8) {
1289 w.writeInteger("keyOriginPolySides", originPolySides);
1290 if (originPolyStarRatio != 100) {
1291 w.writeUnitFloat("keyOriginPolyStarRatio", "#Prc", originPolyStarRatio);
1292 }
1293 w.writePointRect("keyOriginBoxCorners", originBoxCorners);
1294 w.writeFloatRect("keyOriginShapeBBox", originShapeBBox);
1295 w.writePointRect("keyOriginPolyPreviousTightBoxCorners", originBoxCorners);
1296 w.writePointRect("keyOriginPolyTrueRectCorners", originBoxCorners);
1297 w.writeDouble("keyOriginPolyPixelHSF", 1);
1298 }
1299
1300 w.writeTransform("Trnf", transform);
1301
1302 w.writeInteger("keyOriginIndex", originIndex);
1303
1304 w.leaveDescriptor();
1305
1306 w.leaveList();
1307
1308 w.leaveDescriptor();
1309
1310 return w.document();
1311 }
int originType
1 = rect, 2 = rounded rect?, 3 = ? 4 = ? 5 = ellipse, 6 = ?, 7 = polygon, 8 = star,...
double originResolution
Resolution of the coordinates.
QPolygonF originBoxCorners
post-transform bbox as a polygon, seen on 1, 7, 8 and 9.
double originPolyStarRatio
Only for 8, percentage of small radius to big radius.

References originBoxCorners, originIndex, originPolySides, originPolyStarRatio, originResolution, originShapeBBox, originType, and transform.

◆ OriginalSizeAndAngle()

void psd_vector_origination_data::OriginalSizeAndAngle ( QSizeF & size,
double & angle )
inline

For some reason, instead of putting the whole transformation into the transform, PSD instead creates a list points that represents the transformed bounding box. To get the original width and height and angle, one must first untransform this polygon and use it to determine the appropriate values.

Definition at line 1331 of file psd_additional_layer_info_block.h.

1331 {
1332 size = originShapeBBox.size();
1333 angle = QLineF(originShapeBBox.topLeft(), originShapeBBox.topRight()).angle();
1334 if (originBoxCorners.size() == 4) {
1335 QPolygonF poly = transform.inverted().map(originBoxCorners);
1336 angle = QLineF(poly.first(), poly.value(1)).angle();
1337 double w = QLineF(poly.first(), poly.value(1)).length();
1338 double h = QLineF(poly.first(), poly.value(3)).length();
1339 size = QSizeF(w, h);
1340 }
1341 }
int size(const Forest< T > &forest)
Definition KisForest.h:1232

References originBoxCorners, originShapeBBox, and transform.

◆ setOriginBoxCorners()

void psd_vector_origination_data::setOriginBoxCorners ( QPointF p)
inline

Definition at line 1228 of file psd_additional_layer_info_block.h.

1228 {
1229 originBoxCorners.append(p);
1230 }

References originBoxCorners, and p.

◆ setOriginPolySides()

void psd_vector_origination_data::setOriginPolySides ( int sides)
inline

Definition at line 1238 of file psd_additional_layer_info_block.h.

1238 {
1239 originPolySides = sides;
1240 }

References originPolySides.

◆ setOriginPolyStarRatio()

void psd_vector_origination_data::setOriginPolyStarRatio ( double ratio)
inline

Definition at line 1242 of file psd_additional_layer_info_block.h.

1242 {
1243 originPolyStarRatio = ratio;
1244 isStar = true;
1245 }

References isStar, and originPolyStarRatio.

◆ setOriginPolyTightBoxCorners()

void psd_vector_origination_data::setOriginPolyTightBoxCorners ( QPointF p)
inline

Definition at line 1231 of file psd_additional_layer_info_block.h.

1231 {
1233 }
QPolygonF originPolyPreviousTightBoxCorners
Only 7 an 8, same as originBoxCorners.

References originPolyPreviousTightBoxCorners, and p.

◆ setOriginPolyTrueRectCorners()

void psd_vector_origination_data::setOriginPolyTrueRectCorners ( QPointF p)
inline

Definition at line 1234 of file psd_additional_layer_info_block.h.

1234 {
1236 }
QPolygonF originPolyTrueRectCorners
Only 7 an 8, same as originBoxCorners.

References originPolyTrueRectCorners, and p.

◆ setOriginResolution()

void psd_vector_origination_data::setOriginResolution ( double res)
inline

Definition at line 1217 of file psd_additional_layer_info_block.h.

1217 {
1218 originResolution = res;
1219 }

References originResolution.

◆ setOriginShapeBBox()

void psd_vector_origination_data::setOriginShapeBBox ( QRectF ShapeBBox)
inline

Definition at line 1225 of file psd_additional_layer_info_block.h.

1225 {
1226 originShapeBBox = ShapeBBox;
1227 }

References originShapeBBox.

◆ setOriginType()

void psd_vector_origination_data::setOriginType ( int type)
inline

Definition at line 1213 of file psd_additional_layer_info_block.h.

1213 {
1214 originType = type;
1215 }

References originType.

◆ setTransform()

void psd_vector_origination_data::setTransform ( QTransform t)
inline

Definition at line 1221 of file psd_additional_layer_info_block.h.

1221 {
1222 transform = t;
1223 }

References transform.

◆ setupCatcher()

static void psd_vector_origination_data::setupCatcher ( const QString path,
KisAslCallbackObjectCatcher & catcher,
psd_vector_origination_data * data )
inlinestatic

Definition at line 1247 of file psd_additional_layer_info_block.h.

1247 {
1248 QString descriptorPath = path+"/keyDescriptorList/null";
1249 catcher.subscribeInteger(descriptorPath + "/keyOriginType", std::bind(&psd_vector_origination_data::setOriginType, data, std::placeholders::_1));
1250 catcher.subscribeDouble(descriptorPath + "/keyOriginResolution", std::bind(&psd_vector_origination_data::setOriginResolution, data, std::placeholders::_1));
1251 catcher.subscribeTransform(descriptorPath + "/Trnf", std::bind(&psd_vector_origination_data::setTransform, data, std::placeholders::_1));
1252 catcher.subscribeUnitRect(descriptorPath + "/keyOriginShapeBBox", "#Pxl", std::bind(&psd_vector_origination_data::setOriginShapeBBox, data, std::placeholders::_1));
1253
1254 catcher.subscribePoint(descriptorPath + "/keyOriginBoxCorners/rectangleCornerA", std::bind(&psd_vector_origination_data::setOriginBoxCorners, data, std::placeholders::_1));
1255 catcher.subscribePoint(descriptorPath + "/keyOriginBoxCorners/rectangleCornerB", std::bind(&psd_vector_origination_data::setOriginBoxCorners, data, std::placeholders::_1));
1256 catcher.subscribePoint(descriptorPath + "/keyOriginBoxCorners/rectangleCornerC", std::bind(&psd_vector_origination_data::setOriginBoxCorners, data, std::placeholders::_1));
1257 catcher.subscribePoint(descriptorPath + "/keyOriginBoxCorners/rectangleCornerD", std::bind(&psd_vector_origination_data::setOriginBoxCorners, data, std::placeholders::_1));
1258
1259 catcher.subscribePoint(descriptorPath + "/keyOriginPolyPreviousTightBoxCorners/rectangleCornerA", std::bind(&psd_vector_origination_data::setOriginPolyTightBoxCorners, data, std::placeholders::_1));
1260 catcher.subscribePoint(descriptorPath + "/keyOriginPolyPreviousTightBoxCorners/rectangleCornerB", std::bind(&psd_vector_origination_data::setOriginPolyTightBoxCorners, data, std::placeholders::_1));
1261 catcher.subscribePoint(descriptorPath + "/keyOriginPolyPreviousTightBoxCorners/rectangleCornerC", std::bind(&psd_vector_origination_data::setOriginPolyTightBoxCorners, data, std::placeholders::_1));
1262 catcher.subscribePoint(descriptorPath + "/keyOriginPolyPreviousTightBoxCorners/rectangleCornerD", std::bind(&psd_vector_origination_data::setOriginPolyTightBoxCorners, data, std::placeholders::_1));
1263
1264 catcher.subscribePoint(descriptorPath + "/keyOriginPolyTrueRectCorners/rectangleCornerA", std::bind(&psd_vector_origination_data::setOriginPolyTrueRectCorners, data, std::placeholders::_1));
1265 catcher.subscribePoint(descriptorPath + "/keyOriginPolyTrueRectCorners/rectangleCornerB", std::bind(&psd_vector_origination_data::setOriginPolyTrueRectCorners, data, std::placeholders::_1));
1266 catcher.subscribePoint(descriptorPath + "/keyOriginPolyTrueRectCorners/rectangleCornerC", std::bind(&psd_vector_origination_data::setOriginPolyTrueRectCorners, data, std::placeholders::_1));
1267 catcher.subscribePoint(descriptorPath + "/keyOriginPolyTrueRectCorners/rectangleCornerD", std::bind(&psd_vector_origination_data::setOriginPolyTrueRectCorners, data, std::placeholders::_1));
1268
1269 catcher.subscribeInteger(descriptorPath + "/keyOriginPolySides", std::bind(&psd_vector_origination_data::setOriginPolySides, data, std::placeholders::_1));
1270 catcher.subscribeUnitFloat(descriptorPath + "/keyOriginPolyStarRatio", "#Prc", std::bind(&psd_vector_origination_data::setOriginPolyStarRatio, data, std::placeholders::_1));
1271
1272 }
void subscribeDouble(const QString &path, ASLCallbackDouble callback)
void subscribeInteger(const QString &path, ASLCallbackInteger callback)
void subscribeUnitRect(const QString &path, const QString &unit, ASLCallbackRect callback)
void subscribeUnitFloat(const QString &path, const QString &unit, ASLCallbackDouble callback)
void subscribePoint(const QString &path, ASLCallbackPoint callback)
void subscribeTransform(const QString &path, ASLCallbackTransform callback)

References setOriginBoxCorners(), setOriginPolySides(), setOriginPolyStarRatio(), setOriginPolyTightBoxCorners(), setOriginPolyTrueRectCorners(), setOriginResolution(), setOriginShapeBBox(), setOriginType(), setTransform(), KisAslCallbackObjectCatcher::subscribeDouble(), KisAslCallbackObjectCatcher::subscribeInteger(), KisAslCallbackObjectCatcher::subscribePoint(), KisAslCallbackObjectCatcher::subscribeTransform(), KisAslCallbackObjectCatcher::subscribeUnitFloat(), and KisAslCallbackObjectCatcher::subscribeUnitRect().

◆ shapeName()

QString psd_vector_origination_data::shapeName ( )
inline

Definition at line 1315 of file psd_additional_layer_info_block.h.

1315 {
1316 return typeToName.value(originType, QString());
1317 }

References originType, and typeToName.

Member Data Documentation

◆ isStar

bool psd_vector_origination_data::isStar = false

Definition at line 1208 of file psd_additional_layer_info_block.h.

◆ originBoxCorners

QPolygonF psd_vector_origination_data::originBoxCorners

post-transform bbox as a polygon, seen on 1, 7, 8 and 9.

Definition at line 1205 of file psd_additional_layer_info_block.h.

◆ originIndex

int psd_vector_origination_data::originIndex = 0

Definition at line 1203 of file psd_additional_layer_info_block.h.

◆ originPolyPixelHSF

double psd_vector_origination_data::originPolyPixelHSF = 1.0

Only 7 and 8, no clue.

Definition at line 1209 of file psd_additional_layer_info_block.h.

◆ originPolyPreviousTightBoxCorners

QPolygonF psd_vector_origination_data::originPolyPreviousTightBoxCorners

Only 7 an 8, same as originBoxCorners.

Definition at line 1210 of file psd_additional_layer_info_block.h.

◆ originPolySides

int psd_vector_origination_data::originPolySides = 0

Only for 7 and 8.

Definition at line 1206 of file psd_additional_layer_info_block.h.

◆ originPolyStarRatio

double psd_vector_origination_data::originPolyStarRatio = 100.0

Only for 8, percentage of small radius to big radius.

Definition at line 1207 of file psd_additional_layer_info_block.h.

◆ originPolyTrueRectCorners

QPolygonF psd_vector_origination_data::originPolyTrueRectCorners

Only 7 an 8, same as originBoxCorners.

Definition at line 1211 of file psd_additional_layer_info_block.h.

◆ originResolution

double psd_vector_origination_data::originResolution = 72.0

Resolution of the coordinates.

Definition at line 1201 of file psd_additional_layer_info_block.h.

◆ originShapeBBox

QRectF psd_vector_origination_data::originShapeBBox

pre-transform bbox.

Definition at line 1200 of file psd_additional_layer_info_block.h.

◆ originType

int psd_vector_origination_data::originType = -1

1 = rect, 2 = rounded rect?, 3 = ? 4 = ? 5 = ellipse, 6 = ?, 7 = polygon, 8 = star, 9 = premade path shape.

Definition at line 1191 of file psd_additional_layer_info_block.h.

◆ transform

QTransform psd_vector_origination_data::transform

Definition at line 1202 of file psd_additional_layer_info_block.h.

◆ typeToName

const QMap<int, QString> psd_vector_origination_data::typeToName
Initial value:
{
{1, "RectangleShape"},
{5, "EllipseShape"},
{7, "StarShape"},
{8, "StarShape"},
}

Definition at line 1193 of file psd_additional_layer_info_block.h.

1193 {
1194 {1, "RectangleShape"},
1195 {5, "EllipseShape"},
1196 {7, "StarShape"},
1197 {8, "StarShape"},
1198 };

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