dataWithPDFInsideRect doesn't clip images within NSView
I draw an NSImage within an NSView scaling its size in order to fill the image within the view bounds. The image is larger than the NSView's bounds, but on the display it looks well clipped to those bounds. Since the image's NSView is a subView of the page's NSView, I create a PDF saving that page's NSView [pageView dataWithPDFInsideRect:pageRect]; and I get a pdf file. Anyway, when I inspect the pdf file with Acrobat, I clearly see that the image hasn't been cropped. As I see from the blue rectangle around the visible small image, the whole original and larger image has been embedded within the pdf document. In facts if I Control-Click-Edit the image on the pdf, I get the original whole image. So the pdf file size results bigger than what it would really be. I don't get this trouble when saving the page to a TIFF or any other raster image file (with NSBitmapImageRep - CGImage - displayRectIgnoringOpacity - CGImageDestinationFinalize). My question: Do you know an option, any API, to clip the image to its NSView's frame on the pdf, as it properly looks on the display? Or should I clip the image by my own code? Regards -- Leonardo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: dataWithPDFInsideRect doesn't clip images within NSView
On 27 Feb 2014, at 9:31 pm, Leonardo mac.iphone@gmail.com wrote: I draw an NSImage within an NSView scaling its size in order to fill the image within the view bounds. The image is larger than the NSView's bounds, but on the display it looks well clipped to those bounds. Since the image's NSView is a subView of the page's NSView, I create a PDF saving that page's NSView [pageView dataWithPDFInsideRect:pageRect]; and I get a pdf file. Anyway, when I inspect the pdf file with Acrobat, I clearly see that the image hasn't been cropped. As I see from the blue rectangle around the visible small image, the whole original and larger image has been embedded within the pdf document. In facts if I Control-Click-Edit the image on the pdf, I get the original whole image. So the pdf file size results bigger than what it would really be. I don't get this trouble when saving the page to a TIFF or any other raster image file (with NSBitmapImageRep - CGImage - displayRectIgnoringOpacity - CGImageDestinationFinalize). This is exactly what you'd expect. Core Graphics basically *is* a PDF. So when you draw an image into a view that is clipped, all you're doing is setting a clipping path and drawing an image. The PDF faithfully records that. When you create a different image that is clipped to the smaller area, then that's what is recorded. My question: Do you know an option, any API, to clip the image to its NSView's frame on the pdf, as it properly looks on the display? Or should I clip the image by my own code? When you know how it works, the question becomes moot. The short answer is 'no', there's no API. You have to resample/crop the image as you need, or accept the larger filesize for the convenience that you get from the simple API. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
information about provisioning and code signing - in code
Hey there, I know on 10.6+ you can use SecStaticCodeCreateWithPath and friends to verify the app signature in code. Is there also a way on iOS to somehow access information about things like provisioning profile/certificate from within the app? Ideally I would like to get access to the provisioning profile's uuid from within the app. Any pointers? cheers, Torsten ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFetchedResultsController sort on synthesized property?
The fetched results controller needs to be able to do its sorting in the database (assuming a SQLite store). The section keypath itself doesn't necessarily need to be a persistent property, as long as its values match the ordering of the sort descriptors. (For instance: a table that sections the results by day might have a transient property that calculates the day from the date, but actually sorts the results by the persistent date property.) Sixten On Wed, Feb 26, 2014 at 9:21 PM, Rick Mann rm...@latencyzero.com wrote: It seems that I can't sort on a read-only synthesized property in my NSManagedObject subclass. I'd like to sort a bunch of stuff into some sections, but the definition of a section is somewhat complex, depending on multiple other properties. So, I defined a property section like this: - (NSUInteger) section { if (self.active.boolValue) { return 1; } else if (self.dateClosed != nil) { return 3; } else { return 2; } } + (NSSet*) keyPathsForValuesAffectingSection { return [NSSet setWithObjects: @active, @dateClosed, nil]; } I similarly define a sectionName property, but the NSFetchedResultsController has no problem using that to section the table view. Unfortunately, I get an exception when I attempt to execute the fetch while sorting on section. Is there any way to accomplish what I need? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/himself%40sfko.com This email sent to hims...@sfko.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Issues with CIFilters and CALayers
First a note. The name property is declared as a CACIFilterAdditions in CACIFilterAdditions.h. I think you will need to draw the CIImage to your CIContext and then generate a CGImage to capture its state for future reference and then generate a new CIImage from the CGImage. I believe the CIImage that is the output of a filter is more a recipe about how to generate an image and not a bitmap representation of the image which I think is where your problem lies. Kevin Sent from my iPhone On 24 Feb 2014, at 17:28, Gordon Apple g...@ed4u.com wrote: Apparently, my comment about not understanding this construct for setValueForKeyPath was correct. It actually works. I finally got the highlighting filter to work and update properly. Now I¹m trying to do something much simpler, i.e., construct a freezeFilter. Nothing I¹ve tried so far works. Apparently, a CIFilter is expected to be stateless function such as outputImage = f(inputImage, parameters). Not accepting this premiss, I decided to try caching the first output image ( from the outputImage method), then return the cashed image thereafter, an ultra simple concept, except that it does not work. Any reason, besides what I postulated, why this shouldn¹t work? On 2/23/14 3:06 PM, Gordon Apple g...@ed4u.com wrote: We have run into a number is issues trying to use CIFilters with CALayers: 1. When a layer is hidden, its filters, especially background filters, should be temporarily removed, or at least bypassed. Hiding the layer should make if effectively non-existent in the displayed layer stack. 2. The docs should tell you that in a CIFilter you cannot auto-synthesize filter input parameters. This simply does not work, especially for inputImage. 3. The docs for CALayer filters and background filters say you should name your filters for use in changing parameters. I.e., filter.name = @²myFilter². Amazingly, this works, in spite of the fact that there is no public property called ³name² for a CIFilter. 4. The example keyPath makes no sense whatsoever, unless we just don¹t understand keyPaths: [layer setValue:XXX forKeyPath:@²backgroundFilters.myFilter.filterParam²]; backgroundFilters is an array of filters. myFilter is a property value of some element of the array. (huh?) 5. We need some decent documentation of what in GL Shading Language is actually relevant to writing ciKernels, besides the one page addendum provided. 6. And, of course, the problem we have already mentioned in a previous post about getting a CALayer to update when a filter parameter is changed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/ktam%40yvs.eu.com This email sent to k...@yvs.eu.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: dataWithPDFInsideRect doesn't clip images within NSView
Thank you. I have coded it. I lock the focus of the NSView, I draw and get the clipped image, then I re-draw the NSView with the clipped image + borders, rotation, shadow. Of course, since the user could choose the ppi output, I resize-resample the view before locking it. It should be useful to have an option as [view dataWithPDFInsideRect:bounds clipPaths:YES]; Regards -- Leonardo Da: Graham Cox graham@bigpond.com Data: Thu, 27 Feb 2014 22:38:42 +1100 A: Leonardo mac.iphone@gmail.com Cc: Cocoa-dev List List cocoa-dev@lists.apple.com Oggetto: Re: dataWithPDFInsideRect doesn't clip images within NSView On 27 Feb 2014, at 9:31 pm, Leonardo mac.iphone@gmail.com wrote: I draw an NSImage within an NSView scaling its size in order to fill the image within the view bounds. The image is larger than the NSView's bounds, but on the display it looks well clipped to those bounds. Since the image's NSView is a subView of the page's NSView, I create a PDF saving that page's NSView [pageView dataWithPDFInsideRect:pageRect]; and I get a pdf file. Anyway, when I inspect the pdf file with Acrobat, I clearly see that the image hasn't been cropped. As I see from the blue rectangle around the visible small image, the whole original and larger image has been embedded within the pdf document. In facts if I Control-Click-Edit the image on the pdf, I get the original whole image. So the pdf file size results bigger than what it would really be. I don't get this trouble when saving the page to a TIFF or any other raster image file (with NSBitmapImageRep - CGImage - displayRectIgnoringOpacity - CGImageDestinationFinalize). This is exactly what you'd expect. Core Graphics basically *is* a PDF. So when you draw an image into a view that is clipped, all you're doing is setting a clipping path and drawing an image. The PDF faithfully records that. When you create a different image that is clipped to the smaller area, then that's what is recorded. My question: Do you know an option, any API, to clip the image to its NSView's frame on the pdf, as it properly looks on the display? Or should I clip the image by my own code? When you know how it works, the question becomes moot. The short answer is 'no', there's no API. You have to resample/crop the image as you need, or accept the larger filesize for the convenience that you get from the simple API. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: dataWithPDFInsideRect doesn't clip images within NSView
A PDF file can reuse an image and draw the same thing multiple times in multiple places. If it saved just the clipped version, it would need multiple copies of the same image, which would actually increase the file size. So if the purpose of adding a cropImages flags was to save file space, in some case it will result in taking more space. Furthermore, if the image is a jpg image, clipping would need the image to be recompressed and end up degrading the image quality (since PDFs can embed jpg files directly), or again, potentially increase the file size. And if you draw a PDF image inside the view, those PDF instructions/objects are encoded into the resulting file - if you want to clip that, you either need to rasterize it (loosing quality) or perform clipping operations on shapes to produce new ones (which can be non-trivial). On Feb 27, 2014, at 9:57 AM, Leonardo mac.iphone@gmail.com wrote: Thank you. I have coded it. I lock the focus of the NSView, I draw and get the clipped image, then I re-draw the NSView with the clipped image + borders, rotation, shadow. Of course, since the user could choose the ppi output, I resize-resample the view before locking it. It should be useful to have an option as [view dataWithPDFInsideRect:bounds clipPaths:YES]; Regards -- Leonardo Da: Graham Cox graham@bigpond.com Data: Thu, 27 Feb 2014 22:38:42 +1100 A: Leonardo mac.iphone@gmail.com Cc: Cocoa-dev List List cocoa-dev@lists.apple.com Oggetto: Re: dataWithPDFInsideRect doesn't clip images within NSView On 27 Feb 2014, at 9:31 pm, Leonardo mac.iphone@gmail.com wrote: I draw an NSImage within an NSView scaling its size in order to fill the image within the view bounds. The image is larger than the NSView's bounds, but on the display it looks well clipped to those bounds. Since the image's NSView is a subView of the page's NSView, I create a PDF saving that page's NSView [pageView dataWithPDFInsideRect:pageRect]; and I get a pdf file. Anyway, when I inspect the pdf file with Acrobat, I clearly see that the image hasn't been cropped. As I see from the blue rectangle around the visible small image, the whole original and larger image has been embedded within the pdf document. In facts if I Control-Click-Edit the image on the pdf, I get the original whole image. So the pdf file size results bigger than what it would really be. I don't get this trouble when saving the page to a TIFF or any other raster image file (with NSBitmapImageRep - CGImage - displayRectIgnoringOpacity - CGImageDestinationFinalize). This is exactly what you'd expect. Core Graphics basically *is* a PDF. So when you draw an image into a view that is clipped, all you're doing is setting a clipping path and drawing an image. The PDF faithfully records that. When you create a different image that is clipped to the smaller area, then that's what is recorded. My question: Do you know an option, any API, to clip the image to its NSView's frame on the pdf, as it properly looks on the display? Or should I clip the image by my own code? When you know how it works, the question becomes moot. The short answer is 'no', there's no API. You have to resample/crop the image as you need, or accept the larger filesize for the convenience that you get from the simple API. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/gandreas%40me.com This email sent to gandr...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Issues with CIFilters and CALayers
Thank you. I would have never found that. But what does “enabled” do? Or, more precisely, what does “not enabled” do? If a filter is not enabled, does that mean it is transparent and simply passes input to output? I can’t believe something so simple in concept as a freeze filter is so difficult to implement. CIFilters are black magic. They just don’t seem to follow the usual expectations of software constructs. I did get my highlighting filter to work, using color blend and/or a GaussianBlur embedded filter for the background, with controllable parameters. The user can even live-draw and edit the clear areas of the filter (used as a transient layer in a presentation layer stack). It provides a very nice effect for drawing attention to specific areas. On 2/27/14 9:42 AM, Kevin Meaney k...@yvs.eu.com wrote: First a note. The name property is declared as a CACIFilterAdditions in CACIFilterAdditions.h. I think you will need to draw the CIImage to your CIContext and then generate a CGImage to capture its state for future reference and then generate a new CIImage from the CGImage. I believe the CIImage that is the output of a filter is more a recipe about how to generate an image and not a bitmap representation of the image which I think is where your problem lies. Kevin Sent from my iPhone On 24 Feb 2014, at 17:28, Gordon Apple g...@ed4u.com wrote: Apparently, my comment about not understanding this construct for setValueForKeyPath was correct. It actually works. I finally got the highlighting filter to work and update properly. Now I¹m trying to do something much simpler, i.e., construct a freezeFilter. Nothing I¹ve tried so far works. Apparently, a CIFilter is expected to be stateless function such as outputImage = f(inputImage, parameters). Not accepting this premiss, I decided to try caching the first output image ( from the outputImage method), then return the cashed image thereafter, an ultra simple concept, except that it does not work. Any reason, besides what I postulated, why this shouldn¹t work? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Issues with CIFilters and CALayers
I don't know. I'm not actually trying to integrate CIFilters and Core Animation in the way that you are doing. I remembered that you had mentioned the name property of the CIFilter because that property is actually useful to me, because I need a way to refer to filters which are earlier in the filter chain and the name seems like a useful way to find a filter that I want. Kevin On 27 Feb 2014, at 17:38, Gordon Apple g...@ed4u.com wrote: Thank you. I would have never found that. But what does “enabled” do? Or, more precisely, what does “not enabled” do? If a filter is not enabled, does that mean it is transparent and simply passes input to output? I can’t believe something so simple in concept as a freeze filter is so difficult to implement. CIFilters are black magic. They just don’t seem to follow the usual expectations of software constructs. I did get my highlighting filter to work, using color blend and/or a GaussianBlur embedded filter for the background, with controllable parameters. The user can even live-draw and edit the clear areas of the filter (used as a transient layer in a presentation layer stack). It provides a very nice effect for drawing attention to specific areas. On 2/27/14 9:42 AM, Kevin Meaney k...@yvs.eu.com wrote: First a note. The name property is declared as a CACIFilterAdditions in CACIFilterAdditions.h. I think you will need to draw the CIImage to your CIContext and then generate a CGImage to capture its state for future reference and then generate a new CIImage from the CGImage. I believe the CIImage that is the output of a filter is more a recipe about how to generate an image and not a bitmap representation of the image which I think is where your problem lies. Kevin Sent from my iPhone On 24 Feb 2014, at 17:28, Gordon Apple g...@ed4u.com wrote: Apparently, my comment about not understanding this construct for setValueForKeyPath was correct. It actually works. I finally got the highlighting filter to work and update properly. Now I¹m trying to do something much simpler, i.e., construct a freezeFilter. Nothing I¹ve tried so far works. Apparently, a CIFilter is expected to be stateless function such as outputImage = f(inputImage, parameters). Not accepting this premiss, I decided to try caching the first output image ( from the outputImage method), then return the cashed image thereafter, an ultra simple concept, except that it does not work. Any reason, besides what I postulated, why this shouldn¹t work? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash in -URLByResolvingBookmarkData::::: in sandboxed app
Hi Markus, We ran into this same problem recently too (http://prod.lists.apple.com/archives/cocoa-dev/2013/Nov/msg00024.html). We spent a quite a bit of time trying to resolve it. After using a DTS incident with Apple, the conclusion was that this is simply a bug in NSURL. It was fixed in 10.9.0, but there’s no simple fix for it on 10.7 and 10.8. For what it’s worth, I don’t think the crash is specific to app termination. We saw it occasionally, and completely unpredictably, in any code that resolved security scoped bookmarks. I wrote a very simple, small test app that simply obtained bookmarks for a big folder (e.g. ~/Music), then infinitely looped through resolving those bookmarks as quickly as possible. It would reliably crash, usually within an hour, and often much more quickly. Experimentally, we determined that it only crashes when resolving a bookmark with security scope (ie. passing the NSURLBookmarkResolutionWithSecurityScope option). Our workaround was to add a temporary exception entitlement so we can read the entire filesystem, then resolve our bookmarks without using the security scope option. We still obtain security scoped bookmarks so that we can do away with the whole-hard-drive exception when we move to requiring 10.9. Our app is sandboxed, but not sold on the app store so this works OK. However, the app store review team seems very unlikely to approve an app with an exception entitlement like that. So if you’re intending to sell the app on the app store, the only true fix is probably to require 10.9. -Andrew Madsen On Feb 19, 2014, at 8:03 AM, Markus Spoettl ms_li...@shiftoption.com wrote: Hi, I keep getting a crash in my sandboxed app when it terminates. It is not 100% reproducible, but it happens a couple of times a day while working on the app, both when run from Xcode and started from Finder. Part of the termination cleanup requires me to decode a bookmark that was stored in the user defaults previously (same app, same session). NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@mykey]; if ((data != nil) ([data isKindOfClass:[NSData class]])) { BOOL stale = NO; result = [NSURL URLByResolvingBookmarkData:data options:NSURLBookmarkResolutionWithoutUI | NSURLBookmarkResolutionWithoutMounting | NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:stale error:error]; } I call this same method in various places and it works fine, but during app termination it sometimes just crashes. Has anyone seen this? If so, is there any way to avoid it crashing like that? I'm on OSX 10.8.5 with Xcode 4.6.3, base SDK is 10.7. Regards Markus The exception details and callstack of the crash is this: Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0002, 0x Application Specific Information: *** __CFTypeCollectionRetain() called with NULL; likely a collection has been corrupted *** Performing @selector(terminate:) from sender NSMenuItem 0x7fb330c2aef0 #00x7fff94b92711 in __CFTypeCollectionRetain () #10x7fff94bbfac2 in __CFDictionaryRetainValue () #20x7fff94b91b8a in __CFBasicHashAddValue () #30x7fff94b98268 in CFBasicHashAddValue () #40x7fff94bcbe5f in CFDictionaryCreate () #50x7fff94bd273c in CFErrorCreateWithUserInfoKeysAndValues () #60x7fff95107ff2 in reportErrorForURL(__CFError**, long, __CFURL const*) () #70x7fff950ef037 in _CFURLCreateByResolvingBookmarkData () #80x7fff94c4ae5e in +[NSURL URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:] () #90x000100113588 in -[MyController getURL] at /Users/markus/Projects/MyController.m:187 -- __ Markus Spoettl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/lists%40openreelsoftware.com This email sent to li...@openreelsoftware.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFetchedResultsController sort on synthesized property?
Thanks, Sixten. I had hoped that if it couldn't translate a sort descriptor in to SQL, that it would apply it after fetching. On Feb 27, 2014, at 06:14 , Sixten Otto hims...@sfko.com wrote: The fetched results controller needs to be able to do its sorting in the database (assuming a SQLite store). The section keypath itself doesn't necessarily need to be a persistent property, as long as its values match the ordering of the sort descriptors. (For instance: a table that sections the results by day might have a transient property that calculates the day from the date, but actually sorts the results by the persistent date property.) Sixten On Wed, Feb 26, 2014 at 9:21 PM, Rick Mann rm...@latencyzero.com wrote: It seems that I can't sort on a read-only synthesized property in my NSManagedObject subclass. I'd like to sort a bunch of stuff into some sections, but the definition of a section is somewhat complex, depending on multiple other properties. So, I defined a property section like this: - (NSUInteger) section { if (self.active.boolValue) { return 1; } else if (self.dateClosed != nil) { return 3; } else { return 2; } } + (NSSet*) keyPathsForValuesAffectingSection { return [NSSet setWithObjects: @active, @dateClosed, nil]; } I similarly define a sectionName property, but the NSFetchedResultsController has no problem using that to section the table view. Unfortunately, I get an exception when I attempt to execute the fetch while sorting on section. Is there any way to accomplish what I need? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/himself%40sfko.com This email sent to hims...@sfko.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com This email sent to rm...@latencyzero.com -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: dataWithPDFInsideRect doesn't clip images within NSView
Thank you Glenn. You are right. Furthermore, if the image is a jpg image, clipping would need the image to be recompressed and end up degrading the image quality (since PDFs can embed jpg files directly), or again, potentially increase the file size. Yes, I thought about that. And I have indeed seen that small but real degradation. Not so fine. At the end I left the world as is. And if you draw a PDF image inside the view, those PDF instructions/objects are encoded into the resulting file - if you want to clip that, you either need to rasterize it (loosing quality) or perform clipping operations on shapes to produce new ones (which can be non-trivial). I though to not to clip the vectorial images, but as I wrote above... At this time, I am struggling with the QuartzFilter to compress the pdf :-) I'm going to post a new question since it sounds as a different topic. Regards -- Leonardo Da: glenn andreas gandr...@me.com Data: Thu, 27 Feb 2014 10:20:58 -0600 A: Leonardo mac.iphone@gmail.com Cc: Cocoa-dev List List cocoa-dev@lists.apple.com Oggetto: Re: dataWithPDFInsideRect doesn't clip images within NSView A PDF file can reuse an image and draw the same thing multiple times in multiple places. If it saved just the clipped version, it would need multiple copies of the same image, which would actually increase the file size. So if the purpose of adding a cropImages flags was to save file space, in some case it will result in taking more space. Furthermore, if the image is a jpg image, clipping would need the image to be recompressed and end up degrading the image quality (since PDFs can embed jpg files directly), or again, potentially increase the file size. And if you draw a PDF image inside the view, those PDF instructions/objects are encoded into the resulting file - if you want to clip that, you either need to rasterize it (loosing quality) or perform clipping operations on shapes to produce new ones (which can be non-trivial). On Feb 27, 2014, at 9:57 AM, Leonardo mac.iphone@gmail.com wrote: Thank you. I have coded it. I lock the focus of the NSView, I draw and get the clipped image, then I re-draw the NSView with the clipped image + borders, rotation, shadow. Of course, since the user could choose the ppi output, I resize-resample the view before locking it. It should be useful to have an option as [view dataWithPDFInsideRect:bounds clipPaths:YES]; Regards -- Leonardo Da: Graham Cox graham@bigpond.com Data: Thu, 27 Feb 2014 22:38:42 +1100 A: Leonardo mac.iphone@gmail.com Cc: Cocoa-dev List List cocoa-dev@lists.apple.com Oggetto: Re: dataWithPDFInsideRect doesn't clip images within NSView On 27 Feb 2014, at 9:31 pm, Leonardo mac.iphone@gmail.com wrote: I draw an NSImage within an NSView scaling its size in order to fill the image within the view bounds. The image is larger than the NSView's bounds, but on the display it looks well clipped to those bounds. Since the image's NSView is a subView of the page's NSView, I create a PDF saving that page's NSView [pageView dataWithPDFInsideRect:pageRect]; and I get a pdf file. Anyway, when I inspect the pdf file with Acrobat, I clearly see that the image hasn't been cropped. As I see from the blue rectangle around the visible small image, the whole original and larger image has been embedded within the pdf document. In facts if I Control-Click-Edit the image on the pdf, I get the original whole image. So the pdf file size results bigger than what it would really be. I don't get this trouble when saving the page to a TIFF or any other raster image file (with NSBitmapImageRep - CGImage - displayRectIgnoringOpacity - CGImageDestinationFinalize). This is exactly what you'd expect. Core Graphics basically *is* a PDF. So when you draw an image into a view that is clipped, all you're doing is setting a clipping path and drawing an image. The PDF faithfully records that. When you create a different image that is clipped to the smaller area, then that's what is recorded. My question: Do you know an option, any API, to clip the image to its NSView's frame on the pdf, as it properly looks on the display? Or should I clip the image by my own code? When you know how it works, the question becomes moot. The short answer is 'no', there's no API. You have to resample/crop the image as you need, or accept the larger filesize for the convenience that you get from the simple API. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/gandreas%40me.com This email sent to gandr...@me.com ___
Reduce PDF with QuartzFilter
In the past I successfully created and used QuartzFilter from within my Cocoa app for OS X and saved pdf files. But now it seems that I am missing something. I have just created 2 filters with ColorSync Utility, one with ImageJPEGCompress Compression Quality 1 (MinComp.qfilter) and one with ImageJPEGCompress Compression Quality -1 (MaxComp.qfilter). If I use them from within the application Preview, they work well. I get a 146KB file and a 1.5MB file. Now I use the filters from within my app, this way: filePath = [myBundle pathForResource:@MinComp ofType:@qfilter]; filterDict = [NSMutableDictionary dictionaryWithContentsOfFile:filePath]; filter = [[QuartzFilterManager filterManager] importFilter:filterDict]; options = [NSDictionary dictionaryWithObject:filter forKey:@QuartzFilter]; saved = [pdfDoc pdfPath withOptions:options]; I save 2 pdf files containing the same image I used in the app Preview (see above), one using the min filter, and one using the max filter The 2 PDF have the same byte size: 2.3MB. And I can't found the bug. I work with Xcode 5 and OS X 10.8.5. Target: OS X 10.8. I have linked the libs: Quartz.framework, QuartzCore.framework, AppKit.framework... That's my MaxComp filter. Above it's my code. What do I miss? ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; plist version=1.0 dict keyDomains/key dict keyApplications/key true/ keyPrinting/key true/ /dict keyFilterData/key dict keyColorSettings/key dict keyImageSettings/key dict keyCompression Quality/key real-1/real keyImageCompression/key stringImageJPEGCompress/string keyImageScaleSettings/key dict keyImageResolution/key integer300/integer keyImageScaleFactor/key real0.0/real keyImageScaleInterpolate/key integer2/integer keyImageSizeMax/key integer0/integer keyImageSizeMin/key integer0/integer /dict /dict /dict keyPDF/X-3 Settings/key dict keyAddBleedBox/key true/ keyAddTrimBox/key true/ keyFlattenTransparency/key true/ keyFlattenTransparencyResolution/key array real300.0/real real300.0/real /array keyInfo/key string/string keyOutputCondition/key stringCGATS TR 001 SWOP/string keyOutputConditionIdentifier/key stringCGATS TR 001/string keyRegistryName/key stringhttp://www.color.org/string keyTrapped/key true/ /dict /dict keyFilterType/key integer1/integer keyName/key stringMaxComp/string /dict /plist Regards -- Leonardo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disabling screen capture
On Feb 23, 2014, at 11:13 PM, Bradley O'Hearne br...@bighillsoftware.com wrote: So I’ll try the Developer Program support phone number tomorrow, but beyond that, there’s not much left to try. The DTS web form seems to be the only game in town. …and the end of the matter: I got through to DTS. After a brief exchange, here was the resolution: Please file a bug listing all of this out and send me the bug number. “ Except that my original question started with…the fact that already had filed a bug, and had sent DTS the bug number. fin Brad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com