MiniQuake

src/miniquake/render/texture_upscale.ml

Package
miniquake.render.texture_upscale
Reachable
Yes

Imports

Declarations

absoluteInteger

function absoluteInteger(value)

Return an absolute integer without converting the hot scaler path to float.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `absoluteInteger`.

View source

apply

function apply(pixels, width, height, mode)

Apply one selected load-time upscaler and return [pixels, width, height].

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `apply`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.
modedynamic—The mode input consumed by `apply`.

View source

blendCorner

function blendCorner(destination, destinationOffset, source, center, first, second, centerWeight, neighborWeight)

Blend a center pixel with two edge neighbors in premultiplied-alpha space. This prevents the hidden RGB value of Quake palette index 255 from forming colored fringes around sprite and alias-model cutouts.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
destinationOffsetdynamic—Zero-based offset of the requested data.
sourcedynamic—Source value or collection to read.
centerdynamic—The center input consumed by `blendCorner`.
firstdynamic—The first input consumed by `blendCorner`.
seconddynamic—The second input consumed by `blendCorner`.
centerWeightdynamic—The center weight input consumed by `blendCorner`.
neighborWeightdynamic—The neighbor weight input consumed by `blendCorner`.

View source

clampMode

function clampMode(mode)

Clamp a persisted or console-provided mode to the supported range.

ParameterTypeDefaultDescription
modedynamic—The mode input consumed by `clampMode`.

View source

copyPixel

function copyPixel(destination, destinationOffset, source, sourceOffset)

Copy one complete pixel into an already allocated destination image.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
destinationOffsetdynamic—Zero-based offset of the requested data.
sourcedynamic—Source value or collection to read.
sourceOffsetdynamic—Zero-based offset of the requested data.

View source

edgeAware2x

function edgeAware2x(pixels, width, height, xbr)

Apply HQ2x or xBR2x edge-directed smoothing without touching flat regions.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `edgeAware2x`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.
xbrdynamic—The xbr input consumed by `edgeAware2x`.

View source

hqCorner

function hqCorner(output, destination, pixels, center, first, second)

Blend one HQ2x corner when its two adjoining colors form a coherent edge.

ParameterTypeDefaultDescription
outputdynamic—Destination buffer updated with the HQ-filtered corner.
destinationdynamic—Destination value or collection to update.
pixelsdynamic—The pixels input consumed by `hqCorner`.
centerdynamic—The center input consumed by `hqCorner`.
firstdynamic—The first input consumed by `hqCorner`.
seconddynamic—The second input consumed by `hqCorner`.

View source

modeName

function modeName(mode)

Return the stable English display name for one texture-upscale mode.

ParameterTypeDefaultDescription
modedynamic—The mode input consumed by `modeName`.

View source

nearest

function nearest(pixels, width, height, factor)

Enlarge an RGBA image with exact nearest-neighbor replication.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `nearest`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.
factordynamic—The factor input consumed by `nearest`.

View source

pixelDistance

function pixelDistance(pixels, first, second)

Measure perceptual RGBA distance with extra weight on green and alpha.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `pixelDistance`.
firstdynamic—The first input consumed by `pixelDistance`.
seconddynamic—The second input consumed by `pixelDistance`.

View source

pixelsEqual

function pixelsEqual(pixels, first, second)

Report exact equality for two RGBA pixels in the same byte buffer.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `pixelsEqual`.
firstdynamic—The first input consumed by `pixelsEqual`.
seconddynamic—The second input consumed by `pixelsEqual`.

View source

pixelsSimilar

function pixelsSimilar(pixels, first, second, threshold)

Report perceptual similarity at the supplied HQ/xBR edge threshold.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `pixelsSimilar`.
firstdynamic—The first input consumed by `pixelsSimilar`.
seconddynamic—The second input consumed by `pixelsSimilar`.
thresholddynamic—The threshold input consumed by `pixelsSimilar`.

View source

scale2x

function scale2x(pixels, width, height)

Apply the canonical Scale2x neighborhood rules to an RGBA image.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `scale2x`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.

View source

scale3x

function scale3x(pixels, width, height)

Apply the canonical Scale3x 3x3 neighborhood rules to an RGBA image.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `scale3x`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.

View source

scaleFactor

function scaleFactor(mode)

Return the integer enlargement factor associated with a mode.

ParameterTypeDefaultDescription
modedynamic—The mode input consumed by `scaleFactor`.

View source

UPSCALE_HQ2X

const UPSCALE_HQ2X = 4

Defines the upscale hq2 x value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_MODE_COUNT

const UPSCALE_MODE_COUNT = 7

Defines the upscale mode count value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_NEAREST_2X

const UPSCALE_NEAREST_2X = 1

Defines the upscale nearest 2 x value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_OFF

const UPSCALE_OFF = 0

Defines the upscale off value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_SCALE2X

const UPSCALE_SCALE2X = 2

Defines the upscale scale2 x value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_SCALE3X

const UPSCALE_SCALE3X = 3

Defines the upscale scale3 x value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_XBR2X

const UPSCALE_XBR2X = 5

Defines the upscale xbr2 x value used by `miniquake.render.texture_upscale`.

View source

UPSCALE_XBR4X

const UPSCALE_XBR4X = 6

Defines the upscale xbr4 x value used by `miniquake.render.texture_upscale`.

View source

validateSource

function validateSource(pixels, width, height)

Validate dimensions and the complete RGBA source span before scaling.

ParameterTypeDefaultDescription
pixelsdynamic—The pixels input consumed by `validateSource`.
widthdynamic—Requested width in pixels or data units.
heightdynamic—Requested height in pixels or data units.

View source

xbrCorner

function xbrCorner(output, destination, pixels, center, first, second, diagonal, farFirst, farSecond)

Blend one xBR corner after comparing the two competing diagonal gradients.

ParameterTypeDefaultDescription
outputdynamic—Destination buffer updated with the xBR-filtered corner.
destinationdynamic—Destination value or collection to update.
pixelsdynamic—The pixels input consumed by `xbrCorner`.
centerdynamic—The center input consumed by `xbrCorner`.
firstdynamic—The first input consumed by `xbrCorner`.
seconddynamic—The second input consumed by `xbrCorner`.
diagonaldynamic—The diagonal input consumed by `xbrCorner`.
farFirstdynamic—The far first input consumed by `xbrCorner`.
farSeconddynamic—The far second input consumed by `xbrCorner`.

View source