getWidth() public method

public getWidth ( ) : int
return int
Ejemplo n.º 1
0
		static void drawIntoBitmap (Bitmap bm)
		{
			float x = bm.getWidth ();
			float y = bm.getHeight ();
			Canvas c = new Canvas (bm);
			Paint p = new Paint ();
			p.setAntiAlias (true);

			p.setAlpha (0x80);
			c.drawCircle (x / 2, y / 2, x / 2, p);

			p.setAlpha (0x30);
			p.setXfermode (new PorterDuffXfermode (PorterDuff.Mode.SRC));
			p.setTextSize (60);
			p.setTextAlign (Paint.Align.CENTER);
			Paint.FontMetrics fm = p.getFontMetrics ();
			c.drawText ("Alpha", x / 2, (y - fm.ascent) / 2, p);
		}
Ejemplo n.º 2
0
		public BitmapMesh (Context context)
			: base (context)
		{
			mBitmap = GetResourceBitmap (R.drawable.beach);

			float w = mBitmap.getWidth ();
			float h = mBitmap.getHeight ();
			// construct our mesh
			int index = 0;
			for (int y = 0; y <= HEIGHT; y++) {
				float fy = h * y / HEIGHT;
				for (int x = 0; x <= WIDTH; x++) {
					float fx = w * x / WIDTH;
					setXY (mVerts, index, fx, fy);
					setXY (mOrig, index, fx, fy);
					index += 1;
				}
			}

			mMatrix.setTranslate (10, 10);
			mMatrix.invert (mInverse);
		}