Coordinate transformation
Hi All,
I have asked this question before but didnt get any reply but i am sure there is a solution.
If i have a 800x800 grid with northing and easting on the server....how can i transform them to be used on the nokia mobile set 6670.
That is if i select a point using a cursor of 1 pixel size on the mobile phone, how can i tell the program that selected point matches northing and easting of the grid on the server.....
I know a transformation is needed but cant figure it out that how can such tranformation take place...the mobile screen is way to small...
Re: Coordinate transformation
It depends on how you are displaying the image. The simplest option is to display it without scaling but only display as much as will fit on screen and keep track of where the origin of the screen image is in relation to the origin of the image (e.g. x and y offsets), converting screen co-ordinates to image co-ordinates is then a case of adding the offsets. If you scale the image when displaying it gets more complicated (need to know ratio of scaling to multiply screen co-ords by).
ee7drs
Re: Coordinate transformation
Do you have any code example of using offsets
Re: Coordinate transformation
The following snippet will draw a section of original_image into screen_image, where the offsets are the co-ordinates in the original image where the top left corner pixel of screen_image is assumed to be. By changing the offsets e.g. using a keyboard handling routine that looks for cursor key presses and refreshing screen_image as below you will get the effect of a moveable window onto your original image
(w,h) = screen_image.size
screen_image.blit(original_image,(offset_x,offset_y),(0,0,w,h))