• 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
tinting an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tinting an NSImage


  • Subject: tinting an NSImage
  • From: Mark Lilback <email@hidden>
  • Date: Sat, 2 Oct 2004 16:26:54 -0500

I'm working on a project that needs to take a bitmap image provided by the user and transform it so that it will print on a printing press with a single color specified by the user (basically grayscale with an arbitrary color instead of black).

The Monochrome Image sample code shows how to get a grayscale image, but I'd need to switch from NSCalibratedWhiteColorSpace to a color space I create.

I can't find much documentation on NSNamedColorSpace and NSCustomColorSpace, except the docs for NSDrawBitmap() says that NSCustomColorSpace says to use the current colorspace of the graphics context. So I set the colorspace using CGContextSetStrokeColorSpace and CGContextSetFillColorSpace but then [NSBitmapImageRep initWithBitmapDataPlanes:...] reports "Bad colorspace name NSCustomColorSpace".

I've also tried creating a CSImageRef from the monochrome bitmap but substituting a colorspace create with CGColorSpaceCreateCalibratedGray using the desired color as the black point. That doesn't work either.

Does anyone know how to use NSCustomColorSpace and/or NSNamedColorSpace? Or better yet, does anyone have a better idea on how to switch a grayscale image to use another color as the black point?

TIA

--
__________________________________________________________________________
"The fetters imposed on liberty at home have ever
Mark J. Lilback been forged out of the weapons provided for
<email@hidden> defence against real, pretended, or imaginary
http://www.lilback.com/ dangers from abroad." -- James Madison
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: tinting an NSImage
      • From: "R. Scott Thompson" <email@hidden>
    • Re: tinting an NSImage
      • From: "Douglas A. Welton" <email@hidden>
  • Prev by Date: Modeless panel from NSGetAlertPanel
  • Next by Date: Java VM version query, Apache Fop, Java 1.4.2 Update 1
  • Previous by thread: Modeless panel from NSGetAlertPanel
  • Next by thread: Re: tinting an NSImage
  • Index(es):
    • Date
    • Thread