I am completely lost and needed some help. I have a ontouchListener for a bitmap and know how to check if the touch was within the boundaries of the bitmap. But say I want the center of the image to be at a custom coordinate like [0,0] and the entire image to be in the range of [-319...319] and [-239...239] . Does any one have any thoughts on how to best implement an eventX and eventY to a custom coordinate pair?
If you need just to take into account a displacement, you simply have to know where your origin is in standard coordinate system (the one the listener returns).
Say that your (0,0) is at (150,322), this means that when you get P = (x,y) you can get P' = (x-150,y-322) to get the point in your coordinate system.
To make it clean try to transform your origin P = (x=150,y=322) => P' = (150-150,322-322) = (0,0); lets take a point that is 100 pixel on the right to your origin: P = (250,322) => P' = (250-150,322-322) = (100,0), that is what you need.
If your coordinate system is not simply a displacement of the one your system provides (rotation, shear, scale involved), a change of homogeneus coordinate system is required.
As pointed out, the requirement is that the coordinate system has to produce the same range coordinate even if the view area resizes.
I assume that the aspect-ratio of the view and the scaled coordinate system is not an issue.
Let say that the dimensions of your view area size is W x H and your system gives you values for x and y so x: [0,W] and y: [0,H]; we want that the transformed value to be x: [-w,w] and y: [-h,h]. Let start by computing the transformed x:
x' = x/W => x : [0,1];
x' = x/W · (2w) => x : [0,2w];
x' = ( x/W · (2w) ) - w => x' : [-w,w] and hence
y' = (y/H · (2h) ) - h => y' : [-h,h].
You have to know - or ask the view for - W and H and set w = 319 and h = 239.