Commit graph

195 commits

Author SHA1 Message Date
thankyouverycool 208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00
LepkoQQ bb5014fad7 LibGfx: Use valid hsv values in painter debug 2020-08-26 00:38:23 +02:00
LepkoQQ 7a46e0fa35 LibGfx: Always use 0..360 0..1 0..1 in HSV colors 2020-08-26 00:38:23 +02:00
asynts 10c6f062b3 AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00
Andreas Kling 03c576acc5 LibGUI+LibGfx: Implement upside-down appearance for bottom-side tabs
GUI::TabWidget has long has a TabPosition::Bottom option, but we still
rendered the tab buttons the same as TabPosition::Top.

This patch implements a custom look for bottom-side tabs. I've done my
best to match the look of the top-side ones, but there might be some
improvements we can make here. :^)
2020-08-23 23:53:45 +02:00
Andreas Kling 85e818206c LibGfx+WindowServer: Simplify notification window frame theming
Don't require theme clients to provide the frame rect, the theme can
compute that internally based on the window rect.
2020-08-23 13:17:34 +02:00
Peter Elliott 28db3cd5ef LibGfx: Add TextAlignment::BottomRight 2020-08-23 01:05:22 +02:00
Andreas Kling 50076997f4 LibGfx: Use an enumerator macro for color roles 2020-08-21 21:16:13 +02:00
Andreas Kling 80a9896e83 LibGfx+WindowServer: Simplify WindowTheme::paint_normal_frame() API
Don't require passing in the outer frame rect since the theme can
compute that itself, based on the window rect.
2020-08-21 21:16:13 +02:00
Andreas Kling 7903cfa5e4 LibGfx: Support loading GIF local color maps if present :^) 2020-08-20 19:42:06 +02:00
Andreas Kling 28e34ffe38 LibGfx: Initialize some uninitialized things in GIFLoader 2020-08-20 19:41:29 +02:00
Tom 5cd2a37079 LibGfx: Small improvement for DisjointRectSet::shatter
This avoids a call to clone() which would be discarded immediately.
Also, avoid essentially cloning for each hammer rectangle unless
there is actually a need for it.
2020-08-19 11:20:27 +02:00
Tom f8903acea2 LibGfx: Add convenience helpers for Rect 2020-08-18 12:12:27 +02:00
Tom a43ba348e1 LibGfx: Add convenience method Point::constrained 2020-08-18 12:12:27 +02:00
Tom 790eacfbd1 LibGfx: Add a few convenience methods to DisjointRectSet 2020-08-18 12:12:27 +02:00
Sarah ee912e023c LibGfx: Move original StylePainter code to ClassicStylePainter
StylePainter should continue to work the same as before.
2020-08-17 00:00:34 +02:00
Sarah d0900228d0 LibGfx: Add abstract StylePainter class
StylePainter's behavior is now handled by a static instance
of BaseStylePainter. The original static behavior of StylePainter
is left as-is for API compatibility.
2020-08-17 00:00:34 +02:00
thankyouverycool 126a03f087 LibGfx: Add initial font family matching
Fonts following the TypefaceWeightSize naming scheme now associate
with bold weights of the same name and glyph size on construction.
2020-08-16 19:39:46 +02:00
Nico Weber 430b265cd4 AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".

Let's use the correct name, at least in code.

Only changes the name of the constants, no other behavior change.
2020-08-16 16:33:28 +02:00
Peter Nelson c8f8f4e6c3 LibGfx: use disposal method of previous frame in GIF transparency
The disposal method on a GIF animation frame now correctly applies to
rendering of the next frame.
2020-08-13 15:49:41 +02:00
Peter Nelson daa762bb06 LibGfx: correctly handle transparency between GIF frames
This fixes an issue where transparent pixels in GIF animation frames
have their alpha values incorrectly set to zero, allowing the
background behind the GIF to show through, instead of the previous
animation frame.

