• 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
NSTextView to Image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView to Image


  • Subject: NSTextView to Image
  • From: Lorenzo <email@hidden>
  • Date: Thu, 15 Jan 2004 18:57:53 +0100

Hi,
I am trying to get an image of a NSTextView so I can later reopen the image
with Photoshop. The problem is that the image I get has a white background.
Instead I need it transparent. I did:

---------------------------
NSRect textRect = NSMakeRect (0.0f, 0.0f, theWidth, theHeight);
NSTextView *textView = [[NSTextView alloc] initWithFrame:textRect];
[textView setBackgroundColor:[NSColor clearColor]];
[textView setDrawsBackground:NO];

[textView setString:@"abcde"];

NSData *pdfData = [textView dataWithPDFInsideRect:[textView bounds]];
[textView release];

NSBitmapImageRep *bitmap;
bitmap = [[NSBitmapImageRep alloc] initWithData:pdfData];
---------------------------

What did cause the background color be white? Is it the pdfData?
How to get the image with a transparent background?
Thank you.

Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
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: Re: Adding my own Properties for Objects
  • Next by Date: Autohiding scrollers/determining visibility
  • Previous by thread: Re: Newbie question about deallocing?
  • Next by thread: Autohiding scrollers/determining visibility
  • Index(es):
    • Date
    • Thread