Changeset View
Changeset View
Standalone View
Standalone View
libs/libkis/Document.cpp
Show First 20 Lines • Show All 481 Lines • ▼ Show 20 Line(s) | |||||
482 | { | 482 | { | ||
483 | if (!d->document) return; | 483 | if (!d->document) return; | ||
484 | if (!d->document->image()) return; | 484 | if (!d->document->image()) return; | ||
485 | d->document->image()->flatten(0); | 485 | d->document->image()->flatten(0); | ||
486 | } | 486 | } | ||
487 | 487 | | |||
488 | void Document::resizeImage(int x, int y, int w, int h) | 488 | void Document::resizeImage(int x, int y, int w, int h) | ||
489 | { | 489 | { | ||
490 | ENTER_FUNCTION(); | ||||
490 | if (!d->document) return; | 491 | if (!d->document) return; | ||
491 | KisImageSP image = d->document->image(); | 492 | KisImageSP image = d->document->image(); | ||
492 | if (!image) return; | 493 | if (!image) return; | ||
493 | QRect rc; | 494 | QRect rc; | ||
494 | rc.setX(x); | 495 | rc.setX(x); | ||
495 | rc.setY(y); | 496 | rc.setY(y); | ||
496 | rc.setWidth(w); | 497 | rc.setWidth(w); | ||
497 | rc.setHeight(h); | 498 | rc.setHeight(h); | ||
498 | 499 | | |||
499 | image->resizeImage(rc); | 500 | image->resizeImage(rc); | ||
500 | } | 501 | } | ||
501 | 502 | | |||
502 | void Document::scaleImage(int w, int h, int xres, int yres, QString strategy) | 503 | void Document::scaleImage(int w, int h, int xres, int yres, QString strategy) | ||
503 | { | 504 | { | ||
505 | ENTER_FUNCTION(); | ||||
504 | if (!d->document) return; | 506 | if (!d->document) return; | ||
505 | KisImageSP image = d->document->image(); | 507 | KisImageSP image = d->document->image(); | ||
506 | if (!image) return; | 508 | if (!image) return; | ||
507 | QRect rc = image->bounds(); | 509 | QRect rc = image->bounds(); | ||
508 | rc.setWidth(w); | 510 | rc.setWidth(w); | ||
509 | rc.setHeight(h); | 511 | rc.setHeight(h); | ||
510 | 512 | | |||
511 | KisFilterStrategy *actualStrategy = KisFilterStrategyRegistry::instance()->get(strategy); | 513 | KisFilterStrategy *actualStrategy = KisFilterStrategyRegistry::instance()->get(strategy); | ||
514 | ENTER_FUNCTION() << actualStrategy->name(); | ||||
512 | if (!actualStrategy) actualStrategy = KisFilterStrategyRegistry::instance()->get("Bicubic"); | 515 | if (!actualStrategy) actualStrategy = KisFilterStrategyRegistry::instance()->get("Bicubic"); | ||
513 | 516 | | |||
514 | image->scaleImage(rc.size(), xres/72, yres/72, actualStrategy); | 517 | image->scaleImage(rc.size(), xres/72, yres/72, actualStrategy); | ||
515 | } | 518 | } | ||
516 | 519 | | |||
517 | void Document::rotateImage(double radians) | 520 | void Document::rotateImage(double radians) | ||
518 | { | 521 | { | ||
519 | if (!d->document) return; | 522 | if (!d->document) return; | ||
▲ Show 20 Lines • Show All 446 Lines • Show Last 20 Lines |