FROM : Guy English
DATE : Tue Dec 21 22:56:07 2004
Hi,
Once you work out where you are in the image view space you'll
need to transform your point one final step - into the scalled image
space. For this you'll need to know a) how scaled your image and b)
the lower left hand point (or top-left if the view is flipped) of the
visible region of the image (in image space - ie the pixel point).
Then you just do
image_space_click.x = (mouse.x / scale) + image_visible_frame.origin.x
image_space_click.y = (mouse.y / scale) + image_visible_frame.origin.y
Hope fully that helps.
Guy
On 21 Dec 2004 07:26:15 -0000, Anish Kumar <<email_removed>> wrote:
>
>
> Hi All,
>
> Can anyone please tell me how to get the "Pixel position" of a pixel that
> is currently under
> the mouse for an image that is displayed in a sub-class of NSView. I know
> how to get the
> current mouse location in the image views co-ordinates, but I can't use
> this value in my
> application for the following reason.
>
> Basically I am developing an annotation feature for my application (Similar
> to ACROBAT's
> annotation feature) and the user can enter their comments/annotation for
> the image and a
> icon will be placed on the location where the annotation was made to the
> image. Clicking
> the icon will display the annotation that was made there.
>
> The problem I face here is:- as long as the image is not zoomed, the
> annotation icons are in
> their correct position. When I zoom the image, the icons are misplaced as I
> am using the
> mouse locations for placing the icons to the image. Now if I use the PIXEL
> POSITION in the
> image instead of the mouse location I can place the annotation icons at the
> correct pixel
> position irrespective of the zoom-level of the image.
>
> So can anyone please tell me how to get the pixel-positions in an image.(
> something similar
> to Adobe photoshop's INFO window, where they display the X-Y coordinates
> of the cursor,
> that doesn't change for a particular position in the image even if the
> image is zoomed
> (zoom-in or zoom-out) to any level.
>
> thanks in advance,
> -Anish
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/guy.<email_removed>
>
> This email sent to guy.<email_removed>
>
>
DATE : Tue Dec 21 22:56:07 2004
Hi,
Once you work out where you are in the image view space you'll
need to transform your point one final step - into the scalled image
space. For this you'll need to know a) how scaled your image and b)
the lower left hand point (or top-left if the view is flipped) of the
visible region of the image (in image space - ie the pixel point).
Then you just do
image_space_click.x = (mouse.x / scale) + image_visible_frame.origin.x
image_space_click.y = (mouse.y / scale) + image_visible_frame.origin.y
Hope fully that helps.
Guy
On 21 Dec 2004 07:26:15 -0000, Anish Kumar <<email_removed>> wrote:
>
>
> Hi All,
>
> Can anyone please tell me how to get the "Pixel position" of a pixel that
> is currently under
> the mouse for an image that is displayed in a sub-class of NSView. I know
> how to get the
> current mouse location in the image views co-ordinates, but I can't use
> this value in my
> application for the following reason.
>
> Basically I am developing an annotation feature for my application (Similar
> to ACROBAT's
> annotation feature) and the user can enter their comments/annotation for
> the image and a
> icon will be placed on the location where the annotation was made to the
> image. Clicking
> the icon will display the annotation that was made there.
>
> The problem I face here is:- as long as the image is not zoomed, the
> annotation icons are in
> their correct position. When I zoom the image, the icons are misplaced as I
> am using the
> mouse locations for placing the icons to the image. Now if I use the PIXEL
> POSITION in the
> image instead of the mouse location I can place the annotation icons at the
> correct pixel
> position irrespective of the zoom-level of the image.
>
> So can anyone please tell me how to get the pixel-positions in an image.(
> something similar
> to Adobe photoshop's INFO window, where they display the X-Y coordinates
> of the cursor,
> that doesn't change for a particular position in the image even if the
> image is zoomed
> (zoom-in or zoom-out) to any level.
>
> thanks in advance,
> -Anish
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/guy.<email_removed>
>
> This email sent to guy.<email_removed>
>
>
| Related mails | Author | Date |
|---|---|---|
| Anish Kumar | Dec 21, 08:26 | |
| Guy English | Dec 21, 22:56 |






Cocoa mail archive

