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

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

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

Movie.draw介绍

暂无

代码示例

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

private void loadGIF() {
  Context context = TextureManager.getInstance().getContext();
  mMovie = Movie.decodeStream(context.getResources().openRawResource(mResourceId));
  mWidth = mMovie.width();
  mHeight = mMovie.height();
  
  mGIFBitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
  mCanvas = new Canvas(mGIFBitmap);
  mMovie.draw(mCanvas, 0, 0);
  mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
}

代码示例来源: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: renjianan/GifView

/**
 * 画出gif帧
 */
private void drawMovieFrame(Canvas canvas) {
  canvas.save();
  canvas.scale(1 / mScale, 1 / mScale);
  movie.draw(canvas, 0.0f, 0.0f);
  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: pondurii/vrVideo

private void loadGIF() {
  Context context = TextureManager.getInstance().getContext();
  mMovie = Movie.decodeStream(context.getResources().openRawResource(mResourceId));
  mWidth = mMovie.width();
  mHeight = mMovie.height();
  
  mGIFBitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
  mCanvas = new Canvas(mGIFBitmap);
  mMovie.draw(mCanvas, 0, 0);
  mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
}

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

mMovie.draw(canvas, 0, 0);
invalidate();

代码示例来源: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: 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();
}

相关文章