[ create a new paste ] login | about

Link: http://codepad.org/1Tbl7wFk    [ raw code | fork ]

C, pasted on May 28:
public class ImageIn extends ImageView  {
	
	
	
	MotionEvent event;
	TextView k;
	int rid;
	int pixel;
	Bitmap image,image2;
	  double bmHeight ;
	  double bmWidth;
	String huma ="human";
	String info = "human";
	 float x = 0; //init value 
	 float y = 0; //init value
	// Animation animationFadeIn;
	int t=0;
	int i=1;

	public ImageIn(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	public ImageIn(Context context, AttributeSet attrs) { 
		super(context, attrs);
	
		} 
	
		
	public void changeImage(int id){
					this.setMaxWidth(480);
					this.setImageResource(id);
					rid=id;
	}
	public double getmaskPixel(float x, float y,ImageView i,ImageView h) {
		// TODO Auto-generated method stub
		image2  = BitmapFactory.decodeResource(getResources(), rid);
		Log.w("DEBUG","which is null:image i " + i.getWidth() + " OR " +i.getHeight() );
		Log.w("DEBUG","which is null:image h " + h.getWidth() + " OR " +h.getHeight() );
		Log.w("DEBUG","which is null:image2 " + image2.getWidth() + " OR " +image2.getHeight() );
		 Bitmap image = Bitmap.createScaledBitmap(image2, i.getWidth(), i.getHeight(), false);
		Log.w("DEBUG","which is null:image " + image.getWidth() + " OR " +image.getHeight() );
		double bmWidth = image.getWidth();
		  double bmHeight = image.getHeight(); 
		  if ( x < 0 || y < 0 || x > getWidth() || y > getHeight()){
			   return 0; //Invalid, return 0 
			  }else{
			   //Convert touched x, y on View to on Bitmap
			   int xBm = (int)(x * (bmWidth / getWidth()));
			   int yBm = (int)(y * (bmHeight / getHeight()));
			   return image.getPixel(xBm, yBm); 
			  }
	}
}


Create a new paste based on this one


Comments: