export const supportsContextFilters = ( ) => 'filter' in CanvasRenderingContext2D . prototype ; export const createOffscreenContext = ( original ) : CanvasRenderingContext2D => { const canvas = document . createElement ( 'canvas' ) as HTMLCanvasElement ; canvas . height = original . canvas . height ; canvas . width = original . canvas . width ; Object . defineProperty ( canvas , '__skipFilterPatch' , { value : true } ) ; return canvas . getContext ( '2d' ) ; } ;