static void movie_draw(JNIEnv* env, jobject movie, jobject canvas, jfloat fx, jfloat fy, jobject jpaint) { NPE_CHECK_RETURN_VOID(env, movie); NPE_CHECK_RETURN_VOID(env, canvas); // its OK for paint to be null SkMovie* m = J2Movie(env, movie); SkCanvas* c = GraphicsJNI::getNativeCanvas(env, canvas); SkScalar sx = SkFloatToScalar(fx); SkScalar sy = SkFloatToScalar(fy); const SkBitmap& b = m->bitmap(); const SkPaint* p = jpaint ? GraphicsJNI::getNativePaint(env, jpaint) : NULL; c->drawBitmap(b, sx, sy, p); }
virtual void onDraw(SkCanvas* canvas) { this->drawBG(canvas); if (fMovie) { if (fMovie->duration()) { fMovie->setTime(SkTime::GetMSecs() % fMovie->duration()); } else { fMovie->setTime(0); } canvas->drawBitmap(fMovie->bitmap(), SkIntToScalar(20), SkIntToScalar(20)); this->inval(NULL); } }
void WeatherWidget::setMovie (SkMovie &movie) { // NB: wenn hier WordWrap=true ist (zum Beispiel, weil vorher ein Text // gesetzt war), dann funktioniert die Movie-Darstellung nicht mehr, wenn // einmal ein Text gesetzt war: das Fenster, das nur ein Layout mit diesem // Widget enthält, wird auf Höhe 0 gesetzt. // Nach diesem Fehler kann man bequem 2 Stunden lang suchen. setWordWrap (false); // Clear the contents so we can delete the movie setText (""); SkLabel::setMovie (movie.getMovie ()); movie.getMovie ( )->start (); // Store the movie. The temporary file will be deleted when all copies of // this SkMovie have been deleted. If there is an old file, this will // probably happen right now. newMovie=movie; }
static jobject movie_gifFrameBitmap(JNIEnv* env, jobject movie, int frameIndex) { NPE_CHECK_RETURN_ZERO(env, movie); SkMovie* m = J2Movie(env, movie); int averTimePoint = 0; int frameDuration = 0; int frameCount = m->getGifTotalFrameCount(); if (frameIndex < 0 && frameIndex >= frameCount ) return NULL; m->setCurrFrame(frameIndex); //then we get frameIndex Bitmap (the current frame of movie is frameIndex now) SkBitmap *createdBitmap = m->createGifFrameBitmap(); if (createdBitmap != NULL) { return GraphicsJNI::createBitmap(env, createdBitmap, false, NULL); } else { return NULL; } }
ECode Movie::Draw( /* [in] */ ICanvas* canvas, /* [in] */ Float x, /* [in] */ Float y, /* [in] */ IPaint* paint) { assert(canvas != NULL); // its OK for paint to be null // NPE_CHECK_RETURN_VOID(env, movie); // NPE_CHECK_RETURN_VOID(env, canvas); // // its OK for paint to be null SkMovie* m = ((SkMovie*)mNativeMovie); SkCanvas* c = GraphicsNative::GetNativeCanvas(canvas); const SkBitmap& b = m->bitmap(); const SkPaint* p = paint ? GraphicsNative::GetNativePaint(paint) : NULL; c->drawBitmap(b, x, y, p); return NOERROR; }
static int movie_gifFrameDuration(JNIEnv* env, jobject movie, int frameIndex) { NPE_CHECK_RETURN_ZERO(env, movie); SkMovie* m = J2Movie(env, movie); //LOGE("Movie:movie_gifFrameDuration: frame number %d, duration is %d", frameIndex,m->getGifFrameDuration(frameIndex)); return m->getGifFrameDuration(frameIndex); }
static int movie_gifTotalFrameCount(JNIEnv* env, jobject movie) { NPE_CHECK_RETURN_ZERO(env, movie); SkMovie* m = J2Movie(env, movie); //LOGE("Movie:movie_gifTotalFrameCount: frame count %d", m->getGifTotalFrameCount()); return m->getGifTotalFrameCount(); }