📄 gfxdrawpixel.pas
字号:
//////////////////////////////////////////////////////////////////////
// //
// gfxDrawPixel.pas: Metacode to render a single pixel //
// //
// The contents of this file are subject to the Bottled Light //
// Public License Version 1.0 (the "License"); you may not use this //
// file except in compliance with the License. You may obtain a //
// copy of the License at http://www.bottledlight.com/BLPL/ //
// //
// Software distributed under the License is distributed on an //
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or //
// implied. See the License for the specific language governing //
// rights and limitations under the License. //
// //
// The Original Code is the Mappy VM Core, released April 1st, 2003 //
// The Initial Developer of the Original Code is Bottled Light, //
// Inc. Portions created by Bottled Light, Inc. are Copyright //
// (C) 2001 - 2003 Bottled Light, Inc. All Rights Reserved. //
// //
// Author(s): //
// Michael Noland (joat), michael@bottledlight.com //
// //
// Changelog: //
// 1.0: First public release (April 1st, 2003) //
// //
//////////////////////////////////////////////////////////////////////
{$IFDEF BLEND}
if (wins^ and (1 shl 5) <> 0) and (blendSrc and mask <> 0) then begin
// Convert the pixel to RGB
r := pix and $1F;
g := (pix shr 5) and $1F;
b := (pix shr 10) and $1F;
// Calculate the new color
{$IFDEF FADEUP}
r := Min(r + ((31 - r)*coeffa) shr 4, 31);
g := Min(g + ((31 - g)*coeffa) shr 4, 31);
b := Min(b + ((31 - b)*coeffa) shr 4, 31);
{$ENDIF}
{$IFDEF FADEDOWN}
// Calculate the new color
r := Max(r - (r*coeffa) shr 4, 0);
g := Max(g - (g*coeffa) shr 4, 0);
b := Max(b - (b*coeffa) shr 4, 0);
{$ENDIF}
{$IFDEF ABLEND}
if blendSrc2 and ids^ <> 0 then begin
// Unpack the 2nd color
r2 := line^ and $1F;
g2 := (line^ shr 5) and $1F;
b2 := (line^ shr 10) and $1F;
// Calculate the new color
r := Min((r*coeffa + r2*coeffb) shr 4, 31);
g := Min((g*coeffa + g2*coeffb) shr 4, 31);
b := Min((b*coeffa + b2*coeffb) shr 4, 31);
end;
{$ENDIF}
// Repack it
pix := r + g shl 5 + b shl 10;
end;
{$ENDIF}
{$IFDEF OBJWIN}
pix := sprWinData;
{$ENDIF}
// Take care of mosaic latching
if mclock = 0 then begin
latch := pix;
latchXparent := false;
mclock := mx;
end else begin
Dec(mclock);
pix := latch;
end;
if not latchXparent then begin
{$IFDEF OBJWIN}
wins^ := latch;
{$ELSE}
line^ := latch;
ids^ := mask;
{$ENDIF}
end;
end else begin
// Still take care of mosaic latching even when not visible
if mclock = 0 then begin
latchXparent := true;
mclock := mx;
end else
Dec(mclock);
end;
// Step forward a touch
Inc(wins);
Inc(ids);
Inc(line);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -