Re: Getting immutable UIImage data pointer without copy?
Re: Getting immutable UIImage data pointer without copy?
- Subject: Re: Getting immutable UIImage data pointer without copy?
- From: Rick Mann <email@hidden>
- Date: Tue, 14 Nov 2017 20:37:42 -0800
> On Nov 14, 2017, at 20:18 , Jens Alfke <email@hidden> wrote:
>
>
>
>> On Nov 14, 2017, at 8:11 PM, Rick Mann <email@hidden> wrote:
>>
>> Maybe, at least for the bonus question. The bigger question is around the
>> copy.
>
> Where pixmaps live is a pretty complex issue — ideally they live in the GPU’s
> address space as textures so they can be blitted efficiently, and that’s
> often (depending on your hardware) not accessible to the CPU at all. But
> there’s a lot of logic in CoreGraphics and the underlying graphics engines to
> shuffle the pixmaps back and forth so software can read and write them.
>
> Another factor is that the pixmap may be rescaled or translated into
> different color spaces to optimize rendering it. So there may not exist a
> default rendering of it at the time you request one, meaning CG will generate
> a new pixmap for you. (Also, I dunno about UIImage, but NSImage supports
> image formats like PDF that don’t have a native pixmap representation at all.)
>
> I’m not super into graphics, but my gut feeling is that, if you care about
> optimization details like whether pixmaps are being copied, you should really
> be using a lower-level graphics API than UIImage, which is mostly a
> cheap-and-cheerful convenience layer for apps that just need to splat a few
> PNGs into their GUI.
Well, then let me rephrase it as "unnecessary copies." In this case, I
(currently) need to manipulate the pixels to generate a new image. I will be
moving this to a Metal 2 filter soon enough, but for pre-iOS 11 users, I'd
still like to use as little memory as possible (we use a lot of memory in our
app).
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden