Platforms to show: All Mac Windows Linux Cross-Platform
NSImageMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Drawing | MBS MacBase Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You use this class to load existing images or create new ones and composite them into a view or other image. This class works in conjunction with one or more image representation objects (subclasses of NSImageRep), which manage the actual image data.
All methods in this class will catch exceptions from Cocoa and raise a NSExceptionMBS instead. Using the message, name and reason properties you can see what was the reason for this exception. Please report if you find a method which does not handle exceptions correct.
- 25 properties
- property accessibilityDescription as string
- property backgroundColor as NSColorMBS
- property cacheDepthMatchesImageDepth as Boolean
- property cacheMode as Integer
- property EXIFData as Dictionary
- property Handle as Integer
- property height as Double
- property isCachedSeparately as Boolean
- property isDataRetained as Boolean
- property isFlipped as Boolean
- property isTemplate as Boolean
- property isValid as Boolean
- property matchesOnMultipleResolution as Boolean
- property MaximumPixelHeight as Integer
- property MaximumPixelWidth as Integer
- property MinimumPixelHeight as Integer
- property MinimumPixelWidth as Integer
- property name as String
- property prefersColorMatch as Boolean
- property RepresentationsCount as Integer
- property scalesWhenResized as Boolean
- property size as NSSizeMBS
- property symbolConfiguration as NSImageSymbolConfigurationMBS
- property usesEPSOnResolutionMismatch as Boolean
- property width as Double
- 50 methods
- method addRepresentation(img as NSImageRepMBS)
- method BMPRepresentation as Memoryblock
- method BMPRepresentationMT as Memoryblock
- method cancelIncrementalLoad
- method Constructor
- method Constructor(data as Memoryblock)
- method Constructor(file as folderitem)
- method Constructor(image as Picture, mask as picture = nil)
- method Constructor(width as Double, height as Double)
- method CopyMask as picture
- method CopyPicture(CGColorSpace as Variant = nil, BackgroundColor as NSColorMBS = nil) as picture
- method CopyPictureRect(x as Integer, y as Integer, w as Integer, h as Integer, CGColorSpace as Variant = nil, BackgroundColor as NSColorMBS = nil) as picture
- method CopyPictureWithAlpha as picture
- method CopyPictureWithAlphaRect(x as Integer, y as Integer, w as Integer, h as Integer) as picture
- method CopyPictureWithMask(CGColorSpace as Variant = nil) as picture
- method DrawIntoCGContextAtPoint(cgcontext as Integer, x as Double, y as Double, sx as Double, sy as Double, SourceW as Double, SourceH as Double, operation as Integer, fraction as Double) as boolean
- method DrawIntoCGContextAtRect(cgcontext as Integer, x as Double, y as Double, w as Double, h as Double, SourceX as Double, SourceY as Double, SourceW as Double, SourceH as Double, operation as Integer, fraction as Double) as boolean
- method GIFRepresentation as Memoryblock
- method GIFRepresentationMT as Memoryblock
- method imageByFadingToFraction(fraction as Double) as NSImageMBS
- method imageByScalingToSize(width as Double, height as Double) as NSImageMBS
- method imageByScalingToSize(width as Double, height as Double, fraction as Double) as NSImageMBS
- method imageByScalingToSize(width as Double, height as Double, fraction as Double, flip as boolean, proportionally as boolean) as NSImageMBS
- method imageWithSymbolConfiguration(configuration as NSImageSymbolConfigurationMBS) as NSImageMBS
- method imageWithTintColor(tintColor as NSColorMBS) as NSImageMBS
- method initWithContentsOfURL(file as folderitem) as boolean
- method initWithContentsOfURL(url as string) as boolean
- method initWithData(data as Memoryblock) as boolean
- method initWithDataIgnoringOrientation(data as Memoryblock) as boolean
- method initWithIconRef(IconHandle as Integer) as boolean
- method initWithPasteboard as boolean
- method initWithPicture(img as picture, mask as picture = nil) as boolean
- method initWithSize(width as Double, height as Double) as boolean
- method JPEGRepresentation as Memoryblock
- method JPEGRepresentationMT as Memoryblock
- method JPEGRepresentationWithCompressionFactor(factor as Double) as Memoryblock
- method JPEGRepresentationWithCompressionFactorMT(factor as Double) as Memoryblock
- method PNGRepresentation as Memoryblock
- method PNGRepresentationMT as Memoryblock
- method recache
- method removeRepresentation(img as NSImageRepMBS)
- method RepresentationHeight(index as Integer) as Integer
- method representations as NSImageRepMBS()
- method RepresentationWidth(index as Integer) as Integer
- method setName(value as String) as Boolean
- method setSize(width as Double, height as Double)
- method TIFFRepresentation as Memoryblock
- method TIFFRepresentationMT as Memoryblock
- method TIFFRepresentationUsingCompression(comp as Integer, factor as Double) as Memoryblock
- method TIFFRepresentationUsingCompressionMT(comp as Integer, factor as Double) as Memoryblock
- 160 shared methods
- shared method canInitWithPasteboard as boolean
- shared method imageFileTypes as string()
- shared method imageNamed(name as string) as NSImageMBS
- shared method imagePasteboardTypes as string()
- shared method imageTypes as string()
- shared method imageUnfilteredFileTypes as string()
- shared method imageUnfilteredPasteboardTypes as string()
- shared method imageUnfilteredTypes as string()
- shared method imageWithCGImage(CGImage as Variant, width as Double = 0, height as Double = 0) as NSImageMBS
- shared method imageWithContentsOfFile(file as folderitem) as NSImageMBS
- shared method imageWithContentsOfFileMT(file as folderitem) as NSImageMBS
- shared method imageWithContentsOfPath(path as string) as NSImageMBS
- shared method imageWithContentsOfPathMT(path as string) as NSImageMBS
- shared method imageWithContentsOfURL(URL as string) as NSImageMBS
- shared method imageWithContentsOfURLMT(URL as string) as NSImageMBS
- shared method imageWithData(data as memoryblock) as NSImageMBS
- shared method imageWithData(data as string) as NSImageMBS
- shared method imageWithDataMT(data as memoryblock) as NSImageMBS
- shared method imageWithDataMT(data as string) as NSImageMBS
- shared method imageWithHandle(Handle as Integer) as NSImageMBS
- shared method imageWithSystemSymbolName(name as string, accessibilityDescription as string = "") as NSImageMBS
- shared method NSImageHintUserInterfaceLayoutDirection as string
- shared method NSImageNameActionTemplate as string
- shared method NSImageNameAddTemplate as string
- shared method NSImageNameAdvanced as string
- shared method NSImageNameApplicationIcon as string
- shared method NSImageNameBluetoothTemplate as string
- shared method NSImageNameBonjour as string
- shared method NSImageNameBookmarksTemplate as string
- shared method NSImageNameCaution as string
- shared method NSImageNameColorPanel as string
- shared method NSImageNameColumnViewTemplate as string
- shared method NSImageNameComputer as string
- shared method NSImageNameDotMac as string
- shared method NSImageNameEnterFullScreenTemplate as string
- shared method NSImageNameEveryone as string
- shared method NSImageNameExitFullScreenTemplate as string
- shared method NSImageNameFlowViewTemplate as string
- shared method NSImageNameFolder as string
- shared method NSImageNameFolderBurnable as string
- shared method NSImageNameFolderSmart as string
- shared method NSImageNameFollowLinkFreestandingTemplate as string
- shared method NSImageNameFontPanel as string
- shared method NSImageNameGoBackTemplate as string
- shared method NSImageNameGoForwardTemplate as string
- shared method NSImageNameGoLeftTemplate as string
- shared method NSImageNameGoRightTemplate as string
- shared method NSImageNameHomeTemplate as string
- shared method NSImageNameIChatTheaterTemplate as string
- shared method NSImageNameIconViewTemplate as string
- shared method NSImageNameInfo as string
- shared method NSImageNameInvalidDataFreestandingTemplate as string
- shared method NSImageNameLeftFacingTriangleTemplate as string
- shared method NSImageNameListViewTemplate as string
- shared method NSImageNameLockLockedTemplate as string
- shared method NSImageNameLockUnlockedTemplate as string
- shared method NSImageNameMenuMixedStateTemplate as string
- shared method NSImageNameMenuOnStateTemplate as string
- shared method NSImageNameMobileMe as string
- shared method NSImageNameMultipleDocuments as string
- shared method NSImageNameNetwork as string
- shared method NSImageNamePathTemplate as string
- shared method NSImageNamePreferencesGeneral as string
- shared method NSImageNameQuickLookTemplate as string
- shared method NSImageNameRefreshFreestandingTemplate as string
- shared method NSImageNameRefreshTemplate as string
- shared method NSImageNameRemoveTemplate as string
- shared method NSImageNameRevealFreestandingTemplate as string
- shared method NSImageNameRightFacingTriangleTemplate as string
- shared method NSImageNameShareTemplate as string
- shared method NSImageNameSlideshowTemplate as string
- shared method NSImageNameSmartBadgeTemplate as string
- shared method NSImageNameStatusAvailable as string
- shared method NSImageNameStatusNone as string
- shared method NSImageNameStatusPartiallyAvailable as string
- shared method NSImageNameStatusUnavailable as string
- shared method NSImageNameStopProgressFreestandingTemplate as string
- shared method NSImageNameStopProgressTemplate as string
- shared method NSImageNameTouchBarAddDetailTemplate as string
- shared method NSImageNameTouchBarAddTemplate as string
- shared method NSImageNameTouchBarAlarmTemplate as string
- shared method NSImageNameTouchBarAudioInputMuteTemplate as string
- shared method NSImageNameTouchBarAudioInputTemplate as string
- shared method NSImageNameTouchBarAudioOutputMuteTemplate as string
- shared method NSImageNameTouchBarAudioOutputVolumeHighTemplate as string
- shared method NSImageNameTouchBarAudioOutputVolumeLowTemplate as string
- shared method NSImageNameTouchBarAudioOutputVolumeMediumTemplate as string
- shared method NSImageNameTouchBarAudioOutputVolumeOffTemplate as string
- shared method NSImageNameTouchBarBookmarksTemplate as string
- shared method NSImageNameTouchBarColorPickerFill as string
- shared method NSImageNameTouchBarColorPickerFont as string
- shared method NSImageNameTouchBarColorPickerStroke as string
- shared method NSImageNameTouchBarCommunicationAudioTemplate as string
- shared method NSImageNameTouchBarCommunicationVideoTemplate as string
- shared method NSImageNameTouchBarComposeTemplate as string
- shared method NSImageNameTouchBarDeleteTemplate as string
- shared method NSImageNameTouchBarDownloadTemplate as string
- shared method NSImageNameTouchBarEnterFullScreenTemplate as string
- shared method NSImageNameTouchBarExitFullScreenTemplate as string
- shared method NSImageNameTouchBarFastForwardTemplate as string
- shared method NSImageNameTouchBarFolderCopyToTemplate as string
- shared method NSImageNameTouchBarFolderMoveToTemplate as string
- shared method NSImageNameTouchBarFolderTemplate as string
- shared method NSImageNameTouchBarGetInfoTemplate as string
- shared method NSImageNameTouchBarGoBackTemplate as string
- shared method NSImageNameTouchBarGoDownTemplate as string
- shared method NSImageNameTouchBarGoForwardTemplate as string
- shared method NSImageNameTouchBarGoUpTemplate as string
- shared method NSImageNameTouchBarHistoryTemplate as string
- shared method NSImageNameTouchBarIconViewTemplate as string
- shared method NSImageNameTouchBarListViewTemplate as string
- shared method NSImageNameTouchBarMailTemplate as string
- shared method NSImageNameTouchBarNewFolderTemplate as string
- shared method NSImageNameTouchBarNewMessageTemplate as string
- shared method NSImageNameTouchBarOpenInBrowserTemplate as string
- shared method NSImageNameTouchBarPauseTemplate as string
- shared method NSImageNameTouchBarPlayheadTemplate as string
- shared method NSImageNameTouchBarPlayPauseTemplate as string
- shared method NSImageNameTouchBarPlayTemplate as string
- shared method NSImageNameTouchBarQuickLookTemplate as string
- shared method NSImageNameTouchBarRecordStartTemplate as string
- shared method NSImageNameTouchBarRecordStopTemplate as string
- shared method NSImageNameTouchBarRefreshTemplate as string
- shared method NSImageNameTouchBarRewindTemplate as string
- shared method NSImageNameTouchBarRotateLeftTemplate as string
- shared method NSImageNameTouchBarRotateRightTemplate as string
- shared method NSImageNameTouchBarSearchTemplate as string
- shared method NSImageNameTouchBarShareTemplate as string
- shared method NSImageNameTouchBarSidebarTemplate as string
- shared method NSImageNameTouchBarSkipAhead15SecondsTemplate as string
- shared method NSImageNameTouchBarSkipAhead30SecondsTemplate as string
- shared method NSImageNameTouchBarSkipAheadTemplate as string
- shared method NSImageNameTouchBarSkipBack15SecondsTemplate as string
- shared method NSImageNameTouchBarSkipBack30SecondsTemplate as string
- shared method NSImageNameTouchBarSkipBackTemplate as string
- shared method NSImageNameTouchBarSkipToEndTemplate as string
- shared method NSImageNameTouchBarSkipToStartTemplate as string
- shared method NSImageNameTouchBarSlideshowTemplate as string
- shared method NSImageNameTouchBarTagIconTemplate as string
- shared method NSImageNameTouchBarTextBoldTemplate as string
- shared method NSImageNameTouchBarTextBoxTemplate as string
- shared method NSImageNameTouchBarTextCenterAlignTemplate as string
- shared method NSImageNameTouchBarTextItalicTemplate as string
- shared method NSImageNameTouchBarTextJustifiedAlignTemplate as string
- shared method NSImageNameTouchBarTextLeftAlignTemplate as string
- shared method NSImageNameTouchBarTextListTemplate as string
- shared method NSImageNameTouchBarTextRightAlignTemplate as string
- shared method NSImageNameTouchBarTextStrikethroughTemplate as string
- shared method NSImageNameTouchBarTextUnderlineTemplate as string
- shared method NSImageNameTouchBarUserAddTemplate as string
- shared method NSImageNameTouchBarUserGroupTemplate as string
- shared method NSImageNameTouchBarUserTemplate as string
- shared method NSImageNameTouchBarVolumeDownTemplate as string
- shared method NSImageNameTouchBarVolumeUpTemplate as string
- shared method NSImageNameTrashEmpty as string
- shared method NSImageNameTrashFull as string
- shared method NSImageNameUser as string
- shared method NSImageNameUserAccounts as string
- shared method NSImageNameUserGroup as string
- shared method NSImageNameUserGuest as string
- 9 constants
Image Cache Modes
Constant | Value | Description |
---|---|---|
NSImageCacheAlways | 1 |
Always generate a cache when drawing. |
NSImageCacheBySize | 2 |
Cache if cache size is smaller than the original data. |
NSImageCacheDefault | 0 |
Caching is unspecified. Use the image rep's default. |
NSImageCacheNever | 3 |
Never cache; always draw direct. |
Image Load Status
Constant | Value | Description |
---|---|---|
NSImageLoadStatusCancelled | 1 |
Image loading was canceled. The image contains the portions of the data that have already been successfully decompressed, if any. |
NSImageLoadStatusCompleted | 0 |
Enough data has been provided to completely decompress the image. |
NSImageLoadStatusInvalidData | 2 |
An error occurred during image decompression. The image data is probably corrupt. The image contains the portions of the data that have already been successfully decompressed, if any. |
NSImageLoadStatusReadError | 4 |
Not enough data was available for full decompression of the image. The image contains the portions of the data that have already been successfully decompressed, if any. |
NSImageLoadStatusUnexpectedEOF | 3 |
Not enough data was available for full decompression of the image. The image contains the portions of the data that have already been successfully decompressed, if any. |
This class has no sub classes.
Some useful global functions for this class:
- SetNextDragImageMBS(Img as NSImageMBS, DragItemCount as Integer = 1)
Some methods using this class:
- GKAchievementDescriptionMBS.image as NSImageMBS
- NSActionCellMBS.Constructor(image as NSImageMBS)
- NSButtonMBS.Constructor(Title as String, Image as NSImageMBS = nil, Type as Integer = 0)
- NSGraphicsMBS.graphicsContextWithNSImage(targetImage as NSImageMBS) as NSGraphicsMBS
- NSSharingServiceItemsMBS.AddImages(images() as NSImageMBS)
- NSTableViewMBS.dragImageForRowsWithIndexes(dragRows as NSIndexSetMBS, tableColumns() as NSTableColumnMBS, theEvent as NSEventMBS, byref dragImageOffset as NSPointMBS) as NSImageMBS
- NSWorkspaceMBS.setIcon(image as NSImageMBS, path as string, flags as Integer = 0) as boolean
- PHAssetChangeRequestMBS.creationRequestForAssetFromImage(image as NSImageMBS) as PHAssetChangeRequestMBS
- SCNMaterialPropertyMBS.materialPropertyWithImage(image as NSImageMBS) as SCNMaterialPropertyMBS
- WKWebViewControlMBS.takeSnapshot(byref error as NSErrorMBS) as NSImageMBS
Some properties using for this class:
- iTunesLibraryArtworkMBS.image as NSImageMBS
- NSButtonCellMBS.alternateImage as NSImageMBS
- NSRunningApplicationMBS.icon as NSImageMBS
- NSSharingServiceMBS.alternateImage as NSImageMBS
- NSSharingServiceMBS.image as NSImageMBS
- NSStatusItemMBS.alternateImage as NSImageMBS
- NSTableViewRowActionMBS.Image as NSImageMBS
- QCViewMBS.snapshotImage as NSImageMBS
- IKPictureTakerMBS.inputImage as NSImageMBS
- IKPictureTakerMBS.ShowEmptyPicture as NSImageMBS
Some events using this class:
- DesktopNSCollectionViewControlMBS.draggingImageForItems(indexPaths() as NSIndexPathMBS, NSEvent as NSEventMBS, byref dragImageOffset as NSPointMBS) as NSImageMBS
- DesktopWKWebViewControlMBS.takeSnapshotCompleted(image as NSImageMBS, error as NSErrorMBS, tag as string)
- GameKitMBS.loadImageCompleted(description as GKAchievementDescriptionMBS, image as NSImageMBS, error as NSErrorMBS, tag as Variant)
- GameKitMBS.loadPhotoForSizeCompleted(player as GKPlayerMBS, size as Integer, photo as NSImageMBS, error as NSErrorMBS, tag as Variant)
- NSCollectionViewControlMBS.draggingImageForItems(indexPaths() as NSIndexPathMBS, NSEvent as NSEventMBS, byref dragImageOffset as NSPointMBS) as NSImageMBS
- NSSharingServiceDelegateMBS.transitionImageForShareItem(service as NSSharingServiceMBS, item as Variant, contentRect as NSRectMBS) as NSImageMBS
- QLPreviewPanelMBS.transitionImageForPreviewItem(file as folderitem, byref contentRect as NSRectMBS) as NSImageMBS
- WKWebViewControlMBS.takeSnapshotCompleted(image as NSImageMBS, error as NSErrorMBS, tag as string)
- WKWebViewIOSControlMBS.takeSnapshotCompleted(image as NSImageMBS, error as NSErrorMBS, tag as string)
Some examples using this class:
- /AVFoundation/Live Barcode Detection iOS/Live Barcode Detection iOS
- /Images/LCMS2/Drawing on Mac with Colorspaces/Drawing on Mac with Colorspaces
- /MacCG/CoreImage/Simple Filter Chain
- /MacCocoa/Addressbook/Show my entry
- /MacCocoa/Apply Quartz Filters to PDF
- /MacCocoa/NSImage EPS Test/NSImage EPS Test
- /MacCocoa/NSImage/NSImageMBS multithreading
- /MacCocoa/NSWorkSpace DropFile to see icon parts
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Simple Demo with DataSource
- /PDFKit/PDFView/PDFView customized with picture overlay
Blog Entries
- RTF functions in MBS Plugins
- MBS Xojo Plugins in version 22.4
- MonkeyBread Software Releases the MBS Xojo Plugins in version 22.1
- Adding custom icons for MacOS in Xojo
- Problems with killing Xojo threads with plugin calls.
- Picture from HTMLViewer
- Multithreaded plugin functions can increase speed of Real Studio application
- NSImage and image orientation
- Tip of the day: Rotate image with CoreImage
- MBS Real Studio Plugins, version 12.2fc1
Xojo Developer Magazine
- 6.4, page 34: Creating PDF Files, How to create PDFs using the MBS Plugins by Christian Schmitz
- 5.6, pages 32 to 33: Third Party Plugins: Statusitems, Getting an icon in the top right of the Mac OS X menubar by Christian Schmitz
- 20.3, page 80: Great Shots With Continuity Camera, Use your iOS device to take a picture for your Mac by Stefanie Juchmes
- 20.3, page 10: News
- 19.1, page 91: Maps Part 8, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
- 19.1, page 82: Maps Part 8, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
- 19.1, page 80: Maps Part 8, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
- 19.1, page 78: Maps Part 8, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
- 18.6, page 73: MapKit Part 7, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
- 18.6, pages 68 to 69: MapKit Part 7, Implementing Maps in Xojo desktop apps with the MapKitMBS plugin by Markus Winter
Videos
Release notes
- Version 24.4
- Changed AVCaptureVideoDataOutputMBS class to provide JPEGData and NSImageMBS to CVImageBufferMBS class for iOS, too.
- Version 22.4
- Implemented CopyPicture in NSImageMBS class.
- Version 20.5
- Added imageWithSystemSymbolName method to NSImageMBS class to get SF Symbols.
- Version 20.1
- Added NSImageMBS.imageWithTintColor method.
- Version 18.4
- Changed CVImageBufferMBS to cache NSImageMBS and CGImageMBS objects and jpeg data Memoryblock.
- Version 18.3
- Changed NSImageMBS.CopyPictureWithMask to return mask, even if image representation is not marked to have alpha.
- Version 17.4
- Added exceptions for NSImageMBS constructors. You'll get an UnsupportedOperationException if image creation fails.
The items on this page are in the following plugins: MBS MacBase Plugin.
NSImageCellMBS - NSImageRepMBS