本文整理汇总了C++中Sk3DView类的典型用法代码示例。如果您正苦于以下问题:C++ Sk3DView类的具体用法?C++ Sk3DView怎么用?C++ Sk3DView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sk3DView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Camera_dotWithNormal
static float Camera_dotWithNormal(JNIEnv* env, jobject obj,
float x, float y, float z) {
Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
SkScalar dot = v->dotWithNormal(SkFloatToScalar(x), SkFloatToScalar(y),
SkFloatToScalar(z));
return SkScalarToFloat(dot);
}
示例2: onDrawContent
virtual void onDrawContent(SkCanvas* canvas) {
canvas->translate(this->width()/2, this->height()/2);
Sk3DView view;
view.rotateX(fRX);
view.rotateY(fRY);
view.applyToCanvas(canvas);
SkPaint paint;
if (fShaders.count() > 0) {
bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0;
if (frontFace != fFrontFace) {
fFrontFace = frontFace;
fShaderIndex = (fShaderIndex + 1) % fShaders.count();
}
paint.setAntiAlias(true);
paint.setShader(fShaders[fShaderIndex]);
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
SkRect r = { -150, -150, 150, 150 };
canvas->drawRoundRect(r, 30, 30, paint);
}
fRY += SampleCode::GetAnimSecondsDelta() * 90;
if (fRY >= SkIntToScalar(360)) {
fRY = 0;
}
this->inval(NULL);
}
示例3: Camera_dotWithNormal
static jfloat Camera_dotWithNormal(JNIEnv* env, jobject obj,
jfloat x, jfloat y, jfloat z) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
SkScalar dot = v->dotWithNormal(x, y, z);
return SkScalarToFloat(dot);
}
示例4: Camera_rotate
static void Camera_rotate(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateX(x);
v->rotateY(y);
v->rotateZ(z);
}
示例5: onDraw
virtual void onDraw(SkCanvas* canvas)
{
this->drawBG(canvas);
canvas->translate(this->width()/2, this->height()/2);
Sk3DView view;
view.rotateX(SkIntToScalar(fRX));
view.rotateY(SkIntToScalar(fRY));
view.applyToCanvas(canvas);
SkPaint paint;
SkScalar rad = SkIntToScalar(50);
SkScalar dim = rad*2;
if (view.dotWithNormal(0, 0, SK_Scalar1) < 0) {
paint.setColor(SK_ColorRED);
}
paint.setAntiAlias(true);
#if 0
SkEmbossMaskFilter::Light light;
light.fDirection[0] = SK_Scalar1;
light.fDirection[1] = SK_Scalar1;
light.fDirection[2] = SK_Scalar1;
light.fAmbient = 180;
light.fSpecular = 16 * 2;
paint.setMaskFilter(new SkEmbossMaskFilter(light, SkIntToScalar(4)));
#endif
canvas->drawCircle(0, 0, rad, paint);
canvas->drawCircle(-dim, -dim, rad, paint);
canvas->drawCircle(-dim, dim, rad, paint);
canvas->drawCircle( dim, -dim, rad, paint);
canvas->drawCircle( dim, dim, rad, paint);
fRY += 1;
if (fRY >= 360)
fRY = 0;
this->inval(NULL);
}
示例6: onDraw
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
canvas->translate(this->width()/2, this->height()/2);
Sk3DView view;
view.rotateX(fRX);
view.rotateY(fRY);
view.applyToCanvas(canvas);
SkPaint paint;
SkScalar rad = SkIntToScalar(50);
SkScalar dim = rad*2;
if (fShaders.count() > 0) {
bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0;
if (frontFace != fFrontFace) {
fFrontFace = frontFace;
fShaderIndex = (fShaderIndex + 1) % fShaders.count();
}
paint.setAntiAlias(true);
paint.setShader(fShaders[fShaderIndex]);
#if 0
canvas->drawCircle(0, 0, rad, paint);
canvas->drawCircle(-dim, -dim, rad, paint);
canvas->drawCircle(-dim, dim, rad, paint);
canvas->drawCircle( dim, -dim, rad, paint);
canvas->drawCircle( dim, dim, rad, paint);
#else
SkRect r = { -150, -150, 150, 150 };
canvas->drawRoundRect(r, 30, 30, paint);
#endif
}
fRY += SampleCode::GetAnimSecondsDelta() * 90;
if (fRY >= SkIntToScalar(360)) {
fRY = 0;
}
this->inval(NULL);
}
示例7: onDrawContent
virtual void onDrawContent(SkCanvas* canvas) {
canvas->translate(this->width()/2, this->height()/2);
Sk3DView view;
view.rotateX(fRX);
view.rotateY(fRY);
view.applyToCanvas(canvas);
SkPaint paint;
if (fShaders.count() > 0) {
bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0;
if (frontFace != fFrontFace) {
fFrontFace = frontFace;
fShaderIndex = (fShaderIndex + 1) % fShaders.count();
}
paint.setAntiAlias(true);
paint.setShader(fShaders[fShaderIndex]);
paint.setFilterQuality(kLow_SkFilterQuality);
SkRect r = { -150, -150, 150, 150 };
canvas->drawRoundRect(r, 30, 30, paint);
}
}
示例8: Camera_restore
static void Camera_restore(JNIEnv* env, jobject obj) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->restore();
}
示例9: Camera_applyToCanvas
static void Camera_applyToCanvas(JNIEnv* env, jobject obj, jlong canvasHandle) {
SkCanvas* canvas = reinterpret_cast<android::Canvas*>(canvasHandle)->getSkCanvas();
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->applyToCanvas(canvas);
}
示例10: Camera_getMatrix
static void Camera_getMatrix(JNIEnv* env, jobject obj, jlong matrixHandle) {
SkMatrix* native_matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->getMatrix(native_matrix);
}
示例11: Camera_getLocationZ
static jfloat Camera_getLocationZ(JNIEnv* env, jobject obj) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
return SkScalarToFloat(v->getCameraLocationZ());
}
示例12: Camera_setLocation
static void Camera_setLocation(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->setCameraLocation(x, y, z);
}
示例13: Camera_rotateZ
static void Camera_rotateZ(JNIEnv* env, jobject obj, jfloat degrees) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateZ(degrees);
}
示例14: Camera_translate
static void Camera_translate(JNIEnv* env, jobject obj,
jfloat dx, jfloat dy, jfloat dz) {
jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->translate(dx, dy, dz);
}
示例15: Camera_restore
static void Camera_restore(JNIEnv* env, jobject obj) {
Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
v->restore();
}