quint8 KisRectangleMaskGenerator::valueAt(qreal x, qreal y) const { if (isEmpty()) return 255; qreal xr = qAbs(x /*- m_xcenter*/); qreal yr = qAbs(y /*- m_ycenter*/); fixRotation(xr, yr); xr = qAbs(xr); yr = qAbs(yr); qreal nxr = xr * d->xcoeff; qreal nyr = yr * d->ycoeff; if (nxr > 1.0 || nyr > 1.0) return 255; if (antialiasEdges()) { xr += 1.0; yr += 1.0; } qreal fxr = xr * d->transformedFadeX; qreal fyr = yr * d->transformedFadeY; if (fxr > 1.0 && (fxr > fyr || fyr < 1.0)) { return 255 * nxr * (fxr - 1.0) / (fxr - nxr); } if (fyr > 1.0 && (fyr > fxr || fxr < 1.0)) { return 255 * nyr * (fyr - 1.0) / (fyr - nyr); } return 0; }
void FigL::rotate(){ if (angle == 0) rotateSegments(148); else if (angle == 90) rotateSegments(2345); else if (angle == 180) rotateSegments(378); else if (angle == 270) rotateSegments(123); angle = (angle + 90) % 360; fixRotation(); }
void FigT::rotate(){ if (angle == 0) rotateSegments(1348); else if (angle == 90) rotateSegments(1345); else if (angle == 180) rotateSegments(347); else if (angle == 270) rotateSegments(124); angle = (angle + 90) % 360; fixRotation(); }
void FigS::rotate(){ if (angle == 0) rotateSegments(348); else if (angle == 90) rotateSegments(4321); else if (angle == 180) rotateSegments(843); else if (angle == 270) rotateSegments(1234); angle = (angle + 90) % 360; fixRotation(); }
void FigStrip::rotate(){ if (angle == 0) rotateSegments(3456); else if (angle == 90) rotateSegments(9730); else if (angle == 180) rotateSegments(6543); else if (angle == 270) rotateSegments(379); angle = (angle + 90) % 360; fixRotation(); /* bool collsision = Game::getInstance().isTileTaken(tile + increment); if (Game::getInstance().isTileTaken(tile + increment)) return true;*/ }
quint8 KisCircleMaskGenerator::valueAt(qreal x, qreal y) const { if (isEmpty()) return 255; qreal xr = (x /*- m_xcenter*/); qreal yr = qAbs(y /*- m_ycenter*/); fixRotation(xr, yr); qreal n = norme(xr * d->xcoef, yr * d->ycoef); if (n > 1.0) return 255; // we add +1.0 to ensure correct antialising on the border if (antialiasEdges()) { xr = qAbs(xr) + 1.0; yr = qAbs(yr) + 1.0; } qreal nf = norme(xr * d->transformedFadeX, yr * d->transformedFadeY); if (nf < 1.0) return 0; return 255 * n * (nf - 1.0) / (nf - n); }