void ScrollbarThemeOpus::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) { if (!clientOpacityMap->contains(scrollbar)) return; int opacity = clientOpacityMap->get(scrollbar); if (!opacity) return; IntRect thumbRect = rect; thumbRect.inflate(-1); int scrollThickness = thumbRect.width() < thumbRect.height() ? thumbRect.width() : thumbRect.height(); IntSize curveSize(scrollThickness / 2, scrollThickness / 2); Color fillColor(makeRGBA(128, 128, 128, opacity)); context->fillRoundedRect(thumbRect, curveSize, curveSize, curveSize, curveSize, fillColor, ColorSpaceDeviceRGB); }
void curvePoints(S_Curve *pCurve, int n, S_CoordVec *pPoints) { double step, t = 0.0; int i, size; IZG_ASSERT(pCurve && pPoints); /* uprava velikosti vysledneho seznamu bodu */ size = curveSize(pCurve); cvecResize(pPoints, size); /* pocet ridicich bodu */ if( size < 2 || n < 2 ) return; /* vypocet velikosti kroku */ step = 1.0 / (n - 1); /* generovani bodu */ for( i = 0; i < n; ++i, t += step ) { /* vypocet bodu krivky */ cvecGet(pPoints, i) = curvePoint(pCurve, t); } }
S_Coords curvePoint(S_Curve *pCurve, double t) { S_Coords point = makeCoords(0.0, 0.0, 0.0); double A, denom = 0.0; int i, size; IZG_ASSERT(pCurve); /* velikost krivky */ size = curveSize(pCurve); /* kontrola hodnoty parametru t <0, 1> */ if( t < 0.0 ) t = 0.0; else if( t >= 1.0 ) t = 1.0; /* vypocet bodu krivky pomoci Bernsteinovych polynomu */ for( i = 0; i < size; ++i ) { A = dvecGet(pCurve->weights, i) * splineFunc(i, pCurve->degree, pCurve->knots, t); point.x += cvecGet(pCurve->points, i).x * A; point.y += cvecGet(pCurve->points, i).y * A; point.z += cvecGet(pCurve->points, i).z * A; denom += A; } /* podeleni jmenovatelem */ if( !IS_ZERO(denom) ) { denom = 1.0 / denom; } point.x *= denom; point.y *= denom; point.z *= denom; return point; }