BG-gen.PAS 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Uses Graph;
  2. const
  3. table :array [0..15] of byte = (0,1,2,Yellow,Blue,5,6,7,8,9,10,Yellow,LightBlue,13,14,15);
  4. var
  5. inp,outp : file;
  6. p : pointer;
  7. Size : Word;
  8. i,j : word;
  9. x,y : word;
  10. val : byte;
  11. gD,gM : Integer;
  12. begin
  13. gD:=VGA;
  14. gM:=VGAMed;
  15. InitGraph(gD,gM,'');
  16. Assign(outp,'BG2.dat');
  17. ReWrite(outp,1);
  18. Assign(inp,'BG.bmp');
  19. Reset(inp,1);
  20. Seek(INP,$12);
  21. BlockRead(inp,x,4);
  22. BlockRead(inp,y,4);
  23. Seek(Inp,$76);
  24. for i := 0 to y-1 do
  25. for j := 0 to (x-1) shr 1 do
  26. begin
  27. BlockRead(INP,val,1);
  28. PutPixel(j*2+1,479-i, table[val and $F]);
  29. PutPixel(j*2,479-i,table[(val shr 4) and $F]);
  30. end;
  31. Close(INP);
  32. Size := ImageSize(0,0,(x shr 1),(y shr 1)-1);
  33. i:=4;
  34. BlockWrite(OUTP,i,1);
  35. GetMem(P,Size);
  36. BlockWrite(OUTP,Size,2);
  37. i:=0;
  38. BlockWrite(OUTP,i,2);
  39. BlockWrite(OUTP,i,2);
  40. GetImage(0,0,(x shr 1)-1,(y shr 1)-1,P^);
  41. BlockWrite(OUTP,P^,Size);
  42. BlockWrite(OUTP,Size,2);
  43. i:=x shr 1;
  44. BlockWrite(OUTP,i,2);
  45. i:=0;
  46. BlockWrite(OUTP,i,2);
  47. GetImage(x shr 1,0,x-1,(y shr 1)-1,P^);
  48. BlockWrite(OUTP,P^,Size);
  49. BlockWrite(OUTP,Size,2);
  50. i:=0;
  51. BlockWrite(OUTP,i,2);
  52. i:=y shr 1;
  53. BlockWrite(OUTP,i,2);
  54. GetImage(0,y shr 1,(x shr 1)-1,y-1,P^);
  55. BlockWrite(OUTP,P^,Size);
  56. BlockWrite(OUTP,Size,2);
  57. i:=x shr 1;
  58. BlockWrite(OUTP,i,2);
  59. i:=y shr 1;
  60. BlockWrite(OUTP,i,2);
  61. GetImage(x shr 1,y shr 1,x-1,y-1,P^);
  62. BlockWrite(OUTP,P^,Size);
  63. FreeMem(P,Size);
  64. ReadLn;
  65. CloseGraph;
  66. Close(OUTP);
  67. end.