Changeset View
Changeset View
Standalone View
Standalone View
imagelib/transforms/kpTransformAutoCrop.cpp
Show First 20 Lines • Show All 532 Lines • ▼ Show 20 Line(s) | 504 | { | |||
---|---|---|---|---|---|
533 | for (const kpTransformAutoCropBorder **b = borders; *b; b++, p++) | 533 | for (const kpTransformAutoCropBorder **b = borders; *b; b++, p++) | ||
534 | { | 534 | { | ||
535 | if (!(*b)->exists ()) | 535 | if (!(*b)->exists ()) | ||
536 | continue; | 536 | continue; | ||
537 | 537 | | |||
538 | if ((*b)->isSingleColor ()) | 538 | if ((*b)->isSingleColor ()) | ||
539 | { | 539 | { | ||
540 | kpColor col = (*b)->referenceColor (); | 540 | kpColor col = (*b)->referenceColor (); | ||
541 | #if DEBUG_KP_TOOL_AUTO_CROP && 1 | | |||
542 | qCDebug(kpLogImagelib) << "\tdrawing border " << (*b)->rect () | 541 | qCDebug(kpLogImagelib) << "\tdrawing border " << (*b)->rect () | ||
543 | << " rgb=" << (int *) col.toQRgb () /* %X hack */ << endl; | 542 | << " rgb=" << (int *) col.toQRgb () /* %X hack */; | ||
544 | #endif | | |||
545 | 543 | | |||
546 | const QRect r = (*b)->rect (); | 544 | const QRect r = (*b)->rect (); | ||
547 | kpPainter::fillRect (&image, | 545 | kpPainter::fillRect (&image, | ||
548 | r.x (), r.y (), r.width (), r.height (), | 546 | r.x (), r.y (), r.width (), r.height (), | ||
549 | col); | 547 | col); | ||
550 | } | 548 | } | ||
551 | else | 549 | else | ||
552 | { | 550 | { | ||
553 | #if DEBUG_KP_TOOL_AUTO_CROP && 1 | | |||
554 | qCDebug(kpLogImagelib) << "\trestoring border image " << (*b)->rect (); | 551 | qCDebug(kpLogImagelib) << "\trestoring border image " << (*b)->rect (); | ||
555 | #endif | | |||
556 | if (*p) | 552 | if (*p) | ||
557 | { | 553 | { | ||
558 | // REFACTOR: Add equivalent method to kpPainter and use. | 554 | // REFACTOR: Add equivalent method to kpPainter and use. | ||
559 | kpPixmapFX::setPixmapAt (&image, (*b)->rect (), **p); | 555 | kpPixmapFX::setPixmapAt (&image, (*b)->rect (), **p); | ||
560 | } | 556 | } | ||
561 | } | 557 | } | ||
562 | } | 558 | } | ||
563 | 559 | | |||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 655 | if (!leftBorder.calculate (true/*x*/, +1/*going right*/) || | |||
664 | topBorder.fillsEntireImage () || | 660 | topBorder.fillsEntireImage () || | ||
665 | !botBorder.calculate (false/*y*/, -1/*going up*/) || | 661 | !botBorder.calculate (false/*y*/, -1/*going up*/) || | ||
666 | botBorder.fillsEntireImage () || | 662 | botBorder.fillsEntireImage () || | ||
667 | ((numRegions = leftBorder.exists () + | 663 | ((numRegions = leftBorder.exists () + | ||
668 | rightBorder.exists () + | 664 | rightBorder.exists () + | ||
669 | topBorder.exists () + | 665 | topBorder.exists () + | ||
670 | botBorder.exists ()) == 0)) | 666 | botBorder.exists ()) == 0)) | ||
671 | { | 667 | { | ||
672 | #if DEBUG_KP_TOOL_AUTO_CROP | | |||
673 | qCDebug(kpLogImagelib) << "\tcan't find border; leftBorder.rect=" << leftBorder.rect () | 668 | qCDebug(kpLogImagelib) << "\tcan't find border; leftBorder.rect=" << leftBorder.rect () | ||
674 | << " rightBorder.rect=" << rightBorder.rect () | 669 | << " rightBorder.rect=" << rightBorder.rect () | ||
675 | << " topBorder.rect=" << topBorder.rect () | 670 | << " topBorder.rect=" << topBorder.rect () | ||
676 | << " botBorder.rect=" << botBorder.rect () | 671 | << " botBorder.rect=" << botBorder.rect (); | ||
677 | << endl; | | |||
678 | #endif | | |||
679 | ::ShowNothingToAutocropMessage (mainWindow, static_cast<bool> (doc->selection ())); | 672 | ::ShowNothingToAutocropMessage (mainWindow, static_cast<bool> (doc->selection ())); | ||
680 | return false; | 673 | return false; | ||
681 | } | 674 | } | ||
682 | 675 | | |||
683 | qCDebug(kpLogImagelib) << "\tnumRegions=" << numRegions; | 676 | qCDebug(kpLogImagelib) << "\tnumRegions=" << numRegions; | ||
684 | qCDebug(kpLogImagelib) << "\t\tleft=" << leftBorder.rect () | 677 | qCDebug(kpLogImagelib) << "\t\tleft=" << leftBorder.rect () | ||
685 | << " refCol=" << (leftBorder.exists () ? (int *) leftBorder.referenceColor ().toQRgb () : 0) | 678 | << " refCol=" << (leftBorder.exists () ? (int *) leftBorder.referenceColor ().toQRgb () : 0) | ||
686 | << " avgCol=" << (leftBorder.exists () ? (int *) leftBorder.averageColor ().toQRgb () : 0) | 679 | << " avgCol=" << (leftBorder.exists () ? (int *) leftBorder.averageColor ().toQRgb () : 0) | ||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |