/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{i8888to32 as n}from"./number.js";function r(n,r=0,t=!1){const o=n[r+3];return n[r]*=o,n[r+1]*=o,n[r+2]*=o,t||(n[r+3]*=255),n}function t(r){if(!r)return 0;const{r:t,g:o,b:u,a:i}=r;return n(t*i,o*i,u*i,255*i)}function o(r){if(!r)return 0;const[t,o,u,i]=r;return n(t*(i/255),o*(i/255),u*(i/255),i)}function u(n,r,t=0){if(null==r)return n[t]=0,n[t+1]=0,n[t+2]=0,void(n[t+3]=0);const{r:o,g:u,b:i,a:c}=r;n[t]=o*c/255,n[t+1]=u*c/255,n[t+2]=i*c/255,n[t+3]=c}export{r as premultiplyAlpha,t as premultiplyAlphaRGBA,o as premultiplyAlphaRGBAArray,u as writeColor};
