mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 22:45:40 +02:00
* 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
94 lines
2.2 KiB
TypeScript
94 lines
2.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import shader from './pixelate.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;
|
|
strength: 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.uniform1f(u.strength, params.strength * params.strength);
|
|
gl.uniform1i(u.samples, 256);
|
|
},
|
|
});
|
|
|
|
export const uiDefinition = {
|
|
name: i18n.ts._imageEffector._fxs.pixelate,
|
|
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) + '°',
|
|
},
|
|
strength: {
|
|
label: i18n.ts._imageEffector._fxProps.strength,
|
|
type: 'number',
|
|
default: 0.2,
|
|
min: 0.0,
|
|
max: 0.5,
|
|
step: 0.01,
|
|
},
|
|
},
|
|
} satisfies ImageEffectorUiDefinition<typeof fn>;
|