我希望此扫描线效果正常工作.要显示的文字从左至右.好像阴极射线将其燃烧成屏幕上的荧光粉.
这个想法是滑过黑色的行,它们有一个透明的尖端.这是一个80%的工作演示.

.mask每行中
最右边的黑色div不会扩展.它必须.
我试图将最右边的.maskdiv 保留为黑色背景作为内联块并使其全宽.我有点理解为什么请求不起作用(宽度:100%将其他内联块推到下一行,只是正确),但必须有一种方法来获得这个完整的右侧而不破坏javascript中的宽度.
.row {
font-family:'Courier New',Courier,monospace;
font-size:16px;
display:block;
height:auto;
width:100%;
min-width:20%;
position:relative;
margin-right:0px;
}
.mask {
display:inline-block;
width:auto; /* 100% does not work */
background:black;
white-space:pre;
}
Run Code Online (Sandbox Code Playgroud) 我试图根据Embarcadero上的文章访问位图的扫描线.使用像扫描线
for y := 0 to n do
begin
line := bitmap.scanline [y];
for x := 0 to n do line [x] := value;
Run Code Online (Sandbox Code Playgroud)
我之前已经实施过.我注意到访问扫描线需要相当多的时间,上面提到的文章提供了解决方案.我无法正确实现它.我的代码是:
unit SCTester;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
ExtCtrls;
type
TRGBQuad = packed record
b: uInt8;
g: uInt8;
r: uInt8;
alpha: uInt8;
end; // Record: TQuad //
// Override the definitions in Graphics.pas
TRGBQuadArray = packed array [0..MaxInt div SizeOf (TRGBQuad) - 1] of TRGBQuad;
PRGBQuadArray = …Run Code Online (Sandbox Code Playgroud) 使用32位TBitmap时,我从Canvas.Pixels切换到ScanLine.
然后我将值设置为红色,只是发现它显示为蓝色.
知道为什么吗?
这是一段代码摘录:
procedure TForm1.FormPaint(Sender: TObject);
var
varBitmap: TBitmap;
pLock: PIntegerArray;
iColor: integer;
begin
varBitmap := TBitmap.Create;
varBitmap.PixelFormat := pf32bit;
varBitmap.Width := 800;
varBitmap.Height := 600;
// Set Pixels to Red
varBitmap.Canvas.Pixels[0, 0] := $0000FF;
// Shows $FF0000 (blue)
pLock := varBitmap.ScanLine[0];
iColor := pLock[0];
ShowMessageFmt('%x', [iColor]);
// Set ScanLine to Red
pLock[0] := $0000FF;
// Displays a blue pixel
Canvas.Draw(0, 0, varBitmap);
end;
Run Code Online (Sandbox Code Playgroud)
似乎TColor与内存中的内容不同,但这没有任何意义.
欢迎任何建议.;)
嗨,这里是我的代码:
procedure TForm4.Button1Click(Sender: TObject);
var
png: TPNGImage;
data: PRGBQarray;
p: ^tagRGBQuad;
i, o: integer;
begin
png := TPNGImage.Create;
try
png.LoadFromFile('C:\Untitled.png');
for o := 1 to 100 do
begin
data:=png.Scanline[o];
for I := 1 to 400 do
begin
p := @data^[i];
p.rgbGreen := p.rgbBlue;
p.rgbRed := p.rgbGreen;
end;
end;
img.picture.Assign(png);
finally
png.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
它不起作用,它使pic杂乱,我确定这是因为rgbReserved.我该怎么办?
如何将两个PNG合并在一起?我知道你不能使用,PNGObject.Draw因为它不会复制alpha transaperncy(我不确定,但它无论如何都不起作用)所以需要自定义过程/功能.我没有空手来,我有这个程序:
procedure MergePNGLayer(Layer1,Layer2: TPNGObject; Const aLeft,aTop:Integer);
var
x, y: Integer;
SL1, SL2, SLBlended : pRGBLine;
aSL1, aSL2, aSLBlended: PByteArray;
blendCoeff: single;
blendedPNG, Lay2buff: TPNGObject;
begin
blendedPNG:=TPNGObject.Create;
blendedPNG.Assign(Layer1);
Lay2buff:=TPNGObject.Create;
Lay2buff.Assign(Layer2);
SetPNGCanvasSize(Layer2,Layer1.Width,Layer1.Height,aLeft,aTop);
for y := 0 to Layer1.Height-1 do
begin
SL1 := Layer1.Scanline[y];
SL2 := Layer2.Scanline[y];
aSL1 := Layer1.AlphaScanline[y];
aSL2 := Layer2.AlphaScanline[y];
SLBlended := blendedPNG.Scanline[y];
aSLBlended := blendedPNG.AlphaScanline[y];
for x := 0 to Layer1.Width-1 do
begin
blendCoeff:=aSL1[x] * 100/255/100;
aSLBlended[x] := round(aSL2[x] + (aSL1[x]-aSL2[x]) * blendCoeff);
SLBlended[x].rgbtRed …Run Code Online (Sandbox Code Playgroud) 查看golang的2D切片的文档,无法理解上一个示例中使用的语法:
func main() {
XSize := 5
YSize := 5
// Allocate the top-level slice, the same as before.
picture := make([][]uint8, YSize) // One row per unit of y.
// Allocate one large slice to hold all the pixels.
pixels := make([]uint8, XSize*YSize) // Has type []uint8 even though picture is [][]uint8.
// Loop over the rows, slicing each row from the front of the remaining pixe ls slice.
for i := range picture {
picture[i], pixels …Run Code Online (Sandbox Code Playgroud) 目前,我循环该Canvas.Pixels[]属性并读取画布上的每个像素以交换红色/蓝色字节(出于特定原因).但是,每张照片平均需要2秒钟,我需要转换8,000张照片(过夜).我知道我可以使用一种方法ScanLine来更快地完成这项工作,但我一无所知ScanLine- 它的编码水平远低于我所熟悉的水平.实现这一目标的最快方法是什么?我愿意等待一段时间才能完成这项任务,但如果我能将这个时间缩短一半或更多,那仍然会很好.
现在,这是我使用的程序:
procedure SwapBytes(var Bmp: TBitmap);
var
X, Y: Integer;
R, G, B: Byte;
C: TColor;
begin
for Y := 0 to Bmp.Height - 1 do begin
for X := 0 to Bmp.Width - 1 do begin
C:= Bmp.Canvas.Pixels[X,Y];
R:= GetRValue(C);
G:= GetGValue(C);
B:= GetBValue(C);
Bmp.Canvas.Pixels[X,Y]:= RGB(B, G, R)
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
添加注意:超过8,000张图像的初始转换是我需要的第一步.但是,我也将在我们的软件中使用相同的东西,根据需要自动转换现场的任何图像.所以第三方转换器将无法工作,因为我无法将其分发给我们的客户.