Various blitting related cleanups (#4789)

* Fix the "Enable debug logging" checkbox so that it properly disables "Enable verbose debug logging" when it gets disabled
* Avoid asking ImageWidget for alpha-blending when it's not useful
* Make ImageWidget's alpha-blending code-path double-check that alpha-blending actually is needed, and avoid it if possible
* In the same vein, only do alpha-blending in textboxwidget when absolutely necessary
* Prefer color constants over the gray() method, ensuring that they're part of the eInk palette

Depends on https://github.com/koreader/koreader-base/pull/853

Fix #4774
pull/4797/head
NiLuJe 5 years ago committed by Frans de Jonge
parent 1045bf8946
commit 2011cf1ad1

@ -229,7 +229,7 @@ function FileManagerMenu:setUpdateItemTable()
else
dbg:setVerbose(false)
dbg:turnOff()
G_reader_settings:flipTrue("debug_verbose")
G_reader_settings:flipFalse("debug_verbose")
end
end,
},

@ -95,7 +95,7 @@ function ReaderCropping:onPageCrop(mode)
self.orig_view_dimen = Geom:new{w = self.view.dimen.w, h = self.view.dimen.h}
-- backup original view bgcolor
self.orig_view_bgcolor = self.view.outer_page_color
self.view.outer_page_color = Blitbuffer.COLOR_GREY
self.view.outer_page_color = Blitbuffer.COLOR_DARK_GRAY
-- backup original page scroll
self.orig_page_scroll = self.view.page_scroll
self.view.page_scroll = false

@ -35,7 +35,6 @@ function ReaderDogear:setupDogear(new_dogear_size)
dimen = Geom:new{w = Screen:getWidth(), h = self.dogear_size},
ImageWidget:new{
file = "resources/icons/dogear.png",
alpha = true,
width = self.dogear_size,
height = self.dogear_size,
}

@ -539,7 +539,7 @@ function ReaderView:drawHighlightRect(bb, _x, _y, rect, drawer)
if drawer == "underscore" then
self.highlight.line_width = self.highlight.line_width or 2
self.highlight.line_color = self.highlight.line_color or Blitbuffer.gray(0.33)
self.highlight.line_color = self.highlight.line_color or Blitbuffer.COLOR_GRAY
bb:paintRect(x, y+h-1, w,
self.highlight.line_width,
self.highlight.line_color)

@ -211,7 +211,9 @@ function Device:onPowerEvent(ev)
G_reader_settings:readSetting("screensaver_type") == "cover" or
G_reader_settings:readSetting("screensaver_type") == "random_image" or
G_reader_settings:readSetting("screensaver_type") == "image_file" then
self.screen:clear(self.screen:getScreenWidth(), self.screen:getScreenHeight())
if not G_reader_settings:isTrue("screensaver_no_background") then
self.screen:clear(self.screen:getScreenWidth(), self.screen:getScreenHeight())
end
self.screen:refreshFull()
end
else

@ -150,7 +150,7 @@ function LuaSettings:flipFalse(key)
if self:isFalse(key) then
self:delSetting(key)
else
self:saveSetting(key, true)
self:saveSetting(key, false)
end
return self
end

@ -11,6 +11,7 @@ local function lastFile()
end
end
local function whiteBackground() return G_reader_settings:isTrue("screensaver_white_background") end
local function noBackground() return G_reader_settings:isTrue("screensaver_no_background") end
local function stretchImages() return G_reader_settings:isTrue("screensaver_stretch_images") end
return {
@ -137,6 +138,15 @@ return {
checked_func = whiteBackground,
callback = function()
G_reader_settings:saveSetting("screensaver_white_background", not whiteBackground())
G_reader_settings:flipFalse("screensaver_no_background")
end,
},
{
text = _("Leave background as-is behind message and images"),
checked_func = noBackground,
callback = function()
G_reader_settings:saveSetting("screensaver_no_background", not noBackground())
G_reader_settings:flipFalse("screensaver_white_background")
end,
},
{

@ -166,6 +166,10 @@ function Screensaver:whiteBackground()
return G_reader_settings:isTrue("screensaver_white_background")
end
function Screensaver:noBackground()
return G_reader_settings:isTrue("screensaver_no_background")
end
function Screensaver:excluded()
local lastfile = G_reader_settings:readSetting("lastfile")
local exclude_ss = false -- consider it not excluded if there's no docsetting
@ -237,7 +241,12 @@ function Screensaver:show(event, fallback_message)
return
end
local widget = nil
local background = Blitbuffer.COLOR_WHITE
local background = Blitbuffer.COLOR_BLACK
if self:whiteBackground() then
background = Blitbuffer.COLOR_WHITE
elseif self:noBackground() then
background = nil
end
if screensaver_type == "cover" then
local lastfile = G_reader_settings:readSetting("lastfile")
local exclude = false -- consider it not excluded if there's no docsetting
@ -258,14 +267,10 @@ function Screensaver:show(event, fallback_message)
widget = ImageWidget:new{
image = image,
image_disposable = true,
alpha = true,
height = Screen:getHeight(),
width = Screen:getWidth(),
scale_factor = not self:stretchImages() and 0 or nil,
}
if not self:whiteBackground() then
background = Blitbuffer.COLOR_BLACK
end
else
screensaver_type = "random_image"
end
@ -320,9 +325,6 @@ function Screensaver:show(event, fallback_message)
width = Screen:getWidth(),
scale_factor = not self:stretchImages() and 0 or nil,
}
if not self:whiteBackground() then
background = Blitbuffer.COLOR_BLACK
end
end
end
if screensaver_type == "image_file" then
@ -344,9 +346,6 @@ function Screensaver:show(event, fallback_message)
width = Screen:getWidth(),
scale_factor = not self:stretchImages() and 0 or nil,
}
if not self:whiteBackground() then
background = Blitbuffer.COLOR_BLACK
end
end
end
if screensaver_type == "readingprogress" then

@ -174,7 +174,7 @@ function BookStatusWidget:genHeader(title)
local header_title = TextWidget:new{
text = title,
face = self.medium_font_face,
fgcolor = Blitbuffer.gray(0.4),
fgcolor = Blitbuffer.COLOR_WEB_GRAY,
}
local padding_span = HorizontalSpan:new{ width = self.padding }
@ -182,7 +182,7 @@ function BookStatusWidget:genHeader(title)
local line_container = LeftContainer:new{
dimen = Geom:new{ w = line_width, h = height },
LineWidget:new{
background = Blitbuffer.gray(0.2),
background = Blitbuffer.COLOR_LIGHT_GRAY,
dimen = Geom:new{
w = line_width,
h = Size.line.thick,

@ -52,7 +52,7 @@ function Button:init()
self.label_widget = TextWidget:new{
text = self.text,
max_width = self.max_width and self.max_width - 2*self.padding - 2*self.margin - 2*self.bordersize or nil,
fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
bold = self.text_font_bold,
face = Font:getFace(self.text_font_face, self.text_font_size)
}
@ -144,7 +144,7 @@ function Button:enable()
if self.enabled then
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
else
self.label_widget.fgcolor = Blitbuffer.COLOR_GREY
self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY
end
else
self.label_widget.dim = not self.enabled
@ -157,7 +157,7 @@ function Button:disable()
if self.enabled then
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
else
self.label_widget.fgcolor = Blitbuffer.COLOR_GREY
self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY
end
else
self.label_widget.dim = not self.enabled

@ -25,7 +25,7 @@ local ButtonProgressWidget = InputContainer:new{
function ButtonProgressWidget:init()
self.buttonprogress_frame = FrameContainer:new{
background = Blitbuffer.COLOR_WHITE,
color = Blitbuffer.COLOR_GREY,
color = Blitbuffer.COLOR_DARK_GRAY,
radius = Size.radius.window,
bordersize = 0,
padding = self.padding,
@ -73,9 +73,9 @@ function ButtonProgressWidget:update()
end,
}
if self.thin_grey_style then
button.frame.color = Blitbuffer.COLOR_GREY -- no black border around grey squares
button.frame.color = Blitbuffer.COLOR_DARK_GRAY -- no black border around gray squares
if highlighted then
button.frame.background = Blitbuffer.COLOR_GREY
button.frame.background = Blitbuffer.COLOR_DARK_GRAY
button = FrameContainer:new{ -- add margin back
margin = button_margin,
padding = 0,

@ -68,7 +68,7 @@ function ButtonTable:init()
end
local button_dim = button:getSize()
local vertical_sep = LineWidget:new{
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{
w = self.sep_width,
h = button_dim.h,
@ -106,7 +106,7 @@ function ButtonTable:addHorizontalSep(vspan_before, add_line, vspan_after, black
end
if add_line then
table.insert(self.container, LineWidget:new{
background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{
w = self.width,
h = self.sep_width,

@ -41,12 +41,12 @@ function CheckMark:init()
local disabled_checked_widget = TextWidget:new{
text = " ✓", -- preceded by thin space for better alignment
face = self.face,
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
}
local disabled_unchecked_widget = TextWidget:new{
text = "",
face = self.face,
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
}
local empty_widget = TextWidget:new{
text = "",

@ -386,12 +386,12 @@ function ConfigOption:init()
FixedTextWidget:new{
text = self.options[c].item_text[d],
face = Font:getFace(item_font_face, item_font_size[d]),
fgcolor = Blitbuffer.gray(enabled and 1.0 or 0.5),
fgcolor = enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
},
underline_padding = padding_button,
padding_left = d > 1 and horizontal_half_padding,
padding_right = d < #self.options[c].item_text and horizontal_half_padding,
color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE,
color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE,
enabled = enabled,
}
else
@ -405,12 +405,12 @@ function ConfigOption:init()
TextWidget:new{
text = text,
face = face,
fgcolor = Blitbuffer.gray(enabled and 1.0 or 0.5),
fgcolor = enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
},
underline_padding = -padding_button,
padding_left = d > 1 and horizontal_half_padding,
padding_right = d < #self.options[c].item_text and horizontal_half_padding,
color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE,
color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE,
enabled = enabled,
}
end
@ -448,7 +448,7 @@ function ConfigOption:init()
underline_padding = -padding_button,
padding_left = d > 1 and horizontal_half_padding,
padding_right = d < #self.options[c].item_icons and horizontal_half_padding,
color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE,
color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE,
enabled = enabled,
}
option_items[d] = option_item

@ -299,7 +299,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
if self.powerd.auto_warmth then
enable_button_plus = false
enable_button_minus = false
button_color = Blitbuffer.COLOR_GREY
button_color = Blitbuffer.COLOR_DARK_GRAY
else
if math.floor(num_warmth / self.nl_scale) <= self.nl_min then enable_button_minus = false end
if math.ceil(num_warmth / self.nl_scale) >= self.nl_max then enable_button_plus = false end
@ -413,7 +413,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
face = self.larger_font_face,
alignment = "right",
fgcolor = self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
Blitbuffer.COLOR_GREY,
Blitbuffer.COLOR_DARK_GRAY,
width = self.screen_width * 0.3
}
local text_hour = TextBoxWidget:new{
@ -422,7 +422,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
face = self.larger_font_face,
alignment = "center",
fgcolor =self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
Blitbuffer.COLOR_GREY,
Blitbuffer.COLOR_DARK_GRAY,
width = self.screen_width * 0.15
}
local button_minus_one_hour = Button:new{

@ -348,7 +348,7 @@ function ImageViewer:update()
file = self.file,
image = self.image,
image_disposable = false, -- we may re-use self.image
alpha = true,
alpha = true, -- we might be showing images with an alpha channel (f.g., from Wikipedia)
width = max_image_w,
height = max_image_h,
rotation_angle = rotation_angle,

@ -20,6 +20,7 @@ Show image from memory example:
]]
local Blitbuffer = require("ffi/blitbuffer")
local Cache = require("cache")
local CacheItem = require("cacheitem")
local Geom = require("ui/geometry")
@ -355,7 +356,13 @@ function ImageWidget:paintTo(bb, x, y)
}
logger.dbg("blitFrom", x, y, self._offset_x, self._offset_y, size.w, size.h)
if self.alpha == true then
bb:alphablitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h)
-- Only actually try to alpha-blend if the image really has an alpha channel...
local bbtype = self._bb:getType()
if bbtype == Blitbuffer.TYPE_BB8A or bbtype == Blitbuffer.TYPE_BBRGB32 then
bb:alphablitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h)
else
bb:blitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h)
end
else
bb:blitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h)
end

@ -96,7 +96,6 @@ function InfoMessage:init()
image_widget = ImageWidget:new{
file = self.icon_file or "resources/info-i.png",
scale_for_dpi = true,
alpha = true,
}
end
else

@ -237,7 +237,7 @@ function InputText:initTextBox(text, char_added)
if show_text == "" or show_text == nil then
-- no preset value, use hint text if set
show_text = self.hint
fgcolor = Blitbuffer.COLOR_GREY
fgcolor = Blitbuffer.COLOR_DARK_GRAY
self.charlist = {}
self.charpos = 1
else
@ -346,7 +346,7 @@ function InputText:initTextBox(text, char_added)
bordersize = self.bordersize,
padding = self.padding,
margin = self.margin,
color = self.focused and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
color = self.focused and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
self.text_widget,
}
self._verticalgroup = VerticalGroup:new{
@ -387,7 +387,7 @@ end
function InputText:unfocus()
self.focused = false
self.text_widget:unfocus()
self._frame_textwidget.color = Blitbuffer.COLOR_GREY
self._frame_textwidget.color = Blitbuffer.COLOR_DARK_GRAY
end
function InputText:focus()

@ -80,7 +80,7 @@ function KeyValueTitle:init()
dimen = { w = self.width, h = Size.line.thick },
LineWidget:new{
dimen = Geom:new{ w = self.width, h = Size.line.thick },
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
style = "solid",
},
}
@ -94,7 +94,7 @@ function KeyValueTitle:init()
overlap_offset = {0, -15},
TextWidget:new{
text = "", -- page count
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
face = Font:getFace("smallffont"),
},
}
@ -486,7 +486,7 @@ function KeyValuePage:_populateItems()
table.insert(self.main_content,
VerticalSpan:new{ width = self.item_margin })
table.insert(self.main_content, LineWidget:new{
background = Blitbuffer.COLOR_LIGHT_GREY,
background = Blitbuffer.COLOR_LIGHT_GRAY,
dimen = Geom:new{
w = self.item_width,
h = Size.line.thick

@ -9,7 +9,7 @@ local Screen = Device.screen
local LinkBox = InputContainer:new{
box = nil,
color = Blitbuffer.COLOR_GREY,
color = Blitbuffer.COLOR_DARK_GRAY,
radius = 0,
bordersize = Size.line.medium,
}

@ -22,7 +22,7 @@ Example:
},
FrameContainer:new{
bordersize = 0,
background = Blitbuffer.COLOR_LIGHT_GREY,
background = Blitbuffer.COLOR_LIGHT_GRAY,
TextWidget:new{
text = "bar",
fact = Font:getFace("cfont"),

@ -53,7 +53,7 @@ function ItemShortCutIcon:init()
if self.style == "rounded_corner" then
radius = math.floor(self.width/2)
elseif self.style == "grey_square" then
background = Blitbuffer.gray(0.2)
background = Blitbuffer.COLOR_LIGHT_GRAY
end
--@TODO calculate font size by icon size 01.05 2012 (houqp)
@ -210,13 +210,13 @@ function MenuItem:init()
text = self.text,
face = self.face,
bold = self.bold,
fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil,
}
mandatory_widget = TextWidget:new{
text = mandatory,
face = self.info_face,
bold = self.bold,
fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil,
}
else
while true do
@ -228,7 +228,7 @@ function MenuItem:init()
text = mandatory,
face = Font:getFace(self.infont, self.infont_size),
bold = self.bold,
fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil,
}
local height = mandatory_widget:getSize().h
@ -259,7 +259,7 @@ function MenuItem:init()
width = self.content_width - mandatory_w - state_button_width - text_mandatory_padding,
alignment = "left",
bold = self.bold,
fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil,
}
local height = item_name:getSize().h
if height < max_item_height or flag_fit then -- we fit !
@ -496,7 +496,7 @@ local Menu = FocusManager:new{
close_callback = nil,
linesize = Size.line.medium,
perpage = G_reader_settings:readSetting("items_per_page") or 14,
line_color = Blitbuffer.COLOR_GREY,
line_color = Blitbuffer.COLOR_DARK_GRAY,
}
function Menu:_recalculateDimen()

@ -83,11 +83,11 @@ function MinimalPaginator:paintTo(bb, x, y)
-- paint background
bb:paintRoundedRect(x, y,
self.dimen.w, self.dimen.h,
Blitbuffer.COLOR_LIGHT_GREY)
Blitbuffer.COLOR_LIGHT_GRAY)
-- paint percentage infill
bb:paintRect(x, y,
math.ceil(self.dimen.w*self.progress), self.dimen.h,
Blitbuffer.COLOR_GREY)
Blitbuffer.COLOR_DARK_GRAY)
end
function MinimalPaginator:setProgress(progress) self.progress = progress end
@ -380,7 +380,7 @@ function NetworkSetting:init()
self.width = self.width or Screen:getWidth() - Screen:scaleBySize(50)
self.width = math.min(self.width, Screen:scaleBySize(600))
local gray_bg = Blitbuffer.gray(0.1)
local gray_bg = Blitbuffer.COLOR_GRAY_E
local items = {}
table.sort(self.network_list,
function(l, r) return l.signal_quality > r.signal_quality end)

@ -113,7 +113,7 @@ function OpenWithDialog:init()
h = Size.span.vertical_large*2,
},
LineWidget:new{
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{
w = self.width * 0.9,
h = Size.line.medium,

@ -52,7 +52,7 @@ function PhysicalNumericKey:init()
VerticalGroup:new{
label_widget,
TextWidget:new{
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
text = self.physical_key_label,
face = self.pkey_face,
},

@ -41,7 +41,7 @@ local ProgressWidget = Widget:new{
bordersize = Screen:scaleBySize(1),
bordercolor = Blitbuffer.COLOR_BLACK,
bgcolor = Blitbuffer.COLOR_WHITE,
rectcolor = Blitbuffer.gray(0.7),
rectcolor = Blitbuffer.COLOR_DIM_GRAY,
percentage = nil,
ticks = nil,
tick_width = Screen:scaleBySize(3),

@ -88,7 +88,7 @@ function RadioButtonTable:init()
local button_dim = button:getSize()
local vertical_sep = LineWidget:new{
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{
w = self.sep_width,
h = button_dim.h,
@ -129,7 +129,7 @@ function RadioButtonTable:addHorizontalSep(vspan_before, add_line, vspan_after,
end
if add_line then
table.insert(self.container, LineWidget:new{
background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{
w = self.width,
h = self.sep_width,

@ -361,20 +361,7 @@ function TextBoxWidget:_renderText(start_row_idx, end_row_idx)
if self._bb then self._bb:free() end
local bbtype = nil
if self.line_num_to_image and self.line_num_to_image[start_row_idx] then
-- Whether Screen:isColorEnabled or not, it's best to
-- always use BBRGB32 and alphablitFrom() for the best display of
-- various images:
-- With greyscale screen TYPE_BB8 (the default, and
-- what we would have chosen when not Screen:isColorEnabled):
-- alphablitFrom: some images are all white (ex: flags on Milan,
-- Ilkhanides on wiki.fr)
-- blitFrom: some images have a black background (ex: RDA,
-- Allemagne on wiki.fr)
-- With TYPE_BBRGB32:
-- blitFrom: some images have a black background (ex: RDA,
-- Allemagne on wiki.fr)
-- alphablitFrom: all these images looks good, with a white background
bbtype = Blitbuffer.TYPE_BBRGB32
bbtype = Screen:isColorEnabled() and Blitbuffer.TYPE_BBRGB32 or Blitbuffer.TYPE_BB8
end
self._bb = Blitbuffer.new(self.width, h, bbtype)
self._bb:fill(Blitbuffer.COLOR_WHITE)
@ -441,14 +428,20 @@ function TextBoxWidget:_renderImage(start_row_idx)
-- logger.dbg("display_bb:", display_bb, "display_alt", display_alt, "status_text:", status_text, "do_schedule_update:", do_schedule_update)
-- Do what's been decided
if display_bb then
self._bb:alphablitFrom(image.bb, self.width - image.width, 0)
-- With alpha-blending if the image contains an alpha channel
local bbtype = image.bb:getType()
if bbtype == Blitbuffer.TYPE_BB8A or bbtype == Blitbuffer.TYPE_BBRGB32 then
self._bb:alphablitFrom(image.bb, self.width - image.width, 0)
else
self._bb:blitFrom(image.bb, self.width - image.width, 0)
end
end
local status_height = 0
if status_text then
local status_widget = TextWidget:new{
text = status_text,
face = Font:getFace("cfont", 20),
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
bold = true,
}
status_height = status_widget:getSize().h

@ -7,7 +7,7 @@ Example:
text = "Make it so.",
face = Font:getFace("cfont"),
bold = true,
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
})
--]]

@ -36,7 +36,7 @@ local ToggleSwitch = InputContainer:new{
width = Screen:scaleBySize(216),
height = Size.item.height_default,
bgcolor = Blitbuffer.COLOR_WHITE, -- unfocused item color
fgcolor = Blitbuffer.COLOR_GREY, -- focused item color
fgcolor = Blitbuffer.COLOR_DARK_GRAY, -- focused item color
font_face = "cfont",
font_size = 16,
enabled = true,
@ -50,7 +50,7 @@ function ToggleSwitch:init()
self.toggle_frame = FrameContainer:new{
background = Blitbuffer.COLOR_WHITE,
color = Blitbuffer.COLOR_GREY,
color = Blitbuffer.COLOR_DARK_GRAY,
radius = Size.radius.window,
bordersize = Size.border.thin,
padding = Size.padding.small,
@ -90,7 +90,7 @@ function ToggleSwitch:init()
}
local button = FrameContainer:new{
background = Blitbuffer.COLOR_WHITE,
color = Blitbuffer.COLOR_GREY,
color = Blitbuffer.COLOR_DARK_GRAY,
margin = 0,
radius = Size.radius.window,
bordersize = item_border_size,

@ -102,7 +102,7 @@ function TouchMenuItem:init()
},
TextWidget:new{
text = text,
fgcolor = item_enabled ~= false and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
fgcolor = item_enabled ~= false and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
face = self.face,
},
},
@ -510,7 +510,7 @@ function TouchMenu:init()
-- pad with 10 pixel to align with the up arrow in footer
HorizontalSpan:new{width = Size.span.horizontal_default},
LineWidget:new{
background = Blitbuffer.gray(0.33),
background = Blitbuffer.COLOR_GRAY,
dimen = Geom:new{
w = self.item_width - 2*Size.span.horizontal_default,
h = Size.line.medium,

@ -62,7 +62,7 @@ function ItemShortCutIcon:init()
if self.style == "rounded_corner" then
radius = math.floor(self.width/2)
elseif self.style == "grey_square" then
background = Blitbuffer.gray(0.2)
background = Blitbuffer.COLOR_LIGHT_GRAY
end
local sc_face
if self.key:len() > 1 then
@ -390,12 +390,12 @@ function ListMenuItem:update()
local wfileinfo = TextWidget:new{
text = fileinfo_str,
face = Font:getFace("cfont", 14),
fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
}
local wpageinfo = TextWidget:new{
text = pages_str,
face = Font:getFace("cfont", 14),
fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
}
local wright_width = math.max(wfileinfo:getSize().w, wpageinfo:getSize().w)
@ -511,7 +511,7 @@ function ListMenuItem:update()
width = wmain_width,
alignment = "left",
bold = true,
fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
}
local height = wtitle:getSize().h
if authors then
@ -520,7 +520,7 @@ function ListMenuItem:update()
face = Font:getFace(fontname_authors, fontsize_authors),
width = wmain_width,
alignment = "left",
fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
}
height = height + wauthors:getSize().h
end
@ -614,7 +614,7 @@ function ListMenuItem:update()
face = Font:getFace("cfont", 18),
width = dimen.w - 2 * Screen:scaleBySize(10),
alignment = "left",
fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
}
},
}
@ -790,7 +790,7 @@ function ListMenu:_updateItemsBuildUI()
-- Build our list
table.insert(self.item_group, LineWidget:new{
dimen = Geom:new{ w = self.width, h = Size.line.thin },
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
style = "solid",
})
local idx_offset = (self.page - 1) * self.perpage
@ -828,7 +828,7 @@ function ListMenu:_updateItemsBuildUI()
table.insert(self.item_group, item_tmp)
table.insert(self.item_group, LineWidget:new{
dimen = Geom:new{ w = self.width, h = Size.line.thin },
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
style = "solid",
})

@ -60,7 +60,7 @@ function ItemShortCutIcon:init()
if self.style == "rounded_corner" then
radius = math.floor(self.width/2)
elseif self.style == "grey_square" then
background = Blitbuffer.gray(0.2)
background = Blitbuffer.COLOR_LIGHT_GRAY
end
local sc_face
if self.key:len() > 1 then
@ -261,7 +261,7 @@ function FakeCover:init()
if self.file_deleted then
self.dim = true
self.color = Blitbuffer.COLOR_GREY
self.color = Blitbuffer.COLOR_DARK_GRAY
end
-- As we are a FrameContainer, a border will be painted around self[1]
@ -494,7 +494,7 @@ function MosaicMenuItem:update()
padding = 0,
bordersize = border_size,
dim = self.file_deleted,
color = self.file_deleted and Blitbuffer.COLOR_GREY or nil,
color = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil,
image,
}
}

@ -62,7 +62,7 @@ function DoubleKeyValueTitle:init()
dimen = { w = self.width, h = Screen:scaleBySize(2) },
LineWidget:new{
dimen = Geom:new{ w = self.width, h = Screen:scaleBySize(2) },
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
style = "solid",
},
}
@ -76,7 +76,7 @@ function DoubleKeyValueTitle:init()
overlap_offset = {0, -15},
TextWidget:new{
text = "", -- page count
fgcolor = Blitbuffer.COLOR_GREY,
fgcolor = Blitbuffer.COLOR_DARK_GRAY,
face = Font:getFace("smallffont"),
},
}
@ -383,7 +383,7 @@ function DoubleKeyValuePage:_populateItems()
local c = string.sub(entry, 1, 1)
if c == "-" then
table.insert(self.main_content, LineWidget:new{
background = Blitbuffer.COLOR_LIGHT_GREY,
background = Blitbuffer.COLOR_LIGHT_GRAY,
dimen = Geom:new{
w = self.item_width,
h = Screen:scaleBySize(2)

@ -65,14 +65,14 @@ function GoodreadsBook:genHeader(title)
local header_title = TextWidget:new{
text = title,
face = self.medium_font_face,
fgcolor = Blitbuffer.gray(0.4),
fgcolor = Blitbuffer.COLOR_WEB_GRAY,
}
local padding_span = HorizontalSpan:new{ width = self.padding}
local line_width = (self.screen_width - header_title:getSize().w) / 2 - self.padding * 2
local line_container = LeftContainer:new{
dimen = Geom:new{ w = line_width, h = self.screen_height / 25 },
LineWidget:new{
background = Blitbuffer.gray(0.2),
background = Blitbuffer.COLOR_LIGHT_GRAY,
dimen = Geom:new{
w = line_width,
h = Size.line.thick,

@ -22,8 +22,8 @@ local util = require("util")
local _ = require("gettext")
local Screen = Device.screen
local LINE_COLOR = Blitbuffer.gray(0.4)
local BG_COLOR = Blitbuffer.gray(0.2)
local LINE_COLOR = Blitbuffer.COLOR_WEB_GRAY
local BG_COLOR = Blitbuffer.COLOR_LIGHT_GRAY
local ReaderProgress = InputContainer:new{
padding = Size.padding.fullscreen,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -131,7 +131,7 @@ Background = InputContainer:new{
},
-- contains a gray rectangular desktop
FrameContainer:new{
background = Blitbuffer.COLOR_GREY,
background = Blitbuffer.COLOR_DARK_GRAY,
bordersize = 0,
dimen = Screen:getSize(),
Widget:new{

Loading…
Cancel
Save