WEB开发网
开发学院手机开发Android 开发 Live Wallpaper动态壁纸开发 阅读

Live Wallpaper动态壁纸开发

 2011-07-01 20:50:24 来源:本站整理   
核心提示: holder.unlockCanvasAndPost(c); } mHandler.removeCallbacks(mDrawPattern); if (mVisible) {mHandler.postDelayed(mDrawPattern, 1000 / 25); }}void drawPattern(Canva

   holder.unlockCanvasAndPost(c);
  }

  mHandler.removeCallbacks(mDrawPattern);
  if (mVisible)
  {
  mHandler.postDelayed(mDrawPattern, 1000 / 25);
  }
 }

 void drawPattern(Canvas c)
 {
  c.save();
  c.drawColor(0xff000000);

  Paint paint = new Paint();
  if (mMotion)
  {
  mFrameCounter++;
  if (mHorizontal)
  {
   int right;
   int left;
   if (mFrameCounter > mRectFrame.right)
   mFrameCounter = 0;
   
   for (int i = 0; i < mRectCount; i++)
   {
   paint.setColor(rectColor[i]);

 right = mColorRectangles[i].right + mFrameCounter;
   left = mColorRectangles[i].left + mFrameCounter;

 if(right > mRectFrame.right)
   {
    c.drawRect(left - mRectFrame.right, mColorRectangles[i].top, right - mRectFrame.right, mColorRectangles[i].bottom, paint);
   }

 if(left < mRectFrame.right)
   {
    c.drawRect(left, mColorRectangles[i].top, right, mColorRectangles[i].bottom, paint);
   }
   }
   
   if(mShape.compareToIgnoreCase("smpte") == 0)
   {
   right =mGradientRect.right + mFrameCounter;
   left = mGradientRect.left + mFrameCounter;
   if(right > mRectFrame.right)
   {
    mGradient.setBounds(left - mRectFrame.right, mGradientRect.top, right - mRectFrame.right, mGradientRect.bottom);
    mGradient.draw(c);
   }

 if(left < mRectFrame.right)
   {
    mGradient.setBounds(left, mGradientRect.top, right, mGradientRect.bottom);
    mGradient.draw(c);
   }
   }
  }
  else
  {
   int top;
   int bottom;
   if (mFrameCounter > mRectFrame.bottom)
   mFrameCounter = 0;

 
   for (int i = 0; i < mRectCount; i++)
   {
   paint.setColor(rectColor[i]);

 top = mColorRectangles[i].top + mFrameCounter;
   bottom = mColorRectangles[i].bottom + mFrameCounter;

 if(bottom > mRectFrame.bottom)
   {
    c.drawRect(mColorRectangles[i].left, top - mRectFrame.bottom, mColorRectangles[i].right, bottom - mRectFrame.bottom, paint);
   }

 if(top < mRectFrame.bottom)
   {
    c.drawRect(mColorRectangles[i].left, top, mColorRectangles[i].right, bottom, paint);
   }
   }
   
   if(mShape.compareToIgnoreCase("smpte") == 0)
   {
   top = mGradientRect.top + mFrameCounter;
   bottom = mGradientRect.bottom + mFrameCounter;

 if(bottom > mRectFrame.bottom)
   {
    mGradient.setBounds(mGradientRect.left, top - mRectFrame.bottom, mGradientRect.right, bottom - mRectFrame.bottom);

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Live Wallpaper 动态

编辑录入:coldstar [复制链接] [打 印]
赞助商链接