Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

CGCreateImageFromJPEGDataProviderMBS(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 3.3 Yes No No Yes, macOS only No
Function: Creates a new CGImage with JPEG data.
Example:
// Shows moon.jpg from the desktop folder
// shows in the window title if i,p or u is nil.

Sub Mainwindow.Paint(g As Graphics)
dim f as FolderItem
dim p as CGDataProviderMBS
dim i as CGImageMBS

f=SpecialFolder.Desktop.Child("moon.jpg")
p=CGDataProviderMBS.CreateWithFile(f)
if p=nil then
Title="p=nil"
else
i=CGCreateImageFromJPEGDataProviderMBS(p,nil,true,0)

if i=nil then
Title="i=nil"
else
window1.CGContextMBS.DrawPicture i,CGMakeRectMBS(0,0,i.Width,i.Height)
end if
end if

End Sub
Notes:
Dataprovider must be a CGDataProviderMBS object.

Parameters:

dataprovider:
A reference to a data provider supplying JPEG-encoded data.

decode:
Pass the decode array for the image. In the decode array, for each color component in the source color space, you provide a pair of values denoting the upper and lower limits of a range. For example, the decode array for a source image in the RGB color space would contain six entries total, consisting of one pair each for red, green, and blue. When the image is rendered, Quartz uses a linear transform to map the original component value into a relative number within your designated range that is appropriate for the destination color space. If you do not want to allow remapping of the image's color values, pass nil for the decode array. The memoryblock for the array needs to be filled with double values.

shouldInterpolate:
Pass true if interpolation should occur; otherwise, pass false . The interpolation setting specifies whether Quartz should apply a pixel-smoothing algorithm to the image. If you pass false , the image may appear jagged or pixelated when drawn on an output device with higher resolution than the image data.

intent:
Pass a CGColorRenderingIntent value specifying how Quartz should display colors in the image that are not located within the current color space of the graphics context. The rendering intent determines the exact method used to map colors from one color space to another.

Some examples using this method:

Feedback, Comments & Corrections

CGCreateImageFromPNGDataProviderMBS(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 3.3 Yes No No Yes, macOS only No
Function: Creates a new CGImage with PNG data.
Notes:
Dataprovider must be a CGDataProviderMBS object.

Parameters:

dataprovider:
A reference to a data provider supplying JPEG-encoded data.

decode:
Pass the decode array for the image. In the decode array, for each color component in the source color space, you provide a pair of values denoting the upper and lower limits of a range. For example, the decode array for a source image in the RGB color space would contain six entries total, consisting of one pair each for red, green, and blue. When the image is rendered, Quartz uses a linear transform to map the original component value into a relative number within your designated range that is appropriate for the destination color space. If you do not want to allow remapping of the image's color values, pass nil for the decode array. The memoryblock for the array needs to be filled with double values.

shouldInterpolate:
Pass true if interpolation should occur; otherwise, pass false . The interpolation setting specifies whether Quartz should apply a pixel-smoothing algorithm to the image. If you pass false , the image may appear jagged or pixelated when drawn on an output device with higher resolution than the image data.

intent:
Pass a CGColorRenderingIntent value specifying how Quartz should display colors in the image that are not located within the current color space of the graphics context. The rendering intent determines the exact method used to map colors from one color space to another.

Feedback, Comments & Corrections

CGCreateImageMBS(pic as picture) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 8.6 Yes No No No No
Function: Creates a new CGImageMBS from the given images.
Example:
dim c as CGImageMBS
dim pic, mask as Picture
// get picture and mask

c=CGCreateImageMBS(pic)
if c<>Nil then
// go on
end if
Notes: If the image has a mask, it is used.

See also:

Some examples using this method:

Feedback, Comments & Corrections

CGCreateImageMBS(pic as picture, mask as picture) as CGImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 2.7 Yes No No No No
Function: Creates a new CGImageMBS from the given images.
Example:
dim c as CGImageMBS
dim pic, mask as Picture
// get picture and mask

c=CGCreateImageMBS(pic, mask)
if c<>Nil then
// go on
end if
Notes:
The mask is taken from the second image.
With 11.3 plugins we are deprecating to pass a mask. The plugin prefers to simply take the mask or alpha channel of the picture itself.

See also:

Some examples using this method:

Feedback, Comments & Corrections

CGMakeSizeMBS(width as Double, height as Double) as CGSizeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 2.7 Yes No No Yes, macOS only No
Function: Returns a new CGSizeMBS object.

Some examples using this method:

Feedback, Comments & Corrections

CGNewPDFDocumentMBS(consumer as CGDataConsumerMBS, MediaBox as CGRectMBS, title as string, author as string, creator as string) as CGPDFContextMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 12.0 Yes No No Yes, macOS only No
Function: Creates a PDF document.
Notes:
Title, author and creator are all optional.
Requires Mac OS X to work.
Keep yourself a reference to the consumer object so RB does not release it resulting in a crash.

Some examples using this method:

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins