wlmaker
Loading...
Searching...
No Matches
Functions | Variables
primitives.c File Reference
#include "primitives.h"
#include <libbase/libbase.h>
#include <stddef.h>
Include dependency graph for primitives.c:

Functions

void wlmaker_primitives_cairo_fill (cairo_t *cairo_ptr, const wlmtk_style_fill_t *fill_ptr)
 
void wlmaker_primitives_cairo_fill_at (cairo_t *cairo_ptr, int x, int y, unsigned width, unsigned height, const wlmtk_style_fill_t *fill_ptr)
 
void wlmaker_primitives_set_bezel_color (cairo_t *cairo_ptr, bool illuminated)
 
void wlmaker_primitives_draw_bezel (cairo_t *cairo_ptr, double bezel_width, bool raised)
 
void wlmaker_primitives_draw_bezel_at (cairo_t *cairo_ptr, int x, int y, unsigned width, unsigned height, double bezel_width, bool raised)
 
void wlmaker_primitives_draw_minimize_icon (cairo_t *cairo_ptr, int size, uint32_t color)
 
void wlmaker_primitives_draw_close_icon (cairo_t *cairo_ptr, int size, uint32_t color)
 
void wlmaker_primitives_draw_window_title (cairo_t *cairo_ptr, const wlmtk_style_font_t *font_style_ptr, const char *title_ptr, uint32_t color)
 
void wlmaker_primitives_draw_text (cairo_t *cairo_ptr, int x, int y, const wlmtk_style_font_t *font_style_ptr, uint32_t color, const char *text_ptr)
 
static void test_fill (bs_test_t *test_ptr)
 
static void test_close (bs_test_t *test_ptr)
 
static void test_close_large (bs_test_t *test_ptr)
 
static void test_minimize (bs_test_t *test_ptr)
 
static void test_minimize_large (bs_test_t *test_ptr)
 
static void test_text (bs_test_t *test_ptr)
 
static void test_window_title (bs_test_t *test_ptr)
 

Variables

const bs_test_case_t wlmaker_primitives_test_cases []
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ test_close()

void test_close ( bs_test_t *  test_ptr)
static

Verifies the looks of the "close" icon.

◆ test_close_large()

void test_close_large ( bs_test_t *  test_ptr)
static

Verifies the looks of the "close" icon, with non-default size.

◆ test_fill()

void test_fill ( bs_test_t *  test_ptr)
static

Verifies the fill styles

◆ test_minimize()

void test_minimize ( bs_test_t *  test_ptr)
static

Verifies the looks of the "minimize" icon.

◆ test_minimize_large()

void test_minimize_large ( bs_test_t *  test_ptr)
static

Verifies the looks of the "minimize" icon, widht non-default size.

◆ test_text()

void test_text ( bs_test_t *  test_ptr)
static

Verifies drawing a text.

◆ test_window_title()

void test_window_title ( bs_test_t *  test_ptr)
static

Verifies the looks of the window title.

◆ wlmaker_primitives_cairo_fill()

void wlmaker_primitives_cairo_fill ( cairo_t *  cairo_ptr,
const wlmtk_style_fill_t fill_ptr 
)

Completely fills the cairo with the specified style.

Parameters
cairo_ptrA cairo, backed by an image surface.
fill_ptr

◆ wlmaker_primitives_cairo_fill_at()

void wlmaker_primitives_cairo_fill_at ( cairo_t *  cairo_ptr,
int  x,
int  y,
unsigned  width,
unsigned  height,
const wlmtk_style_fill_t fill_ptr 
)

Fills the cairo with the specified style at the specified rectangle.

Parameters
cairo_ptrA cairo, backed by an image surface.
x
y
width
height
fill_ptr

◆ wlmaker_primitives_draw_bezel()

void wlmaker_primitives_draw_bezel ( cairo_t *  cairo_ptr,
double  bezel_width,
bool  raised 
)

Draws a bezel into the cairo.

Parameters
cairo_ptrA cairo, backed by an image surface.
bezel_width
raisedWhether the bezel is to highlight a raised (true) or pressed (false) state.

◆ wlmaker_primitives_draw_bezel_at()

void wlmaker_primitives_draw_bezel_at ( cairo_t *  cairo_ptr,
int  x,
int  y,
unsigned  width,
unsigned  height,
double  bezel_width,
bool  raised 
)

Draws a bezel into the cairo, at specified position and width/height.

Parameters
cairo_ptrA cairo, backed by an image surface.
x
y
width
height
bezel_width
raisedWhether the bezel is to highlight a raised (true) or pressed (false) state.

◆ wlmaker_primitives_draw_close_icon()

void wlmaker_primitives_draw_close_icon ( cairo_t *  cairo_ptr,
int  size,
uint32_t  color 
)

Draws the "close" icon, as used in the title bar.

Parameters
cairo_ptr
size
color

◆ wlmaker_primitives_draw_minimize_icon()

void wlmaker_primitives_draw_minimize_icon ( cairo_t *  cairo_ptr,
int  size,
uint32_t  color 
)

Draws the "minimize" icon, as used in the title bar.

Parameters
cairo_ptr
size
color

◆ wlmaker_primitives_draw_text()

void wlmaker_primitives_draw_text ( cairo_t *  cairo_ptr,
int  x,
int  y,
const wlmtk_style_font_t font_style_ptr,
uint32_t  color,
const char *  text_ptr 
)

Draws the text with given parameters into the cairo_t at (x, y).

Parameters
cairo_ptr
x
y
font_style_ptr
color
text_ptr

◆ wlmaker_primitives_draw_window_title()

void wlmaker_primitives_draw_window_title ( cairo_t *  cairo_ptr,
const wlmtk_style_font_t font_style_ptr,
const char *  title_ptr,
uint32_t  color 
)

Draws the window title into the cairo_t.

Parameters
cairo_ptr
font_style_ptrThe font style to use.
title_ptrTitle string, or NULL.
colorAs an ARGB 8888 value.

◆ wlmaker_primitives_set_bezel_color()

void wlmaker_primitives_set_bezel_color ( cairo_t *  cairo_ptr,
bool  illuminated 
)

Sets the bezel color.

Note: Window Maker draws the bezel by adding 80 (0x50) to each R, G, B of the underlying title for the illuminated side; respectively by subtracting 40 (0x28) on the non-illuminated side. We are using cairo's overlaying with the respective "alpha" values below, which leads to different results.

Parameters
cairo_ptr
illuminated

Variable Documentation

◆ wlmaker_primitives_test_cases

const bs_test_case_t wlmaker_primitives_test_cases[]
Initial value:
= {
{ 1, "fill", test_fill },
{ 1, "close", test_close },
{ 1, "close_large", test_close_large },
{ 1, "minimize", test_minimize },
{ 1, "minimize_large", test_minimize_large },
{ 0, "text", test_text },
{ 0, "window_title", test_window_title },
{ 0, NULL, NULL }
}
static void test_fill(bs_test_t *test_ptr)
Definition primitives.c:299
static void test_minimize_large(bs_test_t *test_ptr)
Definition primitives.c:400
static void test_minimize(bs_test_t *test_ptr)
Definition primitives.c:385
static void test_text(bs_test_t *test_ptr)
Definition primitives.c:415
static void test_close(bs_test_t *test_ptr)
Definition primitives.c:355
static void test_window_title(bs_test_t *test_ptr)
Definition primitives.c:437
static void test_close_large(bs_test_t *test_ptr)
Definition primitives.c:370

Unit tests.