-- Painted
-- Revision 1

--@TBCONFIG SLIDER: Detail Retention, 5
--@TBCONFIG SLIDER: Blending, 98
--@TBCONFIG SLIDER: Contrast, 22
--@TBCONFIG SLIDER: Saturation, 50
--@TBCONFIG SLIDER: EdgeDetail, 40

--@TBCONFIG FLAG: Enhanced Highlights, true
--@TBCONFIG FLAG: Linear Enhanced, false
--@TBCONFIG INFO: Painted
--@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("Detail Blur",0,sliderVal1 * 1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
paint_filter("Surface Blur",0,900,sliderVal2 * 1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
paint_filter("Contrast Mask",0,1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

paint_filter("Surface Blur",0,500,600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

if flagVal2 == false then
  paint_filter("Photo Detailer",0,1000,sliderVal3 * 1000,350 + sliderVal4 * 200,sliderVal5 * 750,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
else  
  paint_filter("Photo Detailer",0,600,sliderVal3 * 1000,400 + sliderVal4 * 200,sliderVal5 * 750,0,0,3,0,0,0,0,0,0,0,0,0,0,0)
end

paint_filter("Surface Blur",0,700,600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

if flagVal1 == true then
  paint_buffer_from_layer(0)

  paint_filter("Hyper Contrast",0,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
  paint_mask_create_from_image_luma()
  paint_mask_invert()
  paint_mask_on(0)
  paint_buffer_to_layer(0)

  paint_mask_on(1)
  paint_filter("Hyper Contrast",0,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
  paint_mask_clear()
end 

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

paint_close()




