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

Previous items

Picture.ThresholdMBS(Threshold as integer) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 17.5 Yes Yes Yes Yes No
Function: Creates black and white picture.
Notes:
With threshold value you define threshold in range from 0 to 255.
Normally you use 127 for turning picture to black & white.

Feedback, Comments & Corrections

TintPictureMBS(source as picture, GreyBase as color, SepiaBase as color) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Graphics & Pictures MBS Picture Plugin 4.3 Yes Yes Yes Yes No
Function: Tints the image.
Example:
// The code does the same thing as this Realbasic code:

Sub TintPicture(theImg as Picture, pGreyBase as Color, pSepiaBase as Color)
Dim theRGBSurface as RGBSurface
Dim theWidth, theHeight as Integer
Dim pColor as Color
Dim x, y as Integer
Dim theGrey as Integer

dim SepiaBaseR as Double
dim SepiaBaseG as Double
dim SepiaBaseB as Double

dim GreyBaseR as Double
dim GreyBaseG as Double
dim GreyBaseB as Double

SepiaBaseR=pSepiaBase.Red / 255.0
SepiaBaseG=pSepiaBase.Green / 255.0
SepiaBaseB=pSepiaBase.Blue / 255.0

GreyBaseR=pGreyBase.Red / 255.0
GreyBaseG=pGreyBase.Green / 255.0
GreyBaseB=pGreyBase.Blue / 255.0

theRGBSurface = theImg.RGBSurface

theWidth = theImg.Width-1
theHeight = theImg.Height-1

For x = 0 to theWidth
For y = 0 to theHeight
pColor = theImg.RGBSurface.Pixel( x, y )

theGrey = ( GreyBaseR * pColor.Red ) + ( GreyBaseG * pColor.Green ) + ( GreyBaseB * pColor.Blue )
theImg.RGBSurface.Pixel( x, y ) = RGB( theGrey * SepiaBaseR, theGrey * SepiaBaseG, theGrey * SepiaBaseB )

Next
Next
End Sub
Notes:
You can use the code to do something like a Sepia effect.
Returns a new picture on success.

Some examples using this method:

Feedback, Comments & Corrections

Picture.TransformColorsMBS(red as memoryblock, blue as memoryblock, green as memoryblock, dest as picture = nil) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 4.3 Yes Yes Yes Yes No
Function: Applies a transform table to the pixels.
Notes:
Red, blue and green are 256 byte big memoryblocks with one byte for each value.

In RB the function does this:
color=rgb(red.byte[color.red], green.byte[color.green], blue.byte[color.blue])

If you pass a destination picture and it has right size, the plugin will recycle that instead of creating a new one to increase performance.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.TrimMBS(left as Integer, top as Integer, width as Integer, height as Integer) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.0 Yes Yes Yes Yes No
Function: Trims the picture to the given rectangle.
Example:
dim p as Picture = LogoMBS(500)

Backdrop = p.TrimMBS(100,100,300,300)
Notes:
This method does not handle the mask.
So p.Trim(0,0,p.width,p.height) will give you a copy of the image pixels without mask.
left and top are zero based.

Use TrimWithMaskMBS if you need the mask to be trimmed.
Returns nil on low memory or bad parameters.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.TrimWithMaskMBS(left as Integer, top as Integer, width as Integer, height as Integer) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.0 Yes Yes Yes Yes No
Function: Trims the picture to the given rectangle.
Example:
dim p as picture
dim someimage as Picture = LogoMBS(100)

p=someimage.TrimWithMaskMBS(100,200,300,400)
Notes:
left and top are zero based.
Returns nil on low memory or bad parameters.

Feedback, Comments & Corrections

Picture.VMirrorMBS as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin Yes Yes Yes Yes No
Function: Mirrors the picture vertically.
Example:
canvas1.backdrop=pic.VMirrorMBS
Notes:
This method returns a copy of the picture mirrored.
Returns nil on low memory.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.VMirrorPictureMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 7.8 Yes Yes Yes Yes No
Function: Mirrors the picture vertically.
Example:
if pic.VMirrorPictureMBS then // mirror picture
canvas1.backdrop=pic
else
canvas1.backdrop=pic.VMirrorMBS // mirror a copy
end if
Notes: This methods mirrors the picture data itself. Returns true on success and false on failure. Only bitmap pictures can be mirrored this way.

Some examples which use this method:

Feedback, Comments & Corrections

Previous items

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




Links
MBS Xojo PDF Plugins