/** \ingroup img * \ref img_std "Standardizes" an image by normalizing its orientation, colors, * etc. It is safe to call this multiple times on an image, libfprint keeps * track of the work it needs to do to make an image standard and will not * perform these operations more than once for a given image. * \param img the image to standardize */ API_EXPORTED void fp_img_standardize(struct fp_img *img) { if (img->flags & FP_IMG_V_FLIPPED) { vflip(img); img->flags &= ~FP_IMG_V_FLIPPED; } if (img->flags & FP_IMG_H_FLIPPED) { hflip(img); img->flags &= ~FP_IMG_H_FLIPPED; } if (img->flags & FP_IMG_COLORS_INVERTED) { invert_colors(img); img->flags &= ~FP_IMG_COLORS_INVERTED; } }
//renvoie le graphe minimal aux fransformations pres pour un rectangle void getMinRect(byte *in, byte *out) { byte buf[W*H]; byte buf2[W*H]; getMinShift(in,out); hflip(in,buf); getMinShift(buf,buf2); if(compare(buf2,out)<0) copy(buf2,out); vflip(buf,buf2); getMinShift(buf2,buf); if(compare(buf,out)<0) copy(buf,out); hflip(buf2,buf); getMinShift(buf,buf2); if(compare(buf2,out)<0) copy(buf2,out); }//getMinRect
void SchematicTextLayerKinPaletteItem::transformItem(const QTransform & currTransf, bool includeRatsnest) { Q_UNUSED(currTransf); Q_UNUSED(includeRatsnest); if (m_textThings.count() == 0) { initTextThings(); } double rotation; QTransform chiefTransform = layerKinChief()->transform(); // assume chief already has rotation bool isFlipped = GraphicsUtils::isFlipped(chiefTransform.toAffine(), rotation); QString svg; if (isFlipped) { svg = makeFlipTextSvg(); } if (svg.isEmpty()) { svg = this->property("textSvg").toByteArray(); } if (rotation >= 135 && rotation <= 225) { svg = vflip(svg, isFlipped); } reloadRenderer(svg, true); QPointF p = layerKinChief()->sceneBoundingRect().topLeft(); QTransform transform; QRectF bounds = boundingRect(); transform.translate(bounds.width() / 2, bounds.height() / 2); transform.rotate(rotation); transform.translate(bounds.width() / -2, bounds.height() / -2); this->setTransform(transform); //QMatrix m1 = chiefTransform.toAffine(); //layerKinChief()->debugInfo("chief " + TextUtils::svgMatrix(m1)); //m1 = transform.toAffine(); //debugInfo("\t " + TextUtils::svgMatrix(m1)); }