Tint class

An Effect that tints a picture with a hue.

The tint pulls the colours of the picture toward the chosen hue. The class mirrors the GDI+ Tint class and inherits the members of Effect.

Creating

Syntax: fx = Tint( )

Syntax: fx = Tint( params )

Syntax: fx = Tint( hue, amount )

Each form is also available as New Tint( … ) with the same arguments.

params
required A TintParams for the parameters.
hue
required A Long from -180 to 180: the hue to tint with, as an angle in degrees. 0 is the base of the colour wheel, and the angle runs around it.
amount
required A Long from -100 to 100: the strength of the tint. 0 changes nothing, and a negative value tints toward the opposite hue.

A constructor that fails creates an unusable object whose LastResult tells why.

Parameters

Syntax: fx.Parameters [ = params ]

Syntax: params = fx.Parameters( size )

Gets or sets the TintParams.

Dim user As GdiPlusUser = GdiPlusUser()

Dim fx As Tint = Tint(100, 50)
Dim p As TintParams = fx.Parameters(LenB(Of TintParams))
Debug.Print fx.LastResult & " " & p.hue & " " & p.amount
' Output:
' 0 100 50

Example

The example tints the colour 200, 100, 50 with two different settings.

Dim user As GdiPlusUser = GdiPlusUser()

Dim a As Bitmap = Bitmap(4!, 4!)
Dim b As Bitmap = Bitmap(4!, 4!)
Graphics(a).Clear(Color(255, 200, 100, 50))
Graphics(b).Clear(Color(255, 200, 100, 50))

a.ApplyEffect Tint(0, 50), GpRect(0, 0, 4, 4)
b.ApplyEffect Tint(100, 100), GpRect(0, 0, 4, 4)
Debug.Print Hex$(a.Pixel(1, 1).argb)
Debug.Print Hex$(b.Pixel(1, 1).argb)
' Output:
' FFEC583F
' FF1BA000

See Also