* feat(server,ui): 悬浮工具栏图片模式与装饰图叠加候选词 在 #1046 的基础上按最新 develop 重做。 悬浮工具栏 [toolbar] mode = "image":一整张背景图,按钮按 [toolbar.buttons.<按钮>] 的 x_dip / y_dip / width_dip / height_dip 摆放, 可按状态换图([images]),没图时画矢量图标。窗口按背景图的透明区域裁成 异形,透明处点得穿;图上除按钮外都能拖动。v2 皮肤的动图会播放,工具栏 隐藏或淡出后停帧。 候选窗装饰图可用 candidate_overlay_* 叠加一个候选词,太宽时缩字号; 设置页的皮肤预览一并显示。 ui 新增 OverlayPanel(绝对定位)与 ImageMask(按 alpha 生成区域)。 * fix(ui): 动图工具栏的窗口形状取所有帧的并集 窗口区域连画面一起裁,只按首帧裁形状时,动画里伸出首帧轮廓的部分 (抬头、飞出的纸)会被裁掉。改为把所有帧的 alpha 合起来再生成区域。 * fix(server): 工具栏按钮框始终算在异形窗口里 窗口形状只取背景图不透明的部分时,摆在图片透明处的按钮会被一起裁掉、 点不到。形状改为背景图轮廓并上每个按钮的框,按钮可以放在人物旁边的空白处, 不必在背景图里垫底。 * feat(server): 工具栏按钮可单独设内置图标的字号 [toolbar.buttons.<按钮>] 新增 icon_size_dip,内置 Segoe Fluent Icons 图标的 字号不再只能跟着按钮框走:按钮框铺满背景图里的圆底、图标单独调大小。 不写时仍是按钮框短边的 0.82 倍。 * feat(server): 设置页按图片模式预览悬浮工具栏 皮肤页的卡片与悬浮工具栏页的预览原来只会画矩形条。皮肤是图片模式时, 改按工具栏的画法预览:背景图(v2 皮肤的动图会播放)、按皮肤坐标摆放的 按钮、按钮贴图或内置图标(含 icon_size_dip),设置页关掉的按钮不画, 缩放与图标尺寸设置一并生效。 --------- Co-authored-by: fanlusky <1730976608@qq.com>
21 lines
1.1 KiB
C++
21 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <windows.h>
|
|
|
|
namespace msimeui
|
|
{
|
|
// The pixels of a 32-bit BGRA bitmap whose alpha is above `threshold`, as rectangles: runs of
|
|
// such pixels in a row, with identical runs in consecutive rows merged into one taller rectangle.
|
|
// Only the alpha byte is read, so premultiplied and straight alpha give the same result.
|
|
// Rectangles come out top to bottom and left to right, the order a region needs.
|
|
std::vector<RECT> AlphaMaskRects(const BYTE *pixels, UINT width, UINT height, UINT stride, BYTE threshold);
|
|
|
|
// The image at `filePath` scaled to width x height pixels, as a region of its pixels with alpha
|
|
// above `threshold`. Animated images (APNG, GIF) count a pixel when any frame covers it, since a
|
|
// window region clips drawing as well as clicks. Suits SetWindowRgn for a window shaped like the
|
|
// image. Null when the image cannot be read or has no such pixel; the caller owns the region.
|
|
HRGN CreateAlphaMaskRegion(const std::wstring &filePath, UINT width, UINT height, BYTE threshold = 0);
|
|
} // namespace msimeui
|