mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
more wedges
This commit is contained in:
@ -67,40 +67,17 @@ pub fn main() !void {
|
|||||||
|
|
||||||
{
|
{
|
||||||
try stdout.print("\x1b[4mWedge Triangles\x1b[0m\n", .{});
|
try stdout.print("\x1b[4mWedge Triangles\x1b[0m\n", .{});
|
||||||
{
|
var i: usize = 0x1FB3C;
|
||||||
var i: usize = 0x1FB3C;
|
var step: usize = 32;
|
||||||
const end = 0x1FB40;
|
const end = 0x1FB6B;
|
||||||
while (i <= end) : (i += 1) {
|
while (i <= end) : (i += step) {
|
||||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
var j: usize = 0;
|
||||||
}
|
while (j < step) : (j += 1) {
|
||||||
}
|
const v = i + j;
|
||||||
{
|
if (v <= end) try stdout.print("{u} ", .{@intCast(u21, v)});
|
||||||
var i: usize = 0x1FB47;
|
|
||||||
const end = 0x1FB4B;
|
|
||||||
while (i <= end) : (i += 1) {
|
|
||||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var i: usize = 0x1FB57;
|
|
||||||
const end = 0x1FB5B;
|
|
||||||
while (i <= end) : (i += 1) {
|
|
||||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var i: usize = 0x1FB62;
|
|
||||||
const end = 0x1FB66;
|
|
||||||
while (i <= end) : (i += 1) {
|
|
||||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var i: usize = 0x1FB6C;
|
|
||||||
const end = 0x1FB6F;
|
|
||||||
while (i <= end) : (i += 1) {
|
|
||||||
try stdout.print("{u} ", .{@intCast(u21, i)});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try stdout.print("\n\n", .{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,36 @@ pub const Image = opaque {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn composite(
|
||||||
|
self: *Image,
|
||||||
|
op: pixman.Op,
|
||||||
|
src: *Image,
|
||||||
|
mask: ?*Image,
|
||||||
|
src_x: i16,
|
||||||
|
src_y: i16,
|
||||||
|
mask_x: i16,
|
||||||
|
mask_y: i16,
|
||||||
|
dest_x: i16,
|
||||||
|
dest_y: i16,
|
||||||
|
width: u16,
|
||||||
|
height: u16,
|
||||||
|
) void {
|
||||||
|
c.pixman_image_composite(
|
||||||
|
@enumToInt(op),
|
||||||
|
@ptrCast(*c.pixman_image_t, src),
|
||||||
|
@ptrCast(?*c.pixman_image_t, mask),
|
||||||
|
@ptrCast(*c.pixman_image_t, self),
|
||||||
|
src_x,
|
||||||
|
src_y,
|
||||||
|
mask_x,
|
||||||
|
mask_y,
|
||||||
|
dest_x,
|
||||||
|
dest_y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn compositeTriangles(
|
pub fn compositeTriangles(
|
||||||
self: *Image,
|
self: *Image,
|
||||||
op: pixman.Op,
|
op: pixman.Op,
|
||||||
|
@ -302,13 +302,20 @@ fn draw(self: BoxFont, alloc: Allocator, img: *pixman.Image, cp: u32) !void {
|
|||||||
|
|
||||||
0x1FB00...0x1FB3B => self.draw_sextant(img, cp),
|
0x1FB00...0x1FB3B => self.draw_sextant(img, cp),
|
||||||
|
|
||||||
0x1fb3c...0x1fb40,
|
0x1FB3C...0x1FB40,
|
||||||
0x1fb47...0x1fb4b,
|
0x1FB47...0x1FB4B,
|
||||||
0x1fb57...0x1fb5b,
|
0x1FB57...0x1FB5B,
|
||||||
0x1fb62...0x1fb66,
|
0x1FB62...0x1FB66,
|
||||||
0x1fb6c...0x1fb6f,
|
0x1FB6C...0x1FB6F,
|
||||||
=> try self.draw_wedge_triangle(img, cp),
|
=> try self.draw_wedge_triangle(img, cp),
|
||||||
|
|
||||||
|
0x1FB41...0x1FB45,
|
||||||
|
0x1FB4C...0x1FB50,
|
||||||
|
0x1FB52...0x1FB56,
|
||||||
|
0x1FB5D...0x1FB61,
|
||||||
|
0x1FB68...0x1FB6B,
|
||||||
|
=> try self.draw_wedge_triangle_inverted(img, cp),
|
||||||
|
|
||||||
else => return error.InvalidCodepoint,
|
else => return error.InvalidCodepoint,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2051,6 +2058,26 @@ fn draw_wedge_triangle(self: BoxFont, img: *pixman.Image, cp: u32) !void {
|
|||||||
img.compositeTriangles(.over, src, .a8, 0, 0, 0, 0, tris);
|
img.compositeTriangles(.over, src, .a8, 0, 0, 0, 0, tris);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn draw_wedge_triangle_inverted(self: BoxFont, img: *pixman.Image, cp: u32) !void {
|
||||||
|
try self.draw_wedge_triangle(img, cp);
|
||||||
|
|
||||||
|
const src = try pixman.Image.createSolidFill(white);
|
||||||
|
defer _ = src.unref();
|
||||||
|
img.composite(
|
||||||
|
.out,
|
||||||
|
src,
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
@intCast(u16, self.width),
|
||||||
|
@intCast(u16, self.height),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn draw_light_arc(
|
fn draw_light_arc(
|
||||||
self: BoxFont,
|
self: BoxFont,
|
||||||
alloc: Allocator,
|
alloc: Allocator,
|
||||||
|
@ -194,6 +194,7 @@ pub fn indexForCodepoint(
|
|||||||
|
|
||||||
// "Symbols for Legacy Computing" block
|
// "Symbols for Legacy Computing" block
|
||||||
0x1FB00...0x1FB3B => true,
|
0x1FB00...0x1FB3B => true,
|
||||||
|
|
||||||
0x1FB3C...0x1FB40,
|
0x1FB3C...0x1FB40,
|
||||||
0x1FB47...0x1FB4B,
|
0x1FB47...0x1FB4B,
|
||||||
0x1FB57...0x1FB5B,
|
0x1FB57...0x1FB5B,
|
||||||
@ -201,6 +202,13 @@ pub fn indexForCodepoint(
|
|||||||
0x1FB6C...0x1FB6F,
|
0x1FB6C...0x1FB6F,
|
||||||
=> true,
|
=> true,
|
||||||
|
|
||||||
|
0x1FB41...0x1FB45,
|
||||||
|
0x1FB4C...0x1FB50,
|
||||||
|
0x1FB52...0x1FB56,
|
||||||
|
0x1FB5D...0x1FB61,
|
||||||
|
0x1FB68...0x1FB6B,
|
||||||
|
=> true,
|
||||||
|
|
||||||
else => false,
|
else => false,
|
||||||
}) {
|
}) {
|
||||||
return FontIndex.initSpecial(.box);
|
return FontIndex.initSpecial(.box);
|
||||||
|
Reference in New Issue
Block a user