Re: [iPhone] more UIScrollView

2010-06-02 Thread David Duncan
On Jun 1, 2010, at 9:00 PM, Development wrote:

> That's pretty much where I started with this code. However it's still fuzzy.
> I can scale the view itself and it's perfectly clear but the origin is all 
> messed up and it's offset halfway out of it's parent view. thats what I tried 
> here:CGContextScaleCTM(context, scle,scle);
> 
> I've attempted to scale the bounds of the view itself, redraw the content and 
> then adjust the size  of the scrollview's content but that ends up being the 
> same mess as before. I was hoping I could get a little more information on 
> rendering an image.


The tiled layer will generally only be sharp when you have a power of two zoom. 
If you are willing to do a LOT more work you can make this better, and a 
reasonable starting point might be the ScrollViewSuite tiling example. That 
example however scales down larger images, which may still be fuzzy in some 
cases (for example line art). Getting pixel perfect zooming however is 
difficult and to rather performance intensive for something like PDF.

You could also try just using a UIWebView for displaying PDF if it does what 
you need.
--
David Duncan
Apple DTS Animation and Printing

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] more UIScrollView

2010-06-01 Thread Scott Anguish
are you using the right kind of view as described in the doc?


On Jun 2, 2010, at 12:00 AM, Development wrote:

> That's pretty much where I started with this code. However it's still fuzzy.
> I can scale the view itself and it's perfectly clear but the origin is all 
> messed up and it's offset halfway out of it's parent view. thats what I tried 
> here:CGContextScaleCTM(context, scle,scle);
> 
> I've attempted to scale the bounds of the view itself, redraw the content and 
> then adjust the size  of the scrollview's content but that ends up being the 
> same mess as before. I was hoping I could get a little more information on 
> rendering an image.
> 
> On Jun 1, 2010, at 8:38 PM, Scott Anguish wrote:
> 
>> The last portion of chapter the Basic Scrolling Using the Pinch Gestures in 
>> ScrollView Programming Guide for iPhone  is called
>> 
>> Ensuring that Zoomed Content is Sharp when Zoomed
>> 
>> It has an example (engineering approved) way of handling this. It isn’t the 
>> greatest solution available, but it is the currently recommended method.
>> 
>> 
>> 
>> On Jun 1, 2010, at 11:03 PM, Development wrote:
>> 
>>> Ok, well I've worked out most of the other issues I've run in to. However 
>>> the one I am now unable to really figure out has to do with zooming scroll 
>>> view contents and winding up with a clear image. The problem is that I'm 
>>> not getting a clear image.
>>> Is it possible to use the built in zooming methods to zoom an image and 
>>> keep it clear or do I have to basically implement my own zooming methods. I 
>>> read the zooming docs and unfortunately they did not help me to understand 
>>> what to do.
>>> 
>>> This is the drawing code from the view that is being zoomed.
>>> 
>>> -(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
>>> {
>>> 
>>> CGRect newRect = self.bounds;
>>> float scle =CGContextGetCTM(context).a;
>>> 
>>> CGRect rect =CGContextGetClipBoundingBox(context);
>>> 
>>> CGContextSaveGState(context);
>>> CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
>>> CGContextFillRect(context,self.bounds);
>>> CGContextTranslateCTM(context, 0.0, newRect.size.height);
>>> CGContextScaleCTM(context, 1.0, -1.0);
>>> CGContextScaleCTM(context, scle,scle);
>>> 
>>> CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(myPage, 
>>> kCGPDFCropBox, newRect, 0, true);
>>> CGContextConcatCTM(context, pdfTransform);
>>> CGContextDrawPDFPage(context, myPage);
>>> 
>>> CGContextRestoreGState(context);
>>> }
>>> 
>>> ___
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
>>> 
>>> This email sent to sc...@cocoadoc.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] more UIScrollView

2010-06-01 Thread Development
That's pretty much where I started with this code. However it's still fuzzy.
I can scale the view itself and it's perfectly clear but the origin is all 
messed up and it's offset halfway out of it's parent view. thats what I tried 
here:CGContextScaleCTM(context, scle,scle);

I've attempted to scale the bounds of the view itself, redraw the content and 
then adjust the size  of the scrollview's content but that ends up being the 
same mess as before. I was hoping I could get a little more information on 
rendering an image.

On Jun 1, 2010, at 8:38 PM, Scott Anguish wrote:

> The last portion of chapter the Basic Scrolling Using the Pinch Gestures in 
> ScrollView Programming Guide for iPhone  is called
> 
> Ensuring that Zoomed Content is Sharp when Zoomed
> 
> It has an example (engineering approved) way of handling this. It isn’t the 
> greatest solution available, but it is the currently recommended method.
> 
> 
> 
> On Jun 1, 2010, at 11:03 PM, Development wrote:
> 
>> Ok, well I've worked out most of the other issues I've run in to. However 
>> the one I am now unable to really figure out has to do with zooming scroll 
>> view contents and winding up with a clear image. The problem is that I'm not 
>> getting a clear image.
>> Is it possible to use the built in zooming methods to zoom an image and keep 
>> it clear or do I have to basically implement my own zooming methods. I read 
>> the zooming docs and unfortunately they did not help me to understand what 
>> to do.
>> 
>> This is the drawing code from the view that is being zoomed.
>> 
>> -(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
>> {
>> 
>>  CGRect newRect = self.bounds;
>>  float scle =CGContextGetCTM(context).a;
>> 
>>  CGRect rect =CGContextGetClipBoundingBox(context);
>> 
>>  CGContextSaveGState(context);
>>  CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
>>  CGContextFillRect(context,self.bounds);
>>  CGContextTranslateCTM(context, 0.0, newRect.size.height);
>>  CGContextScaleCTM(context, 1.0, -1.0);
>>  CGContextScaleCTM(context, scle,scle);
>> 
>>  CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(myPage, 
>> kCGPDFCropBox, newRect, 0, true);
>>  CGContextConcatCTM(context, pdfTransform);
>>  CGContextDrawPDFPage(context, myPage);
>>  
>>  CGContextRestoreGState(context);
>> }
>> 
>> ___
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
>> 
>> This email sent to sc...@cocoadoc.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] more UIScrollView

2010-06-01 Thread Scott Anguish
The last portion of chapter the Basic Scrolling Using the Pinch Gestures in 
ScrollView Programming Guide for iPhone  is called

Ensuring that Zoomed Content is Sharp when Zoomed

It has an example (engineering approved) way of handling this. It isn’t the 
greatest solution available, but it is the currently recommended method.



On Jun 1, 2010, at 11:03 PM, Development wrote:

> Ok, well I've worked out most of the other issues I've run in to. However the 
> one I am now unable to really figure out has to do with zooming scroll view 
> contents and winding up with a clear image. The problem is that I'm not 
> getting a clear image.
> Is it possible to use the built in zooming methods to zoom an image and keep 
> it clear or do I have to basically implement my own zooming methods. I read 
> the zooming docs and unfortunately they did not help me to understand what to 
> do.
> 
> This is the drawing code from the view that is being zoomed.
> 
> -(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
> {
>  
>   CGRect newRect = self.bounds;
>   float scle =CGContextGetCTM(context).a;
> 
>   CGRect rect =CGContextGetClipBoundingBox(context);
> 
>   CGContextSaveGState(context);
>   CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
>   CGContextFillRect(context,self.bounds);
>   CGContextTranslateCTM(context, 0.0, newRect.size.height);
>   CGContextScaleCTM(context, 1.0, -1.0);
>   CGContextScaleCTM(context, scle,scle);
> 
>   CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(myPage, 
> kCGPDFCropBox, newRect, 0, true);
>   CGContextConcatCTM(context, pdfTransform);
>   CGContextDrawPDFPage(context, myPage);
>   
>   CGContextRestoreGState(context);
> }
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
> 
> This email sent to sc...@cocoadoc.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com