Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CGImageMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 13.5 Yes No No Yes, macOS only No
Function: The private constructor.

Feedback, Comments & Corrections

CGImageMBS.Copy as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 8.6 Yes No No Yes, macOS only No
Function: Creates a copy of a bitmap image.

See also:

Feedback, Comments & Corrections

CGImageMBS.Copy(r as CGRectMBS) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 8.6 Yes No No Yes, macOS only No
Function: Creates a copy of a bitmap image.

See also:

Feedback, Comments & Corrections

CGImageMBS.CopyWithColorSpace(profile as CGColorSpaceMBS) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 3.4 Yes No No Yes, macOS only No
Function: Returns a copy of the image with the new Colorspace included.
Example:
// load a picture
dim f as FolderItem = SpecialFolder.Desktop.Child("ColorSpin.jpg")
dim pic as Picture = picture.Open(f)

// open printer
dim g as Graphics = OpenPrinterDialog
if g = nil then Return

// draw
g.DrawPicture pic, 0, 0

// now load again
dim ImageSource as new CGImageSourceMBS(f)
dim img as CGImageMBS = ImageSource.CreateImageAtIndex(0)
dim cs as CGColorSpaceMBS = CGColorSpaceMBS.CreateDeviceRGB

// copy with replacing colorspace
img = img.CopyWithColorSpace(cs)

// and draw
dim c as CGContextMBS = CGContextMBS.contextWithCGContext(g.Handle(g.HandleTypeCGContextRef))
dim r as CGRectMBS = CGMakeRectMBS(0, 0, img.Width, img.Height)

c.DrawPicture(img, r)
c.Flush
Notes:
profile must be a CGColorSpaceMBS.
Requires Mac OS X 10.3.

Feedback, Comments & Corrections

CGImageMBS.CopyWithMask(mask as CGImageMBS) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 8.6 Yes No No Yes, macOS only No
Function: reates a bitmap image from an existing image and an image mask.
Notes:
Parameters:

self: The image to apply the mask parameter to. This image must not be an image mask and may not have an image mask or masking color associated with it.

mask: A mask. If the mask is an image, it must be in the DeviceGray color space, must not have an alpha component, and may not itself be masked by an image mask or a masking color. If the mask is not the same size as the image specified by the image parameter, then Quartz scales the mask to fit the image.

Return Value: An image created by masking image with mask. You are responsible for releasing this object by calling CGImageRelease.

The resulting image depends on whether the mask parameter is an image mask or an image. If the mask parameter is an image mask, then the source samples of the image mask act as an inverse alpha value. That is, if the value of a source sample in the image mask is S, then the corresponding region in image is blended with the destination using an alpha value of (1-S). For example, if S is 1, then the region is not painted, while if S is 0, the region is fully painted.

If the mask parameter is an image, then it serves as an alpha mask for blending the image onto the destination. The source samples of mask' act as an alpha value. If the value of the source sample in mask is S, then the corresponding region in image is blended with the destination with an alpha of S. For example, if S is 0, then the region is not painted, while if S is 1, the region is fully painted.

Feedback, Comments & Corrections

CGImageMBS.DataProvider as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 3.3 Yes No No Yes, macOS only No
Function: The data provider used for the image.
Notes:
Value is a CGDataProviderMBS object.
Returns nil on any error.

Feedback, Comments & Corrections

CGImageMBS.DecodeArray as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 3.3 Yes No No Yes, macOS only No
Function: The decode array used for the image.
Notes:
A memoryblock with an array of double variables.
Returns nil on any error.

Feedback, Comments & Corrections

CGImageMBS.JPEGData(Compression as Integer = 90) as MemoryBlock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 14.3 Yes No No Yes, macOS only No
Function: Returns image compressed as JPEG file.
Notes:
Compression defines the compression level from 0 to 100.
Returns nil on any error.

Feedback, Comments & Corrections

CGImageMBS.Picture(ColorSpace as CGColorSpaceMBS = nil) as Picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 11.3 Yes No No Yes, macOS only No
Function: Creates a copy of the CGImage as a picture.
Example:
// get CGImage
dim f as FolderItem = SpecialFolder.Desktop.Child("bild.jpg")
dim c as CGImageMBS = CGImageMBS.CreateImageWithFile(f)
// get picture
dim p as Picture = c.Picture
// save as jpeg
dim d as FolderItem = SpecialFolder.Desktop.Child("output.jpg")
p.Save(d, p.SaveAsJPEG, 80)
Notes:
Colorspace: the optional CoreGraphcis Colorspace to use for the bitmap conversion (CGColorSpaceMBS class).
Returns nil on any error.

Feedback, Comments & Corrections

CGImageMBS.PictureScaled(OutputWidth as Integer, OutputHeight as Integer, ColorSpace as CGColorSpaceMBS = nil) as Picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 17.1 Yes No No Yes, macOS only No
Function: Creates a copy of the CGImage as a picture scaled.
Example:
// get CGImage
dim f as FolderItem = SpecialFolder.Desktop.Child("bild.jpg")
dim c as CGImageMBS = CGImageMBS.CreateImageWithFile(f)
// get picture
dim p as Picture = c.PictureScaled(640,480)
// save as jpeg
dim d as FolderItem = SpecialFolder.Desktop.Child("output.jpg")
p.Save(d, p.SaveAsJPEG, 80)
Notes:
Colorspace: the optional CoreGraphcis Colorspace to use for the bitmap conversion (CGColorSpaceMBS class).
Returns nil on any error.

If output width and height are zero, we use the image sizes.

Feedback, Comments & Corrections

CGImageMBS.PNGData as MemoryBlock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 14.3 Yes No No Yes, macOS only No
Function: Returns image compressed as PNG file.
Notes: Returns nil on any error.

Feedback, Comments & Corrections

CGImageMBS.ReleaseHandle
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 14.2 Yes No No Yes, macOS only No
Function: Decrements the retain count of a CGImageRef.
Notes:
Each retain must have a release. Too many releases and your app will crash, too many retains and it will leak memory.
Use only if you really know what you are doing.

Feedback, Comments & Corrections

CGImageMBS.RetainHandle
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method CoreGraphics MBS MacCG Plugin 14.2 Yes No No Yes, macOS only No
Function: Increments the retain count of a CGImageRef.
Notes:
Each retain must have a release. Too many releases and your app will crash, too many retains and it will leak memory.
Use only if you really know what you are doing.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCG Plugin.




Links
MBS Xojo Plugins