Hi, I have a view I am trying to capture using the following code:

    NSBitmapImageRep *rep = [view bitmapImageRepForCachingDisplayInRect:[view 
bounds]];
    [view cacheDisplayInRect:[view bounds] toBitmapImageRep:rep];

My view coordinates in a typical test case are as follows:

    "01_frame" = "{{0, 0}, {350, 190}}";
    "02_bounds" = "{{-98, -95}, {350, 190}}";

The image rep created is the right size, but the contents are drawn up and to 
the right in the image rep (by 98,95 pixels).

If I instead use the frame, the contents are in the right place in the image 
rep, but it only includes the portions of the image with positive x and y 
values (bottom right seeing as it's a flipped view).

If I create an image that is bigger by the amount of the negative origins of 
the bounds, the entire thing is drawn, but then I would need to crop the image 
afterwards, which would be very messy and memory hungry since my views can get 
pretty big.

I tried applying an affine transform before grabbing it, but that made no 
difference.

So is it possible to capture views where the bounds go into the negatives, and 
if so, how?

 
TIA

Gideon
_______________________________________________

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

Reply via email to