1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-27 04:48:05 +11:00

Replace app-klogo with a more general app-bmpview

This commit is contained in:
20kdc 2018-07-25 23:43:29 +01:00
parent b320dfe083
commit 76448b8187
4 changed files with 16 additions and 19 deletions

View File

@ -110,31 +110,29 @@ return {
"apps/app-taskmgr.lua" "apps/app-taskmgr.lua"
} }
}, },
["app-klogo"] = { ["app-bmpview"] = {
desc = "KittenOS NEO Logo shower", desc = "KittenOS NEO .bmp viewer",
v = 2, v = 5,
deps = { deps = {
"neo", "neo",
"app-klogo-logo"
}, },
dirs = { dirs = {
"apps" "apps"
}, },
files = { files = {
"apps/app-klogo.lua", "apps/app-bmpview.lua",
}, },
}, },
["app-klogo-logo"] = { ["neo-logo"] = {
desc = "KittenOS NEO Logo (data)", desc = "KittenOS NEO Logo (data)",
v = 5, v = 5,
deps = { deps = {
}, },
dirs = { dirs = {
"data", "doc"
"data/app-klogo"
}, },
files = { files = {
"data/app-klogo/logo.bmp" "doc/logo.bmp"
}, },
}, },
["app-flash"] = { ["app-flash"] = {
@ -179,7 +177,7 @@ return {
}, },
["neo-meta"] = { ["neo-meta"] = {
desc = "KittenOS NEO: Use 'All' to install to other disks", desc = "KittenOS NEO: Use 'All' to install to other disks",
v = 2, v = 5,
deps = { deps = {
"neo", "neo",
"neo-init", "neo-init",
@ -188,7 +186,8 @@ return {
"neo-icecap", "neo-icecap",
"neo-secpolicy", "neo-secpolicy",
"neo-coreapps", "neo-coreapps",
"app-klogo", "neo-logo",
"app-bmpview",
"app-flash", "app-flash",
"app-claw", "app-claw",
"app-wget" "app-wget"

View File

@ -5,8 +5,7 @@ local event = require("event")(neo)
local neoux = require("neoux")(event, neo) local neoux = require("neoux")(event, neo)
local braille = require("braille") local braille = require("braille")
local bmp = require("bmp") local bmp = require("bmp")
local icecap = neo.requireAccess("x.neo.pub.base", "loadimg") local file = neoux.fileDialog(false)
local file = icecap.open("/logo.bmp", false)
local header = file.read(bmp.headerMinSzBMP) local header = file.read(bmp.headerMinSzBMP)
local palette = "" local palette = ""
@ -61,9 +60,6 @@ lcWidth = bitmap.dsSpan
local running = true local running = true
local function decodeRGB(rgb, igp, col) local function decodeRGB(rgb, igp, col)
if igp and bitmap.bpp > 24 then
rgb = math.floor(rgb / 256)
end
local r, g, b = math.floor(rgb / 65536) % 256, math.floor(rgb / 256) % 256, rgb % 256 local r, g, b = math.floor(rgb / 65536) % 256, math.floor(rgb / 256) % 256, rgb % 256
-- the new KittenOS NEO logo is 'sensitive' to dithering, so disable it -- the new KittenOS NEO logo is 'sensitive' to dithering, so disable it
if not col then if not col then
@ -82,6 +78,8 @@ local fp = neoux.tcwindow(bW, bH, {
braille.new(1, 1, bW, bH, { braille.new(1, 1, bW, bH, {
selectable = true, selectable = true,
get = function (window, x, y, bg, fg, selected, colour) get = function (window, x, y, bg, fg, selected, colour)
if x > bitmap.width then return 0, 0, 0 end
if y > bitmap.height then return 0, 0, 0 end
if bitmap.ignoresPalette then if bitmap.ignoresPalette then
return decodeRGB(bitmap.getPixel(x - 1, y - 1, 0), true, colour) return decodeRGB(bitmap.getPixel(x - 1, y - 1, 0), true, colour)
end end
@ -95,9 +93,9 @@ end, 0xFFFFFF, 0)
neoux.create(bW, bH, nil, function (w, t, r, ...) neoux.create(bW, bH, nil, function (w, t, r, ...)
if t == "focus" then if t == "focus" then
if r then if r and not bitmap.ignoresPalette then
local pal = {} local pal = {}
for i = 0, 15 do for i = 0, math.min(15, bitmap.paletteCol - 1) do
pal[i + 1] = bitmap.getPalette(i) pal[i + 1] = bitmap.getPalette(i)
end end
w.recommendPalette(pal) w.recommendPalette(pal)

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -3,7 +3,7 @@
# This is released into the public domain. # This is released into the public domain.
# No warranty is provided, implied or otherwise. # No warranty is provided, implied or otherwise.
cp ocemu.cfg.default ocemu.cfg && rm -rf c1-sda c1-sdb tmpfs cp ocemu.cfg.default ocemu.cfg && rm -rf c1-sda c1-sdb
mkdir c1-sda c1-sdb mkdir c1-sda c1-sdb
echo -n c1-sda > c1-eeprom/data.bin echo -n c1-sda > c1-eeprom/data.bin
cd .. cd ..