Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

TintPictureMBS(source as picture, GreyBase as color, SepiaBase as color) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Graphics & Pictures MBS Picture Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tints the image.
Example
// The code does the same thing as this Xojo code:

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

Var SepiaBaseR as Double
Var SepiaBaseG as Double
Var SepiaBaseB as Double

Var GreyBaseR as Double
Var GreyBaseG as Double
Var 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

You can use the code to do something like a Sepia effect.
Returns a new picture on success.

Some examples using this global method:

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


The biggest plugin in space...