• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
compositing a masked image and printing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compositing a masked image and printing


  • Subject: compositing a masked image and printing
  • From: "Ilja A. Iwas" <email@hidden>
  • Date: Wed, 24 Mar 2004 00:29:13 +0100

Hi list,

I'm having trouble compositing an NSImage object with a custom mask image. My code works like a charm when drawing on screen, but fails when printed out on paper. The mask is not applied when printed, instead I get the whole picture.

Here is a simplified version of my code:

- (void) drawRect:(NSRect) inRect
{
NSImage *temp = [[NSImage alloc] initWithSize:[self bounds].size];
NSImage *mask;

mask = [self maskImage]; // produces a mask image constructed using compositeToPoint: with NSCompositeSourceIn

[temp lockFocus];
[mask compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
[[self image] compositeToPoint:thePoint operation:NSCompositeSourceIn];
[temp unlockFocus];
[temp drawAtPoint:NSZeroPoint
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];
[temp release];
}

I referred to the 'Cropped Image' example for help, but although you can print the cropped image from it, the actual printing code isn't in there.

Please let me know if you have an idea,
Ilja A. Iwas
<www.iwascoding.com>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Converting a string to a number
  • Next by Date: Re: fileHandle writeData not reporting error nor writing data
  • Previous by thread: Re: Converting a string to a number
  • Next by thread: Re: compositing a masked image and printing
  • Index(es):
    • Date
    • Thread