objective c - Clipping NSImage around certain NSRect -
i have nsimage different images inside it. positions of images inside of stay same time, need specify rectangle subimage @ position of rectangle inside of image. how done?
why there multiple images inside of 1 image? premature optimization?
in case, when draw image, 1 of parameters pass section of image want. normally, pass either bounds of image or 0 rect (which both mean same thing), can pass subrectangle if want.
if destination rectangle larger source rectangle, scale (non-proportionally); if it's smaller, scale down (non-proportionally). adjust size of destination rectangle match of source rectangle if don't want scaling.
if want leave drawing nsimageview, create empty nsimage of desired size, draw it, pass image image view. destroys whatever performance advantage you'd hoped gain mashing these 1 image.
you create custom subclass of nsview, nsimageview, or calayer has property nsimage , property source rectangle, , draws section.
Comments
Post a Comment