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

Next items

PictureMBS.AlphaChannel as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: The alpha channel as a new PictureMBS object.
Example:
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
dim r as PictureMBS = p.AlphaChannel
r.fillrect(100) // fill only alpha channel
Notes:
Returns nil if this channel does not exist.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the pixels of the channel directly.
The resulting PictureMBS object is a grayscale picture.

Feedback, Comments & Corrections

PictureMBS.ApplyMatrix(dest as PictureMBS, MatrixDimension as Integer, matrix() as Integer) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.1 Yes Yes Yes Yes No
Function: Applies a 5x5 matrix to the picture.
Example:
dim matrix(24) as Integer
dim x,y as Integer
dim value as Integer

for y=0 to 4
for x=0 to 4
matrix(x+y*5)=value // fill matrix
next
next

dim s,d as PictureMBS // make source and dest somewhere

d=s.ApplyMatrix(d, 5, matrix)
Notes:
MatrixDimension: Size of the matrix: 1 to 50. This is the width and height of the matrix.
matrix: The matrix array must contain exactly MatrixDimension*MatrixDimension values. (ubound(matrix)=MatrixDimension*MatrixDimension-1)
delta: Optional value. Default is 0.
ScaleFactor: Optional value. Default is 1.0.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

For each pixel in the dest image the following operation is done:
  • Make sum of all source pixels multiplied with their matrix entry.
  • add to the sum the delta value
  • multiply the sum by ScaleFactor

See the example project for several example matrices.

A matrix value of 255 or more leaves the dest pixel away from the sum.

Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.ApplyMatrix(dest as PictureMBS, MatrixDimension as Integer, matrix() as Integer, delta as Integer) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.1 Yes Yes Yes Yes No
Function: Applies a 5x5 matrix to the picture.
Example:
dim matrix(24) as Integer
dim x,y as Integer
dim value as Integer

for y=0 to 4
for x=0 to 4
matrix(x+y*5)=value // fill matrix
next
next

dim s,d as PictureMBS // make source and dest somewhere

d=s.ApplyMatrix(d, 5, matrix, 5)
Notes:
MatrixDimension: Size of the matrix: 1 to 50. This is the width and height of the matrix.
matrix: The matrix array must contain exactly MatrixDimension*MatrixDimension values. (ubound(matrix)=MatrixDimension*MatrixDimension-1)
delta: Optional value. Default is 0.
ScaleFactor: Optional value. Default is 1.0.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

For each pixel in the dest image the following operation is done:
  • Make sum of all source pixels multiplied with their matrix entry.
  • add to the sum the delta value
  • multiply the sum by ScaleFactor

See the example project for several example matrices.

A matrix value of 255 or more leaves the dest pixel away from the sum.

Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.ApplyMatrix(dest as PictureMBS, MatrixDimension as Integer, matrix() as Integer, delta as Integer, ScaleFactor as Double) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.1 Yes Yes Yes Yes No
Function: Applies a 5x5 matrix to the picture.
Example:
dim matrix(24) as Integer
dim x,y as Integer
dim value as Integer

for y=0 to 4
for x=0 to 4
matrix(x+y*5)=1 // fill matrix
next
next

dim s,d as PictureMBS // make source and dest somewhere

s = new PictureMBS(LogoMBS(500))
d = new PictureMBS(500, 500, PictureMBS.ImageFormatRGB)

// Blur with 5x5 Matrix
d=s.ApplyMatrix(d, 5, matrix, 1, 1.0/25.0)

Backdrop = d.CopyPicture
Notes:
MatrixDimension: Size of the matrix: 1 to 50. This is the width and height of the matrix.
matrix: The matrix array must contain exactly MatrixDimension*MatrixDimension values. (ubound(matrix)=MatrixDimension*MatrixDimension-1)
delta: Optional value. Default is 0.
ScaleFactor: Optional value. Default is 1.0.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

For each pixel in the dest image the following operation is done:
  • Make sum of all source pixels multiplied with their matrix entry.
  • add to the sum the delta value
  • multiply the sum by ScaleFactor

See the example project for several example matrices.

A matrix value of 255 or more leaves the dest pixel away from the sum.

Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.AutoLevel as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.1 Yes Yes Yes Yes No
Function: Applies auto levels on the picture.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
call p.AutoLevel
window1.Backdrop = p.CopyPicture
Notes:
The histogram is built, white and back points are searched and all pixels adjusted.
Returns true on success and false on any error.

Works only with RGB pictures.

See also:

Feedback, Comments & Corrections

PictureMBS.AutoLevel(x as Integer, y as Integer, w as Integer, h as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.1 Yes Yes Yes Yes No
Function: Applies auto levels on the picture.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
call p.AutoLevel(0,0,50,50)
window1.Backdrop = p.CopyPicture
Notes:
The histogram is built, white and back points are searched and all pixels adjusted.
Returns true on success and false on any error.

Works only with RGB pictures.

See also:

Feedback, Comments & Corrections

PictureMBS.BlackChannel as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 11.0 Yes Yes Yes Yes No
Function: The black channel of a CMYK picture as a new PictureMBS object.
Notes:
Returns nil if this channel does not exist.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the pixels of the channel directly.
The resulting PictureMBS object is a grayscale picture.

Feedback, Comments & Corrections

PictureMBS.BlueChannel as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: The blue channel as a new PictureMBS object.
Example:
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
dim r as PictureMBS = p.BlueChannel
r.fillrect(100) // fill only blue channel
Notes:
Returns nil if this channel does not exist.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the pixels of the channel directly.
The resulting PictureMBS object is a grayscale picture.

Feedback, Comments & Corrections

PictureMBS.BoxBlurFilter(dest as PictureMBS, Radius as Double, Iterations as Integer, Vertical as boolean = true, Horizontal as boolean = true) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.3 Yes Yes Yes Yes No
Function: The box blur filter.
Example:
Dim boxPic,tempObj As PictureMBS
dim logo as Picture = LogoMBS(500)
dim pictureObj as new PictureMBS(logo)

tempObj = New PictureMBS(pictureObj.Width, pictureObj.Height, pictureObj.ImageFormat)
boxPic = pictureObj.BoxBlurFilter(tempObj, 3.0, 3)

Backdrop=boxpic.CopyPicture
Notes:
if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Vertical and Horizontal define whether effect is applied horizontal and/or vertical.

Returns nil on any error.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.BoxBlurFilter(dest as PictureMBS, Radius as Double, Vertical as boolean = true, Horizontal as boolean = true) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.3 Yes Yes Yes Yes No
Function: The box blur filter.
Notes:
if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Vertical and Horizontal define whether effect is applied horizontal and/or vertical.

Returns nil on any error.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.BoxBlurFractionalFilter(dest as PictureMBS, Radius as Double) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 9.3 Yes Yes Yes Yes No
Function: The box blur filter for the radius fraction.
Notes:
If you call BoxBlurFilter and BoxBlurFractionalFilter with a radius of 3.5 the BoxBlurFilter does the 3.0 and BoxBlurFractionalFilter does the 0.5.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Returns nil on any error.

Feedback, Comments & Corrections

PictureMBS.Channel(index as Integer) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 11.0 Yes Yes Yes Yes No
Function: Returns the channel with the given index as a new picture object.
Example:
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
dim r as PictureMBS = p.Channel(0)
r.fillrect(100) // fill only red channel
Notes:
Returns nil on any error. May raise an out of bounds exception on invalid index. Index is zero based.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the pixels of the channel directly.
The resulting PictureMBS object is a grayscale picture.

See also:

Feedback, Comments & Corrections

PictureMBS.Channels as String()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 18.1 Yes Yes Yes Yes No
Function: The name of the channels of an image.
Example:
dim p as new Picture(100,100,32)
dim q as new PictureMBS(p)

dim channels() as string = q.Channels

dim cr as PictureMBS = q.RedChannel
dim cg as PictureMBS = q.GreenChannel
dim cb as PictureMBS = q.BlueChannel
dim c0 as pictureMBS = q.Channel(0)
dim c1 as pictureMBS = q.Channel(1)
dim c2 as pictureMBS = q.Channel(2)

dim crn as string = cg.Channel
dim cgn as string = cg.Channel
dim cbn as string = cg.Channel
dim c0n as string = c0.Channel
dim c1n as string = c1.Channel
dim c2n as string = c2.Channel

Break // check in debugger

Feedback, Comments & Corrections

PictureMBS.ClearCache
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 18.0 Yes Yes Yes Yes No
Function: Clears picture cache.
Notes:
If target of this PictureMBS is a Xojo picture, this method clears the Xojo cache for the picture to make sure it recognizes changes.
Does nothing if there is no target picture or there is no cache.

Feedback, Comments & Corrections

PictureMBS.ClearRect
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Clears all pixels.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p.ClearRect
window1.Backdrop = p.CopyPicture
Notes:
Writes zeros over all pixels and all channels.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.ClearRect(x as Integer, y as Integer, width as Integer, height as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Clears all pixels in the given area.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p.ClearRect(0,0,100,100)
window1.Backdrop = p.CopyPicture
Notes:
Writes zeros over all pixels and all channels.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

Feedback, Comments & Corrections

PictureMBS.ClipImage as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 10.1 Yes Yes Yes Yes No
Function: Creates a new PictureMBS object for the same picture content.
Notes: This may be useful if you need a second PictureMBS object. For example if two threads work on different rows.

See also:

Feedback, Comments & Corrections

PictureMBS.ClipImage(x as Integer, y as Integer, width as Integer, height as Integer) as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Creates a new PictureMBS object which draws only into a portion of the existing image.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)

// clip it
dim c as PictureMBS = p.ClipImage(100, 100, 300, 300)

// clone it
dim q as PictureMBS = c.Clone

// and see result in debugger
dim pic as Picture = q.CopyPicture

Break
Notes: This may be useful to apply an effect only on a portion of an existing image.

See also:

Feedback, Comments & Corrections

PictureMBS.Clone as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Creates a copy of a picture.
Example:
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)

