96 lines · 2.7 KB · JavaScript
RawDownload
module.exports = {	HINT_NO_ANTIALIASING: (1 << 0),	HINT_NO_TEXT_ANTIALIASING: (1 << 1),	HINT_NEAREST_SCALING: (1 << 2), 	TEXT_ALIGN_LEFT: (1 << 0),	TEXT_ALIGN_RIGHT: (1 << 1),	TEXT_ALIGN_HCENTER: (1 << 2),	TEXT_ALIGN_JUSTIFY: (1 << 3),	//TEXT_ALIGN_ABSOLUTE: (1 << 4),	TEXT_ALIGN_TOP: (1 << 5),	TEXT_ALIGN_BOTTOM: (1 << 6),	TEXT_ALIGN_VCENTER: (1 << 7),	//TEXT_ALIGN_BASELINE: (1 << 8),	TEXT_ALIGN_CENTER: (1 << 2) | (1 << 7), 	BLEND_SOURCEOVER: 0,	BLEND_DESTINATIONOVER: 1,	BLEND_CLEAR: 2,	BLEND_SOURCE: 3,	BLEND_DESTINATION: 4,	BLEND_SOURCEIN: 5,	BLEND_DESTINATIONIN: 6,	BLEND_SOURCEOUT: 7,	BLEND_DESTINATIONOUT: 8,	BLEND_SOURCEATOP: 9,	BLEND_DESTINATIONATOP: 10,	BLEND_XOR: 11,	BLEND_PLUS: 12,	BLEND_MULTIPLY: 13,	BLEND_SCREEN: 14,	BLEND_OVERLAY: 15,	BLEND_DARKEN: 16,	BLEND_LIGHTEN: 17,	BLEND_COLORDODGE: 18,	BLEND_COLORBURN: 19,	BLEND_HARDLIGHT: 20,	BLEND_SOFTLIGHT: 21,	BLEND_DIFFERENCE: 22,	BLEND_EXCLUSION: 23, 	PATH_TYPE_MOVE: 0,	PATH_TYPE_LINE: 1,	PATH_TYPE_CUBIC: 2, 	strokeWidth: width => ({type: "strokeWidth", width: width}),	color: color => ({type: "color", color: color}),	hints: hints => ({type: "hints", hints: hints}),	blendMode: mode => ({type: "blendMode", mode: mode}),	font: (family, size = 16, weight = 400, italic = false) => ({		type: "font",		family: family,		size: size,		weight: weight,		italic: italic,	}),	clearRect: (x, y, w, h) => ({type: "clearRect", x: x, y: y, w: w, h: h}),	fillPath: path => ({type: "fillPath", path: path}),	fillRect: (x, y, w, h) => ({type: "fillRect", x: x, y: y, w: w, h: h}),	fillEllipse: (x, y, w, h) => ({type: "fillEllipse", x: x, y: y, w: w, h: h}),	fillText: (text, x, y, w, h, flags) => ({        type: "fillText",        text: text,        x: x,        y: y,        w: w ?? 0,        h: h ?? 0,        flag: flags,    }),	strokePath: path => ({type: "strokePath", path: path}),	strokeRect: (x, y, w, h) => ({type: "strokeRect", x: x, y: y, w: w, h: h}),	strokeArc: (x, y, w, h, startAngle, spanAngle) => ({		type: "strokeArc",		x: x,		y: y,		w: w,		h: h,		startAngle: startAngle,		spanAngle: spanAngle,	}),	strokeEllipse: (x, y, w, h) => ({type: "strokeEllipse", x: x, y: y, w: w, h: h}),	point: (x, y) => ({type: "point", x: x, y: y}),	line: (x1, y1, x2, y2) => ({type: "line", x1: x1, y1: y1, x2: x2, y2: y2}),	imageCopy: (img, srcRect, destRect) => ({		type: "imageCopy",		image: img,		srcX: srcRect[0] ?? srcRect.x,        srcY: srcRect[1] ?? srcRect.y,        srcW: srcRect[2] ?? srcRect.width,        srcH: srcRect[3] ?? srcRect.height,		destX: destRect[0] ?? destRect.x,        destY: destRect[1] ?? destRect.y,        destW: destRect[2] ?? destRect.width,        destH: destRect[3] ?? destRect.height,	}),};