sfml.js
    Preparing search index...

    Class Texture

    GPU texture with background image decoding and ordered pixel uploads.

    Index

    Constructors

    Properties

    "[graphicsNative]": NativeGraphicsHandle<"texture">
    "[textureId]": number
    "[textureOwner]"?: PendingTarget

    Methods

    • 同步深复制 source 到当前纹理,保留当前包装对象身份并返回 this。

      Parameters

      • source: Readonly

      Returns this

    • 生成缩小采样用的 mipmap 层级,返回是否成功;更新像素后需要重新生成。

      Returns boolean

    • 返回 OpenGL 纹理标识,空纹理为 0;使用期间需保留纹理对象。

      Returns number

    • 异步解码文件后上传像素,返回是否成功;area 使用像素坐标,默认整张图像。

      Parameters

      Returns Promise<boolean>

    • 异步解码编码图像字节后上传像素,返回是否成功;sRgb 默认 false。

      Parameters

      Returns Promise<boolean>

    • Successful resize leaves pixel contents undefined, as in SFML.

      Parameters

      • size: Readonly<Vector2u>
      • sRgb: boolean = false

      Returns boolean

    • 设置超出纹理范围的坐标是否重复平铺;false 使用边缘像素。

      Parameters

      • repeated: boolean

      Returns void

    • 启用或关闭纹理平滑过滤。

      Parameters

      • smooth: boolean

      Returns void

    • 同步更新整个纹理;pixels 必须恰好包含宽×高×4 个 RGBA8 字节。

      Parameters

      • pixels: Uint8Array

      Returns void

    • 将 size 大小的 RGBA8 像素块上传到 dest;所有坐标和尺寸均以像素计。

      Parameters

      Returns void

    • 将图像、纹理或窗口内容复制到 dest(默认原点),目标区域必须容纳整个源。

      Parameters

      • source:
            | Image
            | Readonly<
                Pick<
                    Texture,
                    | "getSize"
                    | typeof graphicsNative
                    | typeof textureId
                    | typeof textureOwner
                    | "copyToImage"
                    | "isSmooth"
                    | "isRepeated"
                    | "isSrgb"
                    | "getNativeHandle",
                >,
            >
            | Window
      • Optionaldest: Readonly<Vector2u>

      Returns void

    • Bind in the current GL context; retain the texture while using its ID.

      Parameters

      • texture:
            | null
            | Readonly<
                Pick<
                    Texture,
                    | "getSize"
                    | typeof graphicsNative
                    | typeof textureId
                    | typeof textureOwner
                    | "copyToImage"
                    | "isSmooth"
                    | "isRepeated"
                    | "isSrgb"
                    | "getNativeHandle",
                >,
            >
      • coordinateType: CoordinateType = CoordinateType.Normalized

      Returns void

    • 返回当前显卡支持的最大纹理边长,单位为像素。

      Returns number