// clip it
dim c as PictureMBS = p.ClipImage(100, 100, 300, 300)

// clone it
dim q as PictureMBS = c.Clone

// and see result in debugger
dim pic as Picture = q.CopyPicture

Break
Notes:
Does not work for pictures using virtual memory.
(Fails if IsMapping=True)
Copies the whole picture even if you clone just one channel.

Returns nil on low memory.

Feedback, Comments & Corrections

PictureMBS.Close
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Closes the picture by releasing all memory.
Notes: This calls the destructor internally.

Feedback, Comments & Corrections

PictureMBS.CMYKChannels as PictureMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 11.0 Yes Yes Yes Yes No
Function: The CMYK channels as a new PictureMBS object.
Notes:
Returns nil if the image is not a CMYK picture.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the CMYK pixels directly without modifying an alpha channel
The resulting PictureMBS object is a CMYK picture.

Feedback, Comments & Corrections

PictureMBS.Combine(Image As PictureMBS, Mask As PictureMBS, DestX as Integer, DestY as Integer, SourceX as Integer, SourceY as Integer, Width as Integer, Height as Integer, UseColours As Boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 10.3 Yes Yes Yes Yes No
Function: Copies pixels from one picture into another picture with some options.
Example:
dim DestImage As PictureMBS
dim Image As PictureMBS
dim Mask As PictureMBS
dim DestX as Integer=100
dim DestY as Integer=100
dim SourceX as Integer=0
dim SourceY as Integer=0
dim Width as Integer=500
dim Height as Integer=500

image=new PictureMBS(LogoMBS(500))
Mask=nil
DestImage=new PictureMBS(700,700,PictureMBS.ImageFormatRGB)

// this will only copy the pixels
if DestImage.Combine(image,Mask,DestX,DestY,SourceX,SourceY,Width,Height,false) then
window1.Backdrop=DestImage.CopyPicture
end if
Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
PreMultipliedSource: Optional parameter. If true the image must be premultiplied. Default is false.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The images you use can be Gray, RGB with or without alpha channels. But most variants here ignore alpha channels. To make sure the alpha channel is not touched, use the PictureMBS.RGBChannels function and pass that new PictureMBS.

See also:

Feedback, Comments & Corrections

PictureMBS.Combine(Image As PictureMBS, Mask As PictureMBS, DestX as Integer, DestY as Integer, SourceX as Integer, SourceY as Integer, Width as Integer, Height as Integer, UseColours As Boolean, ForeColour As color) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Large Picture MBS Images Plugin 10.3 Yes Yes Yes Yes No
Function: Copies pixels from one picture into another picture with some options.
Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
PreMultipliedSource: Optional parameter. If true the image must be premultiplied. Default is false.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The images you use can be Gray, RGB with or without alpha channels. But most variants here ignore alpha channels. To make sure the alpha channel is not touched, use the PictureMBS.RGBChannels function and pass that new PictureMBS.

See also:

Feedback, Comments & Corrections

Next items

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




Links
MBS Xojo Plugins