GDI.inc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. Function BeginPaint(aH:HWND):LPPAINTSTRUCT;
  2. var
  3. ret : LPPAINTSTRUCT;
  4. wnd,c : PWindow;
  5. begin
  6. wnd := wGetWndByHWND(aH);
  7. if wnd = nil then
  8. begin
  9. BeginPaint := nil;
  10. LAstError := ERR_BADHANDLE;
  11. Exit;
  12. end;
  13. New(ret);
  14. with ret^ do begin
  15. Font := DefaultFont;
  16. FontSize := 1;
  17. FontJus := ((LeftText) shl 4) OR CenterText;
  18. Style := SolidFill;
  19. Color := Black;
  20. BgColor := White;
  21. end;
  22. GetGlobalRect(aH,@ret^.gPos);
  23. with ret^.gPos do
  24. SetViewPort(A.X,A.Y,A.X+B.X,A.Y+B.Y,ClipOn);
  25. HideMouse;
  26. BeginPaint := Ret;
  27. repeat until (Port[$03DA] and 8) <> 8;
  28. repeat until (Port[$03DA] and 8) = 8;
  29. end;
  30. {-----------------------------------}
  31. Procedure EndPaint(aP:LPPAINTSTRUCT);
  32. begin
  33. SetViewPort(0,0,ScrMaxX,ScrMaxY,ClipOn);
  34. ShowMouse;
  35. Dispose(aP);
  36. end;
  37. Procedure wSetBgColor(aP:LPPAINTSTRUCT;aNewColor:INT8);
  38. begin
  39. aP^.BgColor := aNewColor;
  40. end;
  41. Procedure wSetColor(aP:LPPAINTSTRUCT;aNewColor:INT8);
  42. begin
  43. aP^.Color := aNewColor;
  44. end;
  45. Procedure wSetFont(aP:LPPAINTSTRUCT;aNewFont:INT8);
  46. begin
  47. aP^.Font := aNewFont;
  48. end;
  49. Procedure wSetStyle(aP:LPPAINTSTRUCT;aNewStyle:INT8);
  50. begin
  51. aP^.Style := aNewStyle;
  52. end;
  53. Procedure wSetFontSize(aP:LPPAINTSTRUCT;aNewColor:INT8);
  54. begin
  55. aP^.FontSize := aNewColor;
  56. end;
  57. Procedure wSetFontJustify(aP:LPPAINTSTRUCT;aNewH,aNewV:INT8);
  58. begin
  59. aP^.FontJus := (aNewH shl 4) OR aNewV;
  60. end;
  61. Function wMoveToEx(aP:LPPAINTSTRUCT;X,Y:INT16;lP:LPPOINT):Boolean;
  62. begin
  63. if (X>=0) AND (Y>=0) AND (X<=aP^.gPos.B.X) AND (Y<=aP^.gPos.B.Y) then
  64. begin
  65. if lp <> nil then
  66. begin
  67. lp^.X := GetX;
  68. lp^.Y := GetY;
  69. end;
  70. MoveTo(X,Y);
  71. wMoveToEx := true;
  72. end
  73. else
  74. wMoveToEx := False;
  75. end;{----------}
  76. Function wLineTo(aP:LPPAINTSTRUCT;X,Y:INT16):Boolean;
  77. begin
  78. if (X>=0) AND (Y>=0) AND (X<=aP^.gPos.B.X) AND (Y<=aP^.gPos.B.Y) then
  79. begin
  80. SetColor(aP^.Color);
  81. LineTo(X,Y);
  82. wLineTo:=true;
  83. end
  84. else
  85. wLineTo := False;
  86. end;
  87. Function wTextOut(aP:LPPAINTSTRUCT;X,Y:INT16;aStr:PString):Boolean;
  88. begin
  89. if (X>=0) AND (Y>=0) AND (X<=aP^.gPos.B.X) AND (Y<=aP^.gPos.B.Y) then
  90. with aP^ do
  91. begin
  92. SetColor(Color);
  93. SetTextStyle(Font,HorizDir,FontSize);
  94. SetTextJustify((FontJus shr 4) and $F, FontJus AND $F);
  95. OutTextXY(X,Y,aStr^);
  96. wTextOut:=true;
  97. end
  98. else
  99. wTextOut := False;
  100. end;
  101. Function wRectangle(aP:LPPAINTSTRUCT;X1,Y1,X2,Y2:INT16):Boolean;
  102. begin
  103. SetColor(aP^.Color);
  104. Rectangle(X1,Y1,X2,Y2);
  105. wRectangle:=true;
  106. end;
  107. Function wBar(aP:LPPAINTSTRUCT;X1,Y1,X2,Y2:INT16):Boolean;
  108. begin
  109. SetColor(aP^.Color);
  110. SetFillStyle(aP^.Style,aP^.BGColor);
  111. Bar(X1,Y1,X2,Y2);
  112. wBar:=true;
  113. end;
  114. Function wLine(aP:LPPAINTSTRUCT;X1,Y1,X2,Y2:INT16):Boolean;
  115. begin
  116. SetColor(aP^.Color);
  117. Line(X1,Y1,X2,Y2);
  118. wLine:=true;
  119. end;
  120. Function wFillCircle(aP:LPPAINTSTRUCT;X1,Y1,Rad:INT16):Boolean;
  121. begin
  122. SetColor(aP^.Color);
  123. SetFillStyle(aP^.Style,aP^.BGColor);
  124. FillEllipse(X1,Y1,rad,rad);
  125. wFillCircle:=true;
  126. end;