unit samp1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  dddd, ddraw, StdCtrls;

type
  TForm1 = class(TForm)
    DDDD1: TDDDD;
    Label1: TLabel;
    procedure FormClick(Sender: TObject);
    procedure DDDD1Init(Sender: TObject; fNeedChange: Boolean);
  private
    { Private 宣言 }
  public
    { Public 宣言 }
    Surf1:TDDDDSurface;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormClick(Sender: TObject);
var
  fx:DDBLTFX;
begin

  ZeroMemory(@fx,sizeof(fx));
  fx.dwSize:=sizeof(fx);
  Surf1.Put(Rect(0,0,128,192),Rect(0,0,128,192), DDBLT_WAIT ,fx);

  DDDD1.Flip;
end;

procedure TForm1.DDDD1Init(Sender: TObject; fNeedChange: Boolean);
begin
  Surf1:=TDDDDSurface.Create(DDDD1, 128,192, 64);
  Surf1.LoadBmp('samp.bmp');
  Surf1.ColorKey:=Surf1.Pixels[0,0];  //一番左上の色をカラーキーに

  DDDD1.BackColor:=Surf1.Pixels[0,0]; //背景色も同じ色に

  //パレットの読みこみ
  DDDD1.ReadPalette('samp.bmp');
  DDDD1.UpdatePalette;

  //画面のクリア
  DDDD1.Clear;
  DDDD1.Flip;
  DDDD1.Clear;
end;

end.
