Thank you, I have multiplied all value by 1000. And it works.
BR, Alexander.
On 12.11.2008, at 2:30, Graham Cox wrote:
On 12 Nov 2008, at 9:56 am, Alexander Shmelev wrote:
Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns
Hello
I have custom NSView, and want to draw whole NSImage inside some
custom rectangular area of NSView.
I tried to use [NSImage drawInRect:...] but result does not fit
desired rectangular area of NSView.
My code:
- (void) setPreviewWidth:(float)width height:(float)height
{
Hi Alexander,
Your code will draw the image in maxScanArea. You should probably
look for a bug elsewhere.
I like to replace complex drawing with simple color fills when
debugging drawing location issues. At least it limits what could go
wrong.
-Ken
On Tue, Nov 11, 2008 at 2:17 PM, Alexander
Hi, Ken
Thank you for answer.
But simple color filling was first what I have tried.
When I add following code inside -(void)drawRect method, it fills
exactly maxScanArea:
[[NSColor whiteColor] set];
[NSBezierPath fillRect:maxScanArea];
But -(void)drawInRect:maxScanArea places
On Nov 11, 2008, at 5:17 PM, Alexander Shmelev wrote:
- (void) drawRect:(NSRect)rect
{
// Drawing image in preview
if (image) {
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [image size];
Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns
NSRect(0,0,8.64,14.64). And
maxScanArea = NSRect(0.32, 0.32, 8, 14). So there can be some
approximation to integer value, not float.
But it it is true, how to deal with this?
On
Yes, it is called outside my custom preview code. And values of
maxScanArea, [self bounds] are correct.
Also if I replace [image drawInRect:...] with solid color fill
[NSBezierPath fillRect:maxScanArea], everything works as I expect.
On 12.11.2008, at 1:53, Andy Lee wrote:
On Nov 11, 2008,
On 12 Nov 2008, at 9:56 am, Alexander Shmelev wrote:
Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns
NSRect(0,0,8.64,14.64). And
maxScanArea = NSRect(0.32, 0.32, 8, 14). So there can be some
approximation to integer value, not