Change scanline order names

The scanline order ”bottom-top” has been changed to ”bottom_top”.
The scanline order “top-bottom” has been changed to “top_bottom”.

The scanline order names were changed so that API consumers can check if
“tga_encoder.features.scanline_order.top_bottom” is truthy instead of
having to check “tga_encoder.features.scanline_order["top-bottom"]”.

This is a breaking change, but since no release of tga_encoder happened
since commit 01bcbbf927 which allowed the
scanline order to be specified, it can not affect any mod on ContentDB.
This commit is contained in:
Nils Dagsson Moskopp 2023-11-28 21:35:00 +01:00
parent e599c9fe83
commit 0272fa5ccd
Signed by: erle
GPG Key ID: A3BC671C35191080
2 changed files with 13 additions and 13 deletions

View File

@ -14,8 +14,8 @@ tga_encoder.features.compression = {
["RLE"] = true,
}
tga_encoder.features.scanline_order = {
["bottom-top"] = true,
["top-bottom"] = true,
["bottom_top"] = true,
["top_bottom"] = true,
}
local image = setmetatable({}, {
@ -76,8 +76,8 @@ function image:encode_image_spec(properties)
)
local scanline_order = properties.scanline_order
assert (
"bottom-top" == scanline_order or
"top-bottom" == scanline_order
"bottom_top" == scanline_order or
"top_bottom" == scanline_order
)
local pixel_depth
if 0 ~= #properties.colormap then
@ -91,12 +91,12 @@ function image:encode_image_spec(properties)
local x_origin_hi = 0
local y_origin_lo = 0
local y_origin_hi = 0
local image_descriptor = 0 -- equal to bottom-top scanline order
local image_descriptor = 0 -- equal to bottom_top scanline order
local width_lo = self.width % 256
local width_hi = math.floor(self.width / 256)
local height_lo = self.height % 256
local height_hi = math.floor(self.height / 256)
if "top-bottom" == scanline_order then
if "top_bottom" == scanline_order then
image_descriptor = 32
y_origin_lo = height_lo
y_origin_hi = height_hi
@ -650,7 +650,7 @@ function image:encode(properties)
local properties = properties or {}
properties.colormap = properties.colormap or {}
properties.compression = properties.compression or "RAW"
properties.scanline_order = properties.scanline_order or "bottom-top"
properties.scanline_order = properties.scanline_order or "bottom_top"
self.pixel_depth = #self.pixels[1][1] * 8

View File

@ -29,8 +29,8 @@ local pixels_colormapped_tb = {
}
local pixels_colormapped_by_scanline_order = {
["bottom-top"] = pixels_colormapped_bt,
["top-bottom"] = pixels_colormapped_tb,
["bottom_top"] = pixels_colormapped_bt,
["top_bottom"] = pixels_colormapped_tb,
}
local colormap_32bpp = {
@ -119,8 +119,8 @@ local pixels_rgba_tb = {
}
local pixels_rgba_by_scanline_order = {
["bottom-top"] = pixels_rgba_bt,
["top-bottom"] = pixels_rgba_tb,
["bottom_top"] = pixels_rgba_bt,
["top_bottom"] = pixels_rgba_tb,
}
local _ = { 0, 0, 0 }
@ -151,8 +151,8 @@ local pixels_rgb_tb = {
}
local pixels_rgb_by_scanline_order = {
["bottom-top"] = pixels_rgb_bt,
["top-bottom"] = pixels_rgb_tb,
["bottom_top"] = pixels_rgb_bt,
["top_bottom"] = pixels_rgb_tb,
}
local tga_type_by_compression = {