【发布时间】:2019-05-17 21:06:57
【问题描述】:
我目前正在使用自动热键来创建游戏。我想在这个游戏中加入图片,并想改变它们的颜色和背景。
我已经尝试了几件事,到目前为止,所有这些都在自动热键窗口中产生了问题。
任何类型的过滤器似乎都没有任何作用。甚至在彩色图像上也没有
在画布中更改颜色非常慢(每张图像从 30 秒到 5 分钟不等)
我尝试将图像转换为 svg,但到目前为止,我发现所有这样做的网站都会将图像更改为我不想要的更矢量化的外观。
我现在正在尝试的解决方案是将图片转换为字体并以这种方式更改其颜色,但是在我的计算机上执行各种操作只会阻止脚本加载字体,直到我重新启动我的电脑。一个例子是在我的电脑上保存一张图片。
这是一个包含我现在正在尝试使用的测试脚本、字体和 html 文件的链接Link
自动热键脚本。
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
htmlpath := A_scriptdir . "\Htmlfile.html"
gui Picture_Loader:default
gui, add, edit, h0 w0
gui, font, s10
gui +Border +lastfound
menuwidth := A_screenwidth / 3
menuheight := A_screenheight / 2
Gui, Add, ActiveX, x0 y0 w%menuwidth% h%menuheight% vmenu, Shell.Browser
menu.navigate(htmlpath)
gui, show
return
F11::
Reload
return
HTML 文件
<!DOCTYPE html>
<html>
<head>
<title>a</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<style type=text/css>
html {
overflow:hidden;
height:100%;
}
body {
background:#888888;
width:100%;
height: 100%;
}
@font-face {
font-family:'Myfont';
src:url('opensans-bold.woff') format('woff');
}
.custom{
font-family:'Myfont';
}
</style>
</head>
<body>
<p class='custom'>Aa</p>
</body>
</html>
如果有人能解决我的任何问题。请告诉我。一种使字体始终如一地工作的方法,将图像转换为 svg 而不更改它们的站点,或者将画布颜色更改为可管理级别的速度都可以解决这个问题。问题
【问题讨论】:
标签: html css autohotkey