Additionally, transparent pixels are now correctly identified based on
their index matching the image transparency index, instead of their
color values.
2020-08-13 15:49:41 +02:00
Ben Wiederhake f2f0c22052 LibGfx: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Linus Groh 7072806234 Meta: Replace remaining LibM/math.h includes with math.h 2020-08-12 16:18:33 +02:00
Andreas Kling ae0ff13f66 LibGfx: Correct copyright years for {Classic,}WindowTheme.{cpp,h} 2020-08-10 21:20:28 +02:00
Andreas Kling de1a54c378 WindowServer+LibGfx: Move window frame rect calculation to WindowTheme 2020-08-10 13:03:44 +02:00
Sarah 9714e61d62 ClassicWindowTheme: Fix titlebar redraw issues
This fixes titlebar rects being overly large and leaving smeary
undrawn areas when using a theme with a titlebar height
different to 19px.
2020-08-10 11:48:47 +02:00
Andreas Kling c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Andreas Kling a94be95e27 LibGfx: Add a basic abstract WindowTheme class
This class will provide painting and metrics for window themes. :^)
2020-08-09 19:28:36 +02:00
Andreas Kling 0bbced444b LibGfx: Add dummy Font::x_height() getter
Right now we just guess that the x-height is glyph_height/2, which is
obviously not accurate. We currently don't store the x-height in fonts,
so that's something we'll need to fix.
2020-08-07 20:29:32 +02:00
asynts b3d1a05261 Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)
This function did a const_cast internally which made the call side look
"safe". This method is removed completely and call sites are replaced
with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the
behaviour obvious.
2020-08-06 10:33:16 +02:00
Nico Weber ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber 19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling 00fe4c7bcb LibGfx: Make draw_scaled_bitmap() apply relative opacity
Instead of overriding the alpha value of all source pixels, apply the
override opacity by multiplying with the source alpha.

Fixes #3004.
2020-08-05 14:43:36 +02:00
Andreas Kling 984683cf34 Revert "LibM: Always include <math.h> instead of <LibM/math.h>"
This reverts commit dc12cbca41.

Sadly this broke the build due to some confusion about <new>.
Reverting until this can be solved fully.
2020-08-04 21:17:43 +02:00
Andreas Kling dc12cbca41 LibM: Always include <math.h> instead of <LibM/math.h>
This makes Lagom pick up the host math.h, which is what we want.
2020-08-04 19:06:27 +02:00
Andreas Kling ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Nico Weber 6dd10ad8dc Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable,
but it used the same stripe and shadow color for all window modes.
This is fine for the new 'basalt' theme which uses the same color
in all four window modes, but it changed the default theme so that
background windows had brown stripes and a brown shadow.

Instead, make the title stripe and title shadow themable per window mode,
and change the default theme to restore the colors it had before
change #2811: The title stripe color is the same as Border1 for all
window modes, and the title shadow is the same as the title stripe
darkened by 0.6.
2020-08-01 19:26:54 +02:00
thankyouverycool 41aacdf815 LibGfx: Add Paths to themes
Paths allows themes to specify directories/files where custom
resources are located.
2020-08-01 07:56:48 +02:00
Andreas Kling 7bb6b1d44d LibGfx: Fix dumb typo in PNG decoder
'=' is not the same as '*', indeed.
2020-07-27 19:10:18 +02:00
Andreas Kling 0b1a40a6fe LibGfx: Simplify some excessive use of pow() in scanline unfiltering 2020-07-27 16:40:12 +02:00
Matthew Olsson 335916d8db LibGfx: Templatize Point, Size, and Rect 2020-07-27 01:06:26 +02:00
Matthew Olsson 943e4f8bf1 LibWeb: Abstract common operations of graphical SVG elements 2020-07-26 14:53:43 +02:00
Matthew Olsson 9cce7f57dd LibGfx: Add FloatPoint methods
Adds some conversion constructors, as well as the missing arithmetic
operations.
2020-07-26 14:53:43 +02:00
Matthew Olsson 1cffde7635 LibGfx: Add elliptical curves to Path 2020-07-26 14:53:43 +02:00
Matthew Olsson 22f0953fe2 LibWeb: Begin SVG element support
This commit starts adding a basic SVG element. Currently, svg elements
have support for the width and height properties, as well as the stroke,
stroke-width, and fill properties. The only child element supported
is the path element, as most other graphical elements are just shorthand
for paths.
2020-07-26 14:53:43 +02:00
AnotherTest 9d349ac646 LibGfx: Add a generic Matrix variant 2020-07-25 02:13:43 +02:00
AnotherTest 2d96437bbb LibGfx: Add Matrix4x4::elements() getters 2020-07-25 02:13:43 +02:00
Nico Weber 3f45e9ab1e Lagom: Add LibGemini, LibGfx
They are dependencies of LibWeb and might be useful for
running test-web on GitHub actions one day.
2020-07-23 23:02:28 +02:00
Andreas Kling d7be3faab5 LibGfx: Add an "opacity" argument to Painter::draw_scaled_bitmap()
This API is not super perfect as it merely overrides the source alpha
on all source pixels instead of blending the alpha values. There is
room for improvement here for sure.
2020-07-23 20:32:39 +02:00