/*! \reimp */ void QThemeLevelItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { resizeImages(boundingRect().width() * d->count, boundingRect().height()); QRectF source(d->currentFrame * boundingRect().width(), 0, boundingRect().width(), boundingRect().height()); painter->drawPixmap(boundingRect(), image(), source); QThemeItem::paint(painter, option, widget); }
void LayerEditScene::setLayer(Layer *layer) { _layer = layer; if(_layer != 0) { resizeImages(QSize()); recalculatePositions(); } }
void Palette::setSprites(const QList<Sprite> &sprites) { _sprites = sprites; qSort(_sprites.begin(), _sprites.end(), compareBySize); resizeImages(QSize(), _previewSize); recalculatePositions(); }
void ToneMap::applyPS20(RenderDevice* rd) { // TODO: obey viewport resizeImages(rd); TextureRef bloomMap = getBloomMap(rd); rd->push2D(); rd->setAlphaTest(RenderDevice::ALPHA_ALWAYS_PASS, 0); rd->setColor(Color3::white()); // Undo renderdevice's 0.35 translation rd->setCameraToWorldMatrix(CoordinateFrame()); rd->setObjectToWorldMatrix(CoordinateFrame()); // Grab the image of the screen that was just rendered Rect2D rect = Rect2D::xywh(0, 0, rd->width(), rd->height()); screenImage->copyFromScreen(rect); // Threshold, gaussian blur horizontally, and subsample so that we have an image 1/4 as wide. bloomShader[0]->args.set("screenImage", screenImage); rd->setShader(bloomShader[0]); Draw::fastRect2D(bloomMapIntermediate->rect2DBounds(), rd); bloomMapIntermediate->copyFromScreen(bloomMapIntermediate->rect2DBounds()); // Gaussian filter vertically and subsample so that we have an image 1/4 as high and // blend this result in with the previous frame's bloom map to produce motion blur in // bright areas. bloomShader[1]->args.set("bloomImage", bloomMapIntermediate); bloomShader[1]->args.set("oldBloom", bloomMap); rd->setShader(bloomShader[1]); Draw::fastRect2D(bloomMap->rect2DBounds(), rd); bloomMap->copyFromScreen(bloomMap->rect2DBounds()); bool showBloomMap = false; // Set to true for debugging if (! showBloomMap) { // Now combine bloomShader[2]->args.set("screenImage", screenImage); bloomShader[2]->args.set("bloomImage", bloomMap); bloomShader[2]->args.set("gamma", RG); rd->setShader(bloomShader[2]); Draw::fastRect2D(rect, rd); } rd->pop2D(); }
void Palette::setPreviewSize(const QSize &size) { resizeImages(_previewSize, size); _previewSize = size; recalculatePositions(); }