public static void prependRotation(AsMatrix matrix, float angle) { float sin = AsMath.sin(angle); float cos = AsMath.cos(angle); matrix.setTo(matrix.a * cos + matrix.c * sin, matrix.b * cos + matrix.d * sin, matrix.c * cos - matrix.a * sin, matrix.d * cos - matrix.b * sin, matrix.tx, matrix.ty); }
public virtual void adjustHue(float _value) { _value = _value * AsMath.PI; float cos = AsMath.cos(_value); float sin = AsMath.sin(_value); concatValues((LUMA_R + (cos * (1 - LUMA_R))) + (sin * -LUMA_R), (LUMA_G + (cos * -LUMA_G)) + (sin * -LUMA_G), (LUMA_B + (cos * -LUMA_B)) + (sin * (1 - LUMA_B)), 0, 0, (LUMA_R + (cos * -LUMA_R)) + (sin * 0.143f), (LUMA_G + (cos * (1 - LUMA_G))) + (sin * 0.14f), (LUMA_B + (cos * -LUMA_B)) + (sin * -0.283f), 0, 0, (LUMA_R + (cos * -LUMA_R)) + (sin * -1 - LUMA_R), (LUMA_G + (cos * -LUMA_G)) + (sin * LUMA_G), (LUMA_B + (cos * (1 - LUMA_B))) + (sin * LUMA_B), 0, 0, 0, 0, 0, 1, 0); }
public static AsBlurFilter createDropShadow(float distance, float angle, uint color, float alpha, float blur, float resolution) { AsBlurFilter dropShadow = new AsBlurFilter(blur, blur, resolution); dropShadow.setOffsetX(AsMath.cos(angle) * distance); dropShadow.setOffsetY(AsMath.sin(angle) * distance); dropShadow.setMode(AsFragmentFilterMode.BELOW); dropShadow.setUniformColor(true, color, alpha); return(dropShadow); }
public static void skew(AsMatrix matrix, float skewX, float skewY) { float a = matrix.a; float b = matrix.b; float c = matrix.c; float d = matrix.d; float tx = matrix.tx; float ty = matrix.ty; float sinX = AsMath.sin(skewX); float cosX = AsMath.cos(skewX); float sinY = AsMath.sin(skewY); float cosY = AsMath.cos(skewY); matrix.a = a * cosY + c * sinY; matrix.b = b * cosY + d * sinY; matrix.c = c * cosX - a * sinX; matrix.d = d * cosX - b * sinX; }
public virtual void setTransformationMatrix(AsMatrix matrix) { mOrientationChanged = false; mTransformationMatrix.copyFrom(matrix); mX = matrix.tx; mY = matrix.ty; float a = matrix.a; float b = matrix.b; float c = matrix.c; float d = matrix.d; mScaleX = AsMath.sqrt(a * a + b * b); if (mScaleX != 0) { mRotation = AsMath.atan2(b, a); } else { mRotation = 0; } float cosTheta = AsMath.cos(mRotation); float sinTheta = AsMath.sin(mRotation); mScaleY = d * cosTheta - c * sinTheta; if (mScaleY != 0) { mSkewX = AsMath.atan2(d * sinTheta + c * cosTheta, mScaleY); } else { mSkewX = 0; } mSkewY = 0; mPivotX = 0; mPivotY = 0; }
public static AsPoint polar(float len, float angle) { return(new AsPoint(AsMath.cos(angle) * len, AsMath.sin(angle) * len)); }