--@TBCONFIG VARIANT: Variation, 15000
--@TBCONFIG SLIDER: Size, 15
--@TBCONFIG SLIDER: Detail Size, 30
--@TBCONFIG SLIDER: Detail Softness, 50
--@TBCONFIG SLIDER: Hue Adjustment, 59
--@TBCONFIG SLIDER: Contrast, 60

--@TBCONFIG FLAG: Add Grain, false

--@TBCONFIG INFO: Frame Maker
--@TBCONFIG INFO: Revision 2
--@TBCONFIG INFO: This filter does not honor any existing masks and will disable the mask.
--@TBCONFIG INFO:  

paint_open(0)

-- Standard mask preservation
-- paint_buffer_from_layer(30)
paint_buffer_from_mask(31)

paint_filter("Vignette",0,0,0,0,50,500 - (sliderVal1 * 500),750,0,0,1,0,0,1,1,0,255,255,255,0)
paint_buffer_from_layer(0)

paint_set_page(65535,65535,65535,65535)

paint_filter("Vignette",0,0,0,0,0,500 - (sliderVal1 * 500),1000,0,0,1,0,0,1,1,0,255,255,255,0)
paint_mask_create_from_image_luma()

paint_mask_on(0)
paint_buffer_to_layer(0)

paint_mask_on(1)
paint_filter("Generate Noise",variantVal,sliderVal2 * 40,sliderVal2 * 40,0,0,0,0,0,0,1,1,0,0,0,0,255,255,255,0)
paint_filter("Gaussian Blur",0,sliderVal3 * 120,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0)

if flagVal1 == true then
  paint_filter("Add Gaussian Noise",0,5,0,0,0,0,0,0,0,1,0,0,0,0,0,255,255,255,0)
end   

paint_filter("Levels",0,0,1000,500 - sliderVal5 * 500,500 + (sliderVal5 * 500),0,0,0,0,1,1,1,0,0,0,255,255,255,0)
paint_filter("Borderize",0,0,1000,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0)
paint_filter("Adjust HSL",0,sliderVal4 * 1000,810,400,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0)
paint_filter("Bevel",0,1000,160,300,400,300,0,0,0,0,0,0,0,0,0,255,255,255,0)

paint_mask_on(0)
paint_mask_clear()

-- Standard mask preservation
paint_buffer_to_mask(31)
--paint_mask_invert()
--paint_mask_on(1)
--paint_buffer_to_layer(30)
--paint_mask_invert()

paint_close()




