• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Example needed to show how to overlay images upon a single view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Example needed to show how to overlay images upon a single view


  • Subject: Re: Example needed to show how to overlay images upon a single view
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Wed, 12 Jan 2005 09:33:19 -0800

Thanks for the response!
I don't want to draw onto the background image, but to place an 'overlay' or a virtual 'plastic' layer to draw upon and maneuver. That way, I can customize the collection without changing the parts. I want to be able keep each layer independent and modifiable.


An example would be a weather map: You can draw/erase weather symbols upon the map of the U.S., without actually affecting the map itself.
Each layer would have its own data storage.


I'll play with your idea to see if that is what I can do.

I was thinking that it would be necessary to stack NSImageViews and work with each separately; since each NSImageView works with one (1) image. Perhaps this takes too much overhead. I don't know.

BTW: I've read that TIFF images can store multiple images as well.
I'm not a Graphic Artist so I'm currently clueless.

Regards,
Ric.


On Jan 11, 2005, at 7:47 PM, Louis C. Sacha wrote:

Hello...

In the drawRect: method of your NSView subclass, after drawing the background you could use the NSImage drawInRect:fromRect:operation:fraction: instance method to draw each of the images, starting with most distant / bottom layers.

You can use the destination rect (in your NSView) and the source rect (from the NSImage) to dynamically scale the image as you draw it into your NSView. Generally, you will want to use the NSCompositeSourceOver compositing operation, and to draw an image with a fraction of it's normal opacity you would change the value passed as the fraction: argument.


No sample code handy at the moment, but hopefully enough words to do the job :)


	Louis


Greetings:
I would like to create a variable stack of images upon a single NSView with each image acting as layers or gels upon a solid background. These layers should be available programmatically to alter their respective transparencies, etc. I good analogy is a cartoon with a solid background and characters in the separate layers. Another example is what OmniGraffle does: provide a canvas with various layers per user option.


I'm banging around here I know it should be a straight forward design. An example is worth more than a thousand words.

Regards,

Ric.



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Example needed to show how to overlay images upon a single view
      • From: Shawn Erickson <email@hidden>
References: 
 >Example needed to show how to overlay images upon a single view (From: "Frederick C. Lee" <email@hidden>)
 >Re: Example needed to show how to overlay images upon a single view (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: How to correctly resize window upon zoom?
  • Next by Date: Re: Obj-C NSRect methods help
  • Previous by thread: Re: Example needed to show how to overlay images upon a single view
  • Next by thread: Re: Example needed to show how to overlay images upon a single view
  • Index(es):
    • Date
    • Thread