tbs0051.pp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. program TestPutP;
  2. {$ifdef go32v2}
  3. {define has_colors_equal}
  4. {$endif go32v2}
  5. {$ifdef go32v2}
  6. {$define OK}
  7. {$endif}
  8. {$ifdef linux}
  9. {$define OK}
  10. {$endif}
  11. {$ifdef OK}
  12. uses crt,graph;
  13. {$ifndef has_colors_equal}
  14. function ColorsEqual(c1, c2 : longint) : boolean;
  15. begin
  16. ColorsEqual:=((GetMaxColor=$FF) and ((c1 and $FF)=(c2 and $FF))) or
  17. ((GetMaxColor=$7FFF) and ((c1 and $F8F8F8)=(c2 and $F8F8F8))) or
  18. ((GetMaxColor=$FFFF) and ((c1 and $F8FCF8)=(c2 and $F8FCF8))) or
  19. ((GetMaxColor>$10000) and ((c1 and $FFFFFF)=(c2 and $FFFFFF)));
  20. end;
  21. {$endif not has_colors_equal}
  22. var gd,gm,gError,yi,i : integer;
  23. col: longint;
  24. error : word;
  25. {$endif OK}
  26. BEGIN
  27. {$ifdef OK}
  28. if paramcount=0 then
  29. gm:=$111 {640x480/64K HiColor}
  30. else
  31. begin
  32. val(paramstr(1),gm,error);
  33. if error<>0 then
  34. gm:=$111;
  35. end;
  36. gd:=detect;
  37. InitGraph(gd,gm,'');
  38. gError := graphResult;
  39. IF gError <> grOk
  40. THEN begin
  41. writeln ('graphDriver=',gd,' graphMode=',gm,
  42. #13#10'Graphics error: ',gError);
  43. halt(1);
  44. end;
  45. for i := 0 to 255
  46. do begin
  47. col := i shl 16 + (i div 2) shl 8 + (i div 3);
  48. for yi := 0 to 20 do
  49. PutPixel (i,yi,col);
  50. SetColor (col);
  51. Line (i,22,i,42);
  52. end;
  53. for i:=0 to 255 do
  54. if not ColorsEqual(getpixel(i,15),getpixel(i,30)) then
  55. Halt(1);
  56. {readkey;}delay(1000);
  57. closegraph;
  58. {$endif OK}
  59. END.
  60. {
  61. $Log$
  62. Revision 1.1 1999-12-02 17:37:38 peter
  63. * moved *.pp into subdirs
  64. * fpcmaked
  65. Revision 1.5 1999/11/28 12:17:14 jonas
  66. * changed the requested graphdriver from $FF to VESA (= 10), so the
  67. test program works again with the new graph unit
  68. * undefined has_colors_equal for go32v2, because it is not anymore
  69. in the new graph unit
  70. }