400{
401 Q_UNUSED(image_ID);
402 short brush_type;
403 qint32 brush_size;
404 qint32 next_brush;
405
406 qint32 top, left, bottom, right;
408 char compression;
410
411 qint32 width, height;
413
414 qint32 layer_ID = -1;
415 char *buffer;
416
417
418 abr >> brush_type;
419
420 abr >> brush_size;
421 next_brush = abr.device()->pos() + brush_size;
422
423 if (brush_type == 1) {
424
425
426 warnKrita <<
"WARNING: computed brush unsupported, skipping.";
427 abr.device()->seek(abr.device()->pos() + next_brush);
428
429 }
430 else if (brush_type == 2) {
431
432
433 abr.device()->seek(abr.device()->pos() + 6);
434
439 }
440
441
442 abr.device()->seek(abr.device()->pos() + 9);
443
444
445 abr >> top;
446 abr >> left;
447 abr >> bottom;
448 abr >> right;
449
451
452 abr.device()->getChar(&compression);
453
454 width = right - left;
455 height = bottom - top;
457
458
459 if (height > 16384) {
460 warnKrita <<
"WARNING: wide brushes not supported";
461 abr.device()->seek(next_brush);
462 }
463 else {
464 buffer = (char*)malloc(size);
465
466 if (!compression) {
467
468 abr.readRawData(buffer, size);
469 } else {
471 }
472
477 }
478 else {
480 QBuffer buf;
481 buf.open(QFile::ReadWrite);
482 brushTipImage.save(&buf, "PNG");
484 }
485
486 abrBrush->setBrushTipImage(brushTipImage);
487
488 abrBrush->setValid(true);
489 abrBrush->setName(name);
491 layer_ID = 1;
492 }
493 }
494 else {
495 warnKrita <<
"Unknown ABR brush type, skipping.";
496 abr.device()->seek(next_brush);
497 }
498
499 return layer_ID;
500}
static QString generateHash(const QString &filename)
generateHash reads the given file and generates a hex-encoded md5sum for the file.
static QString abr_v1_brush_name(const QString filename, qint32 id)
static QString abr_read_ucs2_text(QDataStream &abr)
static QImage convertToQImage(char *buffer, qint32 width, qint32 height)
save the QImages as png files to directory image_tests
static qint32 rle_decode(QDataStream &abr, char *buffer, qint32 height)
const char * name(StandardAction id)
int size(const Forest< T > &forest)
int depth(typename Forest< T >::const_child_iterator beginIt, typename Forest< T >::const_child_iterator endIt)