Re: CALayer resizing puzzle

2010-01-22 Thread vincent habchi
Le 22 janv. 2010 à 19:41, David Duncan a écrit : > This will set layer1 and layer2 to use the same contents, and have them use > different parts of that bitmap. > > However your contentsRect is being set incorrectly. The contentsRect is a > rectangle in a unit coordinate system, which means tha

Re: CALayer resizing puzzle

2010-01-22 Thread David Duncan
On Jan 22, 2010, at 10:18 AM, vincent habchi wrote: > Thanks for that answer. I would dare a further request for enlightenment ;) > Does it mean that: > > 1. by defining a suitable ContentsRect, I can get a clipped area of a CALayer > just by accessing layer.contents? > 2. that I can copy this

Re: CALayer resizing puzzle

2010-01-22 Thread vincent habchi
David, > Yes it is. The contents property is generally used to represent bitmapped > content of a layer, which in the case of a plain CALayer means that anything > drawn via -drawInContext: or -drawLayer:inContext: will be accessible via the > contents property. Thanks for that answer. I would

Re: CALayer resizing puzzle

2010-01-22 Thread David Duncan
On Jan 21, 2010, at 11:53 PM, vincent habchi wrote: > Does that mean that the content property is altered not only when you set it > explicitly, but also when you draw on the layer via [DrawLayer: inContext:]? Yes it is. The contents property is generally used to represent bitmapped content of

Re: CALayer resizing puzzle

2010-01-22 Thread vincent habchi
Douglas, > Have you checked the values of dx and dy in the debugger? Shouldn't those > variables be declared as CGFloats as opposed to int? That's correct, but it does not matter since the int is automatically converted to float/double. Actually this part of code works like a charm. You click,

Re: CALayer resizing puzzle

2010-01-22 Thread douglas welton
Vincent, Have you checked the values of dx and dy in the debugger? Shouldn't those variables be declared as CGFloats as opposed to int? In regards to resizing the layer when the enclosing view resizes, what values have you set for the layer's autorezingMask property? regards, douglas On Jan

Re: CALayer resizing puzzle

2010-01-21 Thread vincent habchi
Hi Scott, > this specific example of course assumes that you’re using the iphone. But, > the technique should be sound for what you’re trying to do. > > The technique is applicable to use a pool of multiple views to contain > smaller amounts of the content. the advantage is that you can render

Re: CALayer resizing puzzle

2010-01-21 Thread Scott Anguish
this specific example of course assumes that you’re using the iphone. But, the technique should be sound for what you’re trying to do. The technique is applicable to use a pool of multiple views to contain smaller amounts of the content. the advantage is that you can render or fetch the content

Re: CALayer resizing puzzle

2010-01-21 Thread Scott Anguish
look at the ScrollViewSuite example.. specifically the tiling one. techniques illustrated. On Jan 21, 2010, at 12:39 PM, vincent habchi wrote: > Hi to all, > > I'm trying to write a (at that time) simple GIS-like application based on > Cocoa. For each cartographic layer, I use a CALayer objec

Re: CALayer resizing puzzle

2010-01-21 Thread douglas welton
Vincent, Do you have some code that you can show us? Otherwise, diagnosing your problem will be pure guesswork. regards, douglas > However, I'm facing a challenge: when the user move the mouse, the drawing > must move accordingly, feeling in white spaces that appear when updating the > posi

CALayer resizing puzzle

2010-01-21 Thread vincent habchi
Hi to all, I'm trying to write a (at that time) simple GIS-like application based on Cocoa. For each cartographic layer, I use a CALayer object, which is nice to control things like opacity in real-time. However, I'm facing a challenge: when the user move the mouse, the drawing must move accor