summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility/image-compositor-functions/fill.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-11-06 20:25:17 +0900
committerGitHub <noreply@github.com>2025-11-06 20:25:17 +0900
commit4ba18690d7abd7eea086bb59e6cbcc8ead9e121a (patch)
tree7d25ec47d8711d945b08e3903642f2e982f40048 /packages/frontend/src/utility/image-compositor-functions/fill.ts
parentfix(frontend): improve startViewTransition handling (diff)
downloadmisskey-4ba18690d7abd7eea086bb59e6cbcc8ead9e121a.tar.gz
misskey-4ba18690d7abd7eea086bb59e6cbcc8ead9e121a.tar.bz2
misskey-4ba18690d7abd7eea086bb59e6cbcc8ead9e121a.zip
feat(frontend): EXIFフレーム機能 (#16725)
* wip * wip * Update ImageEffector.ts * Update image-label-renderer.ts * Update image-label-renderer.ts * wip * Update image-label-renderer.ts * wip * wip * wip * wip * wip * wip * wip * Update use-uploader.ts * Update watermark.ts * wip * wu * wip * Update image-frame-renderer.ts * wip * wip * Update image-frame-renderer.ts * Create ImageCompositor.ts * Update ImageCompositor.ts * wip * wip * Update ImageEffector.ts * wip * Update use-uploader.ts * wip * wip * wip * wip * Update fxs.ts * wip * wip * wip * Update CHANGELOG.md * wip * wip * Update MkImageEffectorDialog.vue * Update MkImageEffectorDialog.vue * Update MkImageFrameEditorDialog.vue * Update use-uploader.ts * improve error handling * Update use-uploader.ts * 🎨 * wip * wip * lazy load * lazy load * wip * wip * wip
Diffstat (limited to 'packages/frontend/src/utility/image-compositor-functions/fill.ts')
-rw-r--r--packages/frontend/src/utility/image-compositor-functions/fill.ts100
1 files changed, 100 insertions, 0 deletions
diff --git a/packages/frontend/src/utility/image-compositor-functions/fill.ts b/packages/frontend/src/utility/image-compositor-functions/fill.ts
new file mode 100644
index 0000000000..901bdadfe5
--- /dev/null
+++ b/packages/frontend/src/utility/image-compositor-functions/fill.ts
@@ -0,0 +1,100 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import shader from './fill.glsl';
+import type { ImageEffectorUiDefinition } from '../image-effector/ImageEffector.js';
+import { defineImageCompositorFunction } from '@/lib/ImageCompositor.js';
+import { i18n } from '@/i18n.js';
+
+export const fn = defineImageCompositorFunction<{
+ offsetX: number;
+ offsetY: number;
+ scaleX: number;
+ scaleY: number;
+ ellipse: boolean;
+ angle: number;
+ color: [number, number, number];
+ opacity: number;
+}>({
+ shader,
+ main: ({ gl, u, params }) => {
+ gl.uniform2f(u.offset, params.offsetX / 2, params.offsetY / 2);
+ gl.uniform2f(u.scale, params.scaleX / 2, params.scaleY / 2);
+ gl.uniform1i(u.ellipse, params.ellipse ? 1 : 0);
+ gl.uniform1f(u.angle, params.angle / 2);
+ gl.uniform3f(u.color, params.color[0], params.color[1], params.color[2]);
+ gl.uniform1f(u.opacity, params.opacity);
+ },
+});
+
+export const uiDefinition = {
+ name: i18n.ts._imageEffector._fxs.fill,
+ params: {
+ offsetX: {
+ label: i18n.ts._imageEffector._fxProps.offset + ' X',
+ type: 'number',
+ default: 0.0,
+ min: -1.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 100) + '%',
+ },
+ offsetY: {
+ label: i18n.ts._imageEffector._fxProps.offset + ' Y',
+ type: 'number',
+ default: 0.0,
+ min: -1.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 100) + '%',
+ },
+ scaleX: {
+ label: i18n.ts._imageEffector._fxProps.scale + ' W',
+ type: 'number',
+ default: 0.5,
+ min: 0.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 100) + '%',
+ },
+ scaleY: {
+ label: i18n.ts._imageEffector._fxProps.scale + ' H',
+ type: 'number',
+ default: 0.5,
+ min: 0.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 100) + '%',
+ },
+ ellipse: {
+ label: i18n.ts._imageEffector._fxProps.circle,
+ type: 'boolean',
+ default: false,
+ },
+ angle: {
+ label: i18n.ts._imageEffector._fxProps.angle,
+ type: 'number',
+ default: 0,
+ min: -1.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 90) + '°',
+ },
+ color: {
+ label: i18n.ts._imageEffector._fxProps.color,
+ type: 'color',
+ default: [1, 1, 1],
+ },
+ opacity: {
+ label: i18n.ts._imageEffector._fxProps.opacity,
+ type: 'number',
+ default: 1.0,
+ min: 0.0,
+ max: 1.0,
+ step: 0.01,
+ toViewValue: v => Math.round(v * 100) + '%',
+ },
+ },
+} satisfies ImageEffectorUiDefinition<typeof fn>;