import { RGBATupleToString } from '../../../../../common/color_library_wrappers' ; import { Fill , Rect , Stroke } from '../../../../../geoms/types' ; import { withClipRanges } from '../../../../../renderers/canvas' ; import { ClippedRanges } from '../../../../../utils/geometry' ; import { Point } from '../../../../../utils/point' ; import { renderMultiLine } from './line' ; internal export function renderLinePaths ( ctx , transform , linePaths , stroke , fitStroke , clippedRanges , clippings , shouldClip ) { withClipRanges ( ctx , clippedRanges , clippings , false , ( ) => { ctx . translate ( transform . x , transform . y ) ; renderMultiLine ( ctx , linePaths , stroke ) ; } ) ; if ( clippedRanges . length > 0 && shouldClip ) { withClipRanges ( ctx , clippedRanges , clippings , true , ( ) => { ctx . translate ( transform . x , transform . y ) ; renderMultiLine ( ctx , linePaths , fitStroke ) ; } ) ; } } internal export function renderAreaPath ( ctx , transform , area , fill , fitFill , clippedRanges , clippings , shouldClip ) { withClipRanges ( ctx , clippedRanges , clippings , false , ( ) => renderPathFill ( ctx , area , fill , transform ) ) ; if ( clippedRanges . length > 0 && shouldClip ) { withClipRanges ( ctx , clippedRanges , clippings , true , ( ) => renderPathFill ( ctx , area , fitFill , transform ) ) ; } } function renderPathFill ( ctx , path , fill , { x , y } ) { ctx . translate ( x , y ) ; const path2d = new Path2D ( path ) ; ctx . fillStyle = RGBATupleToString ( fill . color ) ; ctx . fill ( path2d ) ; if ( fill . texture ) { ctx . fillStyle = fill . texture . pattern ; ctx . fill ( path2d ) ; } }