Skip to content

Commit

Permalink
use universial scan settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rwv committed Nov 17, 2023
1 parent 3582563 commit 44f8d5f
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import ScaleSetting from "./settings/ScaleSetting.vue";
import BrightnessSetting from "./settings/BrightnessSetting.vue";
import ContrastSetting from "./settings/ContrastSetting.vue";
import type { ScanConfig } from "@/utils/scan-renderer/canvas-scan";
import type { ScanConfig } from "@/utils/scan-renderer";
import { useI18n } from "vue-i18n";
import { useVModel } from "@vueuse/core";
Expand Down
14 changes: 14 additions & 0 deletions src/utils/scan-renderer/config.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const colorspaces = ["gray", "sRGB"] as const;

export interface ScanConfig {
rotate: number;
rotate_var: number;
colorspace: typeof colorspaces[number];
blur: number;
noise: number;
border: boolean;
scale: number;
brightness: number;
contrast: number;
output_format: "image/png" | "image/jpeg";
}
1 change: 1 addition & 0 deletions src/utils/scan-renderer/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type { ScanRenderer } from "./types";
export type { ScanConfig } from "./config.types";
9 changes: 6 additions & 3 deletions src/views/CanvasScanView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
<script lang="ts" setup>
import { NGrid, NGridItem, NSpace } from "naive-ui";
import MainContainer from "@/components/MainContainer.vue";
import { type ScanConfig, defaultConfig } from "@/utils/scan-renderer/canvas-scan";
import ScanSettingsCard from "@/components/canvas-scan/canvas-scan-settings/ScanSettingsCard.vue";
import {
type ScanConfig,
defaultConfig,
CanvasScanner,
} from "@/utils/scan-renderer/canvas-scan";
import ScanSettingsCard from "@/components/scan-settings/ScanSettingsCard.vue";
import PDFUpload from "@/components/pdf-upload/PDFUpload.vue";
import { ref, computed, onMounted, watch } from "vue";
import PDFURL from "@/assets/examples/pdfs/test.pdf";
Expand All @@ -49,7 +53,6 @@ import { useHead } from "@vueuse/head";
import { useI18n } from "vue-i18n";
import { PDF } from "@/utils/pdf-renderer/pdfjs";
import PreviewCompare from "@/components/page-preview/PreviewCompare.vue";
import { CanvasScanner } from "@/utils/scan-renderer/canvas-scan";
import SaveButtonCard from "@/components/save-button/SaveButtonCard.vue";
import { useSaveScannedPDF } from "@/composables/save-scanned-pdf";
import PDFInfo from "@/components/pdf-upload/PDFInfo.vue";
Expand Down
2 changes: 1 addition & 1 deletion src/views/MagicaScanView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
defaultConfig,
MagicaScanner,
} from "@/utils/scan-renderer/magica-scan";
import ScanSettingsCard from "@/components/canvas-scan/canvas-scan-settings/ScanSettingsCard.vue";
import ScanSettingsCard from "@/components/scan-settings/ScanSettingsCard.vue";
import PDFUpload from "@/components/pdf-upload/PDFUpload.vue";
import { ref, computed, onMounted, watch } from "vue";
import PDFURL from "@/assets/examples/pdfs/test.pdf";
Expand Down

0 comments on commit 44f8d5f

Please sign in to comment.