NSBitmapImageRep 和多页 TIFF
我有一个可以打开 TIFF 文档并显示它们的程序。我正在使用 setFlipped:YES。
如果我只处理单页图像文件,我可以
[image setFlipped: YES];
这样做,除了翻转视图之外,似乎还可以正确绘制图像。
然而,由于某种原因,设置图像的翻转似乎不会影响各个表示的翻转。
这是相关的,因为多页 TIFF 的多个图像似乎显示为同一图像的不同“表示”。因此,如果我只绘制图像,它就会翻转,但如果我绘制特定的表示,它就不会翻转。我似乎也不知道如何选择绘制 NSImage 时绘制的默认表示形式。
谢谢。
I've got a program that can open TIFF documents and display them. I'm using setFlipped:YES.
If I'm just dealing with single page image files, I can do
[image setFlipped: YES];
and that, in addition to the view being flipped, seems to draw the image correctly.
However, for some reason, setting the flipped of the image doesn't seem to affect the flippedness of the individual representations.
This is relevant because the multiple images of a multi-page TIFF seem to appear as different "representations" of the same image. So, if I just draw the IMAGE, it's flipped, but if I draw a specific representation, it isn't flipped. I also can't seem to figure out how to chose which representation is the default one that gets drawn when you draw the NSImage.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不应该使用 -setFlipped: 方法来控制图像的绘制方式。您应该根据您正在绘制的上下文的翻转程度来使用转换。像这样的东西(NSImage 上的一个类别):
You shouldn't use the -setFlipped: method to control how the image is drawn. You should use a transform based on the flipped-ness of the context you are drawing into. Something like this (a category on NSImage):
我相信答案是肯定的,不同的页面是单独的表示,处理它们的正确方法是将它们转换为图像:
I believe that the answer is that Yes, different pages are separate representations, and the correct way to deal with them is to turn them into images with: