void MediaPlayer::loadFromQue(int index){ queing = true; loadGif(que[index]); queFileName = que[index]; queIndex += 1; if (queIndex +1 >= que.size()){ resetQue(); } }
JNIEXPORT jlong JNICALL Java_com_ly_widget_GifDrawable_loadGifFile(JNIEnv * env, jobject obj, jstring filepath, jarray size) { int error; const char *native_file_path = (*env)->GetStringUTFChars(env, filepath, 0); GifFileType* gif = DGifOpenFileName(native_file_path,&error); error = DGifSlurp(gif); (*env)->ReleaseStringUTFChars(env, filepath, native_file_path); return loadGif(env, gif, size); }
JNIEXPORT jlong JNICALL Java_com_ly_widget_GifDrawable_loadGifAsset(JNIEnv * env, jobject obj, jobject assetManager, jstring filepath, jarray size) { int error; AAssetManager *mgr = AAssetManager_fromJava(env, assetManager); const char *native_file_path = (*env)->GetStringUTFChars(env, filepath, 0); AAsset* asset = AAssetManager_open(mgr, native_file_path, AASSET_MODE_UNKNOWN); off_t start, length; fd = AAsset_openFileDescriptor(asset, &start, &length); bytesLeft = length; lseek(fd, start, SEEK_SET); if (fd < 0) { return 0; } GifFileType* gif = DGifOpen(NULL,&readFunc,&error); error = DGifSlurp(gif); (*env)->ReleaseStringUTFChars(env, filepath, native_file_path); AAsset_close(asset); return loadGif(env, gif, size); }
void GifBrush::onMouseDown(Timeline *timeline, ofFbo *fbo, int x, int y) { loadGif("mouse"); //TODO: Change this to get gif name from drop down menu setStartPosition(x, y); }