android.graphics.Movie.setTime()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中android.graphics.Movie.setTime()方法的一些代码示例,展示了Movie.setTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Movie.setTime()方法的具体详情如下:
包路径:android.graphics.Movie
类名称:Movie
方法名:setTime

Movie.setTime介绍

暂无

代码示例

代码示例来源:origin: Rajawali/Rajawali

public void update() throws TextureException
{
  if(mMovie == null || mMovie.duration() == 0) return;
  long now = SystemClock.uptimeMillis();
  int relTime = (int)((now - mStartTime) % mMovie.duration());
  mMovie.setTime(relTime);
  mGIFBitmap.eraseColor(Color.TRANSPARENT);
  mMovie.draw(mCanvas, 0, 0);
  mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
  TextureManager.getInstance().replaceTexture(this);
  replace();
}

代码示例来源:origin: Cutta/GifView

/**
 * Draw current GIF frame
 */
private void drawMovieFrame(Canvas canvas) {
  movie.setTime(mCurrentAnimationTime);
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.scale(mScale, mScale);
  movie.draw(canvas, mLeft / mScale, mTop / mScale);
  canvas.restore();
}

代码示例来源:origin: huxq17/XRefreshView

private void drawMovieFrame(Canvas canvas) {
  // 设置要显示的帧,绘制即可
  mMovie.setTime(mCurrentAnimationTime);
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.scale(mScale, mScale);
  mMovie.draw(canvas, mLeft / mScale, mTop / mScale);
  canvas.restore();
}

代码示例来源:origin: smuyyh/SprintNBA

private void drawMovieFrame(Canvas canvas) {
  // 设置要显示的帧,绘制即可
  mMovie.setTime(mCurrentAnimationTime);
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.scale(mScale, mScale);
  mMovie.draw(canvas, mLeft / mScale, mTop / mScale);
  canvas.restore();
}

代码示例来源:origin: gizwits/GOpenSource_AppKit_Android_AS

private void drawMovieFrame(Canvas canvas) {
  // 设置要显示的帧,绘制即可
  mMovie.setTime(mCurrentAnimationTime);
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.scale(mScale, mScale);
  mMovie.draw(canvas, mLeft / mScale, mTop / mScale);
  canvas.restore();
}

代码示例来源:origin: xuhongv/SmartHome

private void drawMovieFrame(Canvas canvas) {
  // 设置要显示的帧,绘制即可
  mMovie.setTime(mCurrentAnimationTime);
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.scale(mScale, mScale);
  mMovie.draw(canvas, mLeft / mScale, mTop / mScale);
  canvas.restore();
}

代码示例来源:origin: adhishlal/GifLoader

private void drawGif(Canvas canvas) {
  mMovie.setTime(mCurrentAnimationTime);
  mMovie.draw(canvas, 0, 0);
  canvas.restore();
}

代码示例来源:origin: cxMax/FloatingView

private void draw() {
  canvas.save();
  movie.setTime((int) (System.currentTimeMillis() % movie.duration()));//这个是获取movie的某一帧,我们就不断地循环它
  movie.draw(canvas, 0, 0);
  imageView.setImageBitmap(bitmap);
  canvas.restore();
}

代码示例来源:origin: JackWHLiu/jackknife

@Override
  public void run() {
    Canvas canvas = mSurfaceHolder.lockCanvas();
    canvas.save();
    canvas.scale(zoom,zoom);
    mMovie.setTime((int)(System.currentTimeMillis()%mMovie.duration()));
    mMovie.draw(canvas, 0, 0);
    canvas.restore();
    mSurfaceHolder.unlockCanvasAndPost(canvas);
    mHandler.postDelayed(r, 30);
  }
};

代码示例来源:origin: renjianan/GifView

public void setPercent(float percent) {
  if (movie != null && movieDuration > 0) {
    this.percent = percent;
    movie.setTime((int) (movieDuration * percent));
    invalidateView();
    if (mOnPlayListener != null) {
      mOnPlayListener.onPlaying(percent);
    }
  }
}

代码示例来源:origin: andforce/iBeebo

mMovie.setTime(relTime);

代码示例来源:origin: qiubiteme/android_api_demos

@Override
  protected void onDraw(Canvas canvas) {
    canvas.drawColor(0xFFCCCCCC);
    Paint p = new Paint();
    p.setAntiAlias(true);
    canvas.drawBitmap(mBitmap, 10, 10, null);
    canvas.drawBitmap(mBitmap2, 10, 170, null);
    canvas.drawBitmap(mBitmap3, 110, 170, null);
    canvas.drawBitmap(mBitmap4, 210, 170, null);
    mDrawable.draw(canvas);
    long now = android.os.SystemClock.uptimeMillis();
    if (mMovieStart == 0) {   // first time
      mMovieStart = now;
    }
    if (mMovie != null) {
      int dur = mMovie.duration();
      if (dur == 0) {
        dur = 1000;
      }
      int relTime = (int)((now - mMovieStart) % dur);
      mMovie.setTime(relTime);
      mMovie.draw(canvas, getWidth() - mMovie.width(),
            getHeight() - mMovie.height());
      invalidate();
    }
  }
}

代码示例来源:origin: THEONE10211024/ApiDemos

@Override
  protected void onDraw(Canvas canvas) {
    canvas.drawColor(0xFFCCCCCC);
    Paint p = new Paint();
    p.setAntiAlias(true);
    canvas.drawBitmap(mBitmap, 10, 10, null);
    canvas.drawBitmap(mBitmap2, 10, 170, null);
    canvas.drawBitmap(mBitmap3, 110, 170, null);
    canvas.drawBitmap(mBitmap4, 210, 170, null);
    mDrawable.draw(canvas);
    long now = android.os.SystemClock.uptimeMillis();
    if (mMovieStart == 0) {   // first time
      mMovieStart = now;
    }
    if (mMovie != null) {
      int dur = mMovie.duration();
      if (dur == 0) {
        dur = 1000;
      }
      int relTime = (int)((now - mMovieStart) % dur);
      mMovie.setTime(relTime);
      mMovie.draw(canvas, getWidth() - mMovie.width(),
            getHeight() - mMovie.height());
      invalidate();
    }
  }
}

代码示例来源:origin: renjianan/GifView

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (movie != null) {
    if (!mPaused && hasStart) {
      if (reverse) {
        movie.setTime(movieDuration - getCurrentFrameTime());
      } else {
        movie.setTime(getCurrentFrameTime());
      }
      drawMovieFrame(canvas);
      invalidateView();
    } else {
      drawMovieFrame(canvas);
    }
  }
}

代码示例来源:origin: pondurii/vrVideo

public void update() throws TextureException
{
  if(mMovie == null || mMovie.duration() == 0) return;
  long now = SystemClock.uptimeMillis();
  int relTime = (int)((now - mStartTime) % mMovie.duration());
  mMovie.setTime(relTime);
  mGIFBitmap.eraseColor(Color.TRANSPARENT);
  mMovie.draw(mCanvas, 0, 0);
  mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
  TextureManager.getInstance().replaceTexture(this);
  replace();
}

相关文章