summaryrefslogtreecommitdiff
path: root/packages/ptc/src/wince/gdi/wincebitmapinfoi.inc
blob: 291deacb17f2bc8027e2a2a2102a927c0a4dcd62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

{TODO: create DIBs with the same color depth as the desktop}

Constructor TWinCEBitmapInfo.Create(AWidth, AHeight : Integer);

Begin
  FBitmapInfo := GetMem(SizeOf(BITMAPINFOHEADER) + 12);

  FillChar(FBitmapInfo^.bmiHeader, SizeOf(BITMAPINFOHEADER), 0);
  With FBitmapInfo^.bmiHeader Do
  Begin
    biSize := SizeOf(BITMAPINFOHEADER);
    biWidth := AWidth;
    biHeight := -AHeight;
    biPlanes := 1;
    biBitCount := 32;
    biCompression := BI_BITFIELDS;
    biSizeImage := 0;
    biXPelsPerMeter := 0;
    biYPelsPerMeter := 0;
    biClrUsed := 0;
    biClrImportant := 0;
  End;

  PDWord(@FBitmapInfo^.bmiColors)[0] := $FF0000;
  PDWord(@FBitmapInfo^.bmiColors)[1] := $00FF00;
  PDWord(@FBitmapInfo^.bmiColors)[2] := $0000FF;

  FWidth := AWidth;
  FHeight := AHeight;
  FFormat := TPTCFormat.Create(32, $FF0000, $FF00, $FF);
  FPitch := FWidth * 4;

//  FPixels := GetMem(AWidth * AHeight * 4);
//  FillChar(FPixels^, AWidth * AHeight * 4, 0);
End;

Destructor TWinCEBitmapInfo.Destroy;

Begin
//  FreeMem(FPixels);
  FreeMem(FBitmapInfo);
  FFormat.Free;
  Inherited Destroy;
End;