<commit_before>import Type from '../../../PluginSupport/type-descriptor'
import { TypeDescriptor } from '../../../PluginSupport/type-descriptor'
import PreRenderingRequest from '../../PreRenderingRequest'
import RenderingRequest from '../../RenderRequest'
import { IRenderer } from '../RendererBase'

interface Param {
    opacity: number
}

export default class AdjustmentRenderer implements IRenderer<Param>
{
    public static get rendererId(): string { return 'adjustment' }

    public static provideAssetAssignMap()
    {
        return {}
    }

    public static provideParameters(): TypeDescriptor
    {
        return Type
            .number('opacity', { label: 'Opacity', defaultValue: 100, animatable: true })
    }

    public async beforeRender(req: PreRenderingRequest<Param>) { return }

    public async render(req: RenderingRequest<Param>)
    {
        req.destCanvas.getContext('2d')!.drawImage(req.srcCanvas!, 0, 0)
    }
}<commit_msg>Fix unexpected ignoring opacity in Adjustment clip<commit_after>import * as _ from 'lodash'

import Type from '../../../PluginSupport/type-descriptor'
import { TypeDescriptor } from '../../../PluginSupport/type-descriptor'
import PreRenderingRequest from '../../PreRenderingRequest'
import RenderingRequest from '../../RenderRequest'
import { IRenderer } from '../RendererBase'

interface Param {
    opacity: number
}

export default class AdjustmentRenderer implements IRenderer<Param>
{
    public static get rendererId(): string { return 'adjustment' }

    public static provideAssetAssignMap()
    {
        return {}
    }

    public static provideParameters(): TypeDescriptor
    {
        return Type
            .number('opacity', { label: 'Opacity', defaultValue: 100, animatable: true })
    }

    public async beforeRender(req: PreRenderingRequest<Param>) { return }

    public async render(req: RenderingRequest<Param>)
    {
        const ctx = req.destCanvas.getContext('2d')!
        ctx.globalAlpha = _.clamp(req.parameters.opacity, 0, 100) / 100
        ctx.drawImage(req.srcCanvas!, 0, 0)
    }
}
{'fraction_non_alphanumeric': 0.12427745664739884, 'fraction_numerical': 0.009152215799614644, 'mean_word_length': 3.309128630705394, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '137882', 'n_tokens_mistral': 565, 'n_tokens_neox': 545, 'n_words': 150}