add color
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-01 21:20:54 +07:00
parent 573237fe1f
commit d4763e3557
4 changed files with 57 additions and 13 deletions
+6 -7
View File
@@ -7,15 +7,18 @@ const props = defineProps<{
hMargin: number;
imageWidth: number;
imageHeight: number;
imageBackgroundColor: string;
}>();
const ctx = ref<null | CanvasRenderingContext2D>(null);
const clearCanvas = () => {
const { imageWidth, imageHeight } = props;
const { imageWidth, imageHeight, imageBackgroundColor } = props;
if (ctx.value) {
ctx.value.clearRect(0, 0, imageWidth * ONE_MM, imageHeight * ONE_MM);
ctx.value.shadowColor
ctx.value.fillStyle = imageBackgroundColor;
ctx.value.fillRect(0, 0, imageWidth * ONE_MM, imageHeight * ONE_MM);
ctx.value.beginPath();
}
};
@@ -58,11 +61,7 @@ onUpdated(() => {
</script>
<template>
<canvas
id="canvas"
:width="imageWidth * ONE_MM"
:height="imageHeight * ONE_MM"
/>
<canvas id="canvas" :width="imageWidth * ONE_MM" :height="imageHeight * ONE_MM" />
</template>
<style scoped>