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);
}
Exemple #2
0
static jintArray movie_frameColorData(JNIEnv* env, jobject movie,jint frameIndex){
	jintArray colIntArray = NULL;
	GifMovie* m = J2Movie(env, movie);
	if(m!=NULL&&frameIndex>=0){
		ColorData *data = m->getFrameColorData(frameIndex);
		if(data!=NULL){
			int width = data->getWidth();
			int height = data->getHeight();
			int *col = data->getColorData();
			if(width>0&&height>0&&col!=NULL){
				colIntArray = env->NewIntArray(width*height);
				env->SetIntArrayRegion(colIntArray,0,width*height,col);
			}
		}
	}
	return colIntArray;
}
Exemple #3
0
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;
    }
}
static jboolean movie_isOpaque(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->isOpaque() ? JNI_TRUE : JNI_FALSE;
}
static jint movie_duration(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return static_cast<jint>(J2Movie(env, movie)->duration());
}
Exemple #6
0
static jboolean movie_setTime(JNIEnv* env, jobject movie, int ms) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->setTime(ms);
}
static jint movie_height(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return static_cast<jint>(J2Movie(env, movie)->height());
}
Exemple #8
0
static int movie_height(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->height();
}
Exemple #9
0
static int movie_duration(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->duration();
}
Exemple #10
0
static int movie_height(JNIEnv* env, jobject movie) {
    return J2Movie(env, movie)->height();
}
Exemple #11
0
static int movie_totalFrameCount(JNIEnv* env, jobject movie){
	return J2Movie(env, movie)->getTotalFrameCount();
}
Exemple #12
0
static void movie_closeGif(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_VOID(env, movie);
    SkMovie* m = J2Movie(env, movie);
//LOGE("Movie:movie_closeGif()");
    delete m;
}
Exemple #13
0
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);
}
Exemple #14
0
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();
}
Exemple #15
0
static int movie_duration(JNIEnv* env, jobject movie) {
    return J2Movie(env, movie)->duration();
}
Exemple #16
0
static int movie_frameDuration(JNIEnv* env, jobject movie,jint frameIndex){
	return J2Movie(env, movie)->getFrameDuration(frameIndex);
}
static jboolean movie_setTime(JNIEnv* env, jobject movie, jint ms) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->setTime(ms) ? JNI_TRUE : JNI_FALSE;
}
Exemple #18
0
static int movie_width(JNIEnv* env, jobject movie) {
    NPE_CHECK_RETURN_ZERO(env, movie);
    return J2Movie(env, movie)->width();
}
Exemple #19
0
static int movie_width(JNIEnv* env, jobject movie) {
    return J2Movie(env, movie)->width();
}
Exemple #20
0
static jboolean movie_setTime(JNIEnv* env, jobject movie, int ms) {
    return J2Movie(env, movie)->setTime(ms);
}