I figured out how to use IKImageViewControlMBS.View.zoomFactor to change the scale/size of an image.
But I’m not having any luck figuring out how to move or drag the image around inside the IKImageViewControlMBS. Is there an example somewhere I’ve missed?
I put this code into a button expecting it to move the zoomed image to the top left corner of the image. It doesn’t do anything. Image stays zoomed in and centered on the bottom left corner of the image.
Var k As IKImageViewControlMBS = IKImageViewControlMBS1
Var x, y, h, w As Integer
Var v As IKImageViewMBS = IKImageViewControlMBS1.View
w = v.Image.Width * v.zoomFactor
h = v.Image.Height * v.zoomFactor
Var r As NSRectMBS = New NSRectMBS(0,0, w , h)
r = v.convertImageRectToViewRect(r)
v.scrollToRect(r)
Var k As IKImageViewControlMBS = IKImageViewControlMBS1
Var v As IKImageViewMBS = IKImageViewControlMBS1.View
v.zoomFactor = 3
this zooms in to 3x.
Then
Var k As IKImageViewControlMBS = IKImageViewControlMBS1
Var v As IKImageViewMBS = IKImageViewControlMBS1.View
Var r As NSRectMBS = v.bounds
var imageVisibleRect as NSRectMBS = v.convertViewRectToImageRect(r)
MessageBox imageVisibleRect.String
gives “{{0, 0}, {200, 117.33333333333333}}” as the visible portion of the image.
But I think there is something broken in IKImageView with scrolling.
scrollToPoint(p)' nothing happens.
Var centerPoint As NSPointMBS
centerPoint = New NSPointMBS(0,0)
Var z As Double = v.zoomFactor
v.setImageZoomFactor(z, centerPoint)' it always zoomed to center, no matter what centerpoint is set to
Looks like I may have to abandon this project. Thanks for your suggestions.
I may be missing something, but it looks like it uses Picture, which changes the display color to a generic RBG color profile instead of using the sRGB color profile in the image.
Yeah, I don’t know what IKImageViewControlMBS does, but on the off chance you just needed a canvas that can be zoomed and panned with the mouse/scrollwheel/trackpad, I happened to have that