#Include "gfxPostProcess.bi"

Print "      gfxPostProcess libary by bunnX"
Print "     Of course you can combine the effects."
Print "    #############################################"
Print "   # USE KEY 0-9 AND Q-I TO CHANGE THE EFFECT. #"
Print "  #############################################"
Print ""

ScreenRes 700, 438, 32		'only 32 bit mode
gfxInitEffects()				'init effects after setting screenres

'for init with an imagebuffer use:
'gfxInitEffects(fbImageBufferr)
'only 32 bit!

Dim As Integer effect
Dim As Any Ptr img = ImageCreate(700, 438, 0, 32)
BLoad "demo.bmp", img


Do 
	
	ScreenLock
	gfxCls()
	Put(0, 0), img, PSet

	If MultiKey(&h02) Then effect = 1	:Print #1, "gfxInvert"			,"-> invert by color"
	If MultiKey(&h03) Then effect = 2	:Print #1, "gfxGrayscale"		,"-> grayscale by averange"
	If MultiKey(&h04) Then effect = 3	:Print #1, "gfxBrightness"		,"-> adjust brightness"
	If MultiKey(&h05) Then effect = 4	:Print #1, "gfxContrast"		,"-> adjust contrast"
	If MultiKey(&h06) Then effect = 5	:Print #1, "gfxEmboss"			,"-> emboss"
	If MultiKey(&h07) Then effect = 6	:Print #1, "gfxSephia"			,"-> warm sephia colors"
	If MultiKey(&h08) Then effect = 7	:Print #1, "gfxSoftGlow"		,"-> softglow (bloom)"
	If MultiKey(&h09) Then effect = 8	:Print #1, "gfxColorAnd"		,"-> bitwise and (in this case the red channel)"
	If MultiKey(&h0A) Then effect = 9	:Print #1, "gfxPruneColor"		,"-> reduce color by shifting, this are 64"
	If MultiKey(&h0B) Then effect = 10	:Print #1, "gfxRGBNoise"		,"-> rgb noise"
	If MultiKey(&h10) Then effect = 11	:Print #1, "gfxBlur"				,"-> blur"
	If MultiKey(&h11) Then effect = 12	:Print #1, "gfxSharpen"			,"-> sharpen"
	If MultiKey(&h12) Then effect = 13	:Print #1, "gfxSobelGradient"	,"-> sobel"
	If MultiKey(&h13) Then effect = 14	:Print #1, "gfxMonochrome"		,"-> monochrome with dithering"
	If MultiKey(&h14) Then effect = 15	:Print #1, "gfxFlipV"			,"-> flip vertical (means horizontal axis)"
	If MultiKey(&h15) Then effect = 16	:Print #1, "gfxFlipH"			,"-> flip horizontal (means vertical axis)"
	If MultiKey(&h16) Then effect = 17	:Print #1, "gfxFlipHV"			,"-> flip both axis"
	If MultiKey(&h17) Then effect = 18	:Print #1, "off"					,"-> original image"
	
	Select Case effect
		Case 1: gfxInvert()
		Case 2: gfxGrayscale()
		Case 3: gfxBrightness(30)
		Case 4: gfxContrast(30)
		Case 5: gfxEmboss()
		Case 6: gfxSephia()
		Case 7: gfxSoftGlow(100)
		Case 8: gfxColorAnd(GFX_RED)
		Case 9: gfxPruneColor(GFX_C64)
		Case 10: gfxRGBNoise(255, Rnd())
		Case 11: gfxBlur(10)
		Case 12: gfxSharpen(2)
		Case 13: gfxSobelGradient()
		Case 14: gfxMonochrome()
		Case 15: gfxFlipV()
		Case 16: gfxFlipH()
		Case 17: gfxFlipHV()
	End Select


	ScreenUnLock
	Sleep 5

Loop Until MultiKey(1)

gfxDeInit()

