• 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: "Louis C. Sacha" <email@hidden>
  • Date: Tue, 11 Jan 2005 19:47:46 -0800

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: "Frederick C. Lee" <email@hidden>
References: 
 >Example needed to show how to overlay images upon a single view (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: Re: Obj-C NSRect methods help
  • Next by Date: Re: Obj-C NSRect methods help
  • Previous by thread: 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