TextStream& SVGFilterEffect::externalRepresentation(TextStream& ts) const { if (!in().isEmpty()) ts << "[in=\"" << in() << "\"]"; if (!result().isEmpty()) ts << " [result=\"" << result() << "\"]"; if (!subRegion().isEmpty()) ts << " [subregion=\"" << subRegion() << "\"]"; return ts; }
void GFXDrawUtil::drawBitmapStretch( GFXTextureObject*texture, const RectF &dstRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ ) { AssertFatal( texture != 0, "No texture specified for drawBitmapStretch()" ); RectF subRegion( 0.f, 0.f, (F32)texture->mBitmapSize.x, (F32)texture->mBitmapSize.y ); drawBitmapStretchSR( texture, dstRect, subRegion, in_flip, filter, in_wrap ); }
void GFXDrawUtil::drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ ) { AssertFatal( texture != 0, "No texture specified for drawBitmap()" ); RectI subRegion( 0, 0, texture->mBitmapSize.x, texture->mBitmapSize.y ); RectI stretch( in_rAt.x, in_rAt.y, texture->mBitmapSize.x, texture->mBitmapSize.y ); drawBitmapStretchSR( texture, stretch, subRegion, in_flip, filter, in_wrap ); }
KoFilterEffectStack * FilterEffectResource::toFilterStack() const { KoFilterEffectStack * filterStack = new KoFilterEffectStack(); if (!filterStack) return 0; QByteArray data = m_data.toByteArray(); KoXmlDocument doc; doc.setContent(data); KoXmlElement e = doc.documentElement(); // only allow obect bounding box units if (e.hasAttribute("filterUnits") && e.attribute("filterUnits") != "objectBoundingBox") return 0; if (e.attribute("primitiveUnits") != "objectBoundingBox") return 0; // parse filter region rectangle QRectF filterRegion; filterRegion.setX(fromPercentage(e.attribute("x", "-0.1"))); filterRegion.setY(fromPercentage(e.attribute("y", "-0.1"))); filterRegion.setWidth(fromPercentage(e.attribute("width", "1.2"))); filterRegion.setHeight(fromPercentage(e.attribute("height", "1.2"))); filterStack->setClipRect(filterRegion); KoFilterEffectLoadingContext context(QString("")); KoFilterEffectRegistry * registry = KoFilterEffectRegistry::instance(); // create the filter effects and add them to the shape for (KoXmlNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { KoXmlElement primitive = n.toElement(); KoFilterEffect * filterEffect = registry->createFilterEffectFromXml(primitive, context); if (!filterEffect) { qWarning() << "filter effect" << primitive.tagName() << "is not implemented yet"; continue; } // parse subregion qreal x = fromPercentage(primitive.attribute("x", "0")); qreal y = fromPercentage(primitive.attribute("y", "0")); qreal w = fromPercentage(primitive.attribute("width", "1")); qreal h = fromPercentage(primitive.attribute("height", "1")); QRectF subRegion(QPointF(x, y), QSizeF(w, h)); if (primitive.hasAttribute("in")) filterEffect->setInput(0, primitive.attribute("in")); if (primitive.hasAttribute("result")) filterEffect->setOutput(primitive.attribute("result")); filterEffect->setFilterRect(subRegion); filterStack->appendFilterEffect(filterEffect); } return filterStack; }
void FEOffset::apply(Filter* filter) { m_in->apply(filter); if (!m_in->resultImage()) return; GraphicsContext* filterContext = getEffectContext(); if (!filterContext) return; if (filter->effectBoundingBoxMode()) { setDx(dx() * filter->sourceImageRect().width()); setDy(dy() * filter->sourceImageRect().height()); } FloatRect dstRect = FloatRect(dx() + m_in->subRegion().x() - subRegion().x(), dy() + m_in->subRegion().y() - subRegion().y(), m_in->subRegion().width(), m_in->subRegion().height()); filterContext->drawImage(m_in->resultImage()->image(), dstRect); }
void calcViewportLocationFromLayout(SEXP layoutPosRow, SEXP layoutPosCol, SEXP parent, LViewportLocation *vpl) { int minrow, maxrow, mincol, maxcol; double x, y, width, height; SEXP vpx, vpy, vpwidth, vpheight; SEXP layout = viewportLayout(parent); /* It is possible for ONE of layoutPosRow and layoutPosCol to * be NULL; this is interpreted as "occupy all rows/cols" * NOTE: The " - 1" is there because R is 1-based and C is zero-based */ if (isNull(layoutPosRow)) { minrow = 0; maxrow = layoutNRow(layout) - 1; } else { minrow = INTEGER(layoutPosRow)[0] - 1; maxrow = INTEGER(layoutPosRow)[1] - 1; } if (isNull(layoutPosCol)) { mincol = 0; maxcol = layoutNCol(layout) - 1; } else { mincol = INTEGER(layoutPosCol)[0] - 1; maxcol = INTEGER(layoutPosCol)[1] - 1; } /* Put the relevant values into vpl */ subRegion(viewportLayout(parent), minrow, maxrow, mincol, maxcol, REAL(viewportLayoutWidths(parent)), REAL(viewportLayoutHeights(parent)), REAL(viewportWidthCM(parent))[0], REAL(viewportHeightCM(parent))[0], &x, &y, &width, &height); /* Layout widths and heights are stored in CM */ PROTECT(vpx = unit(x, L_CM)); vpl->x = vpx; PROTECT(vpy = unit(y, L_CM)); vpl->y = vpy; PROTECT(vpwidth = unit(width, L_CM)); vpl->width = vpwidth; PROTECT(vpheight = unit(height, L_CM)); vpl->height = vpheight; vpl->hjust = 0; vpl->vjust = 0; /* Question: Is there any chance that these newly-allocated * unit SEXPs will get corrupted after this unprotect ?? */ UNPROTECT(4); }
void FEImage::apply(Filter*) { if (!m_image.get()) return; GraphicsContext* filterContext = getEffectContext(); if (!filterContext) return; FloatRect srcRect(FloatPoint(), m_image->size()); FloatRect destRect(FloatPoint(), subRegion().size()); m_preserveAspectRatio.transformRect(destRect, srcRect); filterContext->drawImage(m_image.get(), DeviceColorSpace, destRect, srcRect); }
FloatRect FilterEffect::calculateEffectRect(Filter* filter) { setUnionOfChildEffectSubregions(uniteChildEffectSubregions(filter)); filter->calculateEffectSubRegion(this); return subRegion(); }
void Sav6::trade(std::shared_ptr<PKX> pk) { PK6 *pk6 = (PK6*)pk.get(); if (pk6->egg()) { if (otName() != pk6->otName() || TID() != pk6->TID() || SID() != pk6->SID() || gender() != pk6->otGender()) { pk6->metDay(Configuration::getInstance().day()); pk6->metMonth(Configuration::getInstance().month()); pk6->metYear(Configuration::getInstance().year() - 2000); pk6->metLocation(30002); } return; } else if (otName() == pk6->otName() && TID() == pk6->TID() && SID() == pk6->SID() && gender() == pk6->otGender()) { pk6->currentHandler(0); if (!pk6->untraded() && (country() != pk6->geoCountry(0) || subRegion() != pk6->geoRegion(0))) { for (int i = 4; i > 0; i--) { pk6->geoCountry(pk6->geoCountry(i - 1), i); pk6->geoRegion(pk6->geoRegion(i - 1), i); } pk6->geoCountry(country()); pk6->geoRegion(subRegion()); } } else { if (otName() != pk6->htName() || gender() != pk6->htGender() || (pk6->geoCountry(0) == 0 && pk6->geoRegion(0) == 0 && !pk6->untradedEvent())) { for (int i = 4; i > 0; i--) { pk6->geoCountry(pk6->geoCountry(i - 1), i); pk6->geoRegion(pk6->geoRegion(i - 1), i); } pk6->geoCountry(country()); pk6->geoRegion(subRegion()); } if (pk6->htName() != otName()) { pk6->htFriendship(pk6->baseFriendship()); pk6->htAffection(0); pk6->htName(otName()); } pk6->currentHandler(1); pk6->htGender(gender()); if (pk6->htMemory() == 0) { pk6->htMemory(4); pk6->htTextVar(9); pk6->htIntensity(1); /*static constexpr u32 memoryBits[70] = { 0x000000, 0x04CBFD, 0x004BFD, 0x04CBFD, 0x04CBFD, 0xFFFBFB, 0x84FFF9, 0x47FFFF, 0xBF7FFA, 0x7660B0, 0x80BDF9, 0x88FB7A, 0x083F79, 0x0001FE, 0xCFEFFF, 0x84EBAF, 0xB368B0, 0x091F7E, 0x0320A0, 0x080DDD, 0x081A7B, 0x404030, 0x0FFFFF, 0x9A08BC, 0x089A7B, 0x0032AA, 0x80FF7A, 0x0FFFFF, 0x0805FD, 0x098278, 0x0B3FFF, 0x8BBFFA, 0x8BBFFE, 0x81A97C, 0x8BB97C, 0x8BBF7F, 0x8BBF7F, 0x8BBF7F, 0x8BBF7F, 0xAC3ABE, 0xBFFFFF, 0x8B837C, 0x848AFA, 0x88FFFE, 0x8B0B7C, 0xB76AB2, 0x8B1FFF, 0xBE7AB8, 0xB77EB8, 0x8C9FFD, 0xBF9BFF, 0xF408B0, 0xBCFE7A, 0x8F3F72, 0x90DB7A, 0xBCEBFF, 0xBC5838, 0x9C3FFE, 0x9CFFFF, 0x96D83A, 0xB770B0, 0x881F7A, 0x839F7A, 0x839F7A, 0x839F7A, 0x53897F, 0x41BB6F, 0x0C35FF, 0x8BBF7F, 0x8BBF7F };*/ u32 bits = 0x04CBFD; //memoryBits[pk6->htMemory()]; while (true) { u32 feel = randomNumbers() % 20; if ((bits & (1 << feel)) != 0) { pk6->htFeeling(feel); break; } } } } }