[fpc-pascal] Implementing AggPas with PtcGraph

James Richters james at productionautomation.net
Thu Jun 29 18:30:51 CEST 2017


I defined a static array to convert the mode 13h VGA palette to separate red, green and blue to send to aggpas as well as the packed RGB565 format needed to send to ptcgraph 16bit colors.

James


Type 
   VGARGBRec= Record
      R,G,B:Byte;
      RGB:Word;
   end;

Const
   VGA256: Array[0..255] of VGARGBRec = (
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$AA; RGB:$0015),
      (R:$00; G:$AA; B:$00; RGB:$0540),
      (R:$00; G:$AA; B:$AA; RGB:$0555),
      (R:$AA; G:$00; B:$00; RGB:$A800),
      (R:$AA; G:$00; B:$AA; RGB:$A815),
      (R:$AA; G:$55; B:$00; RGB:$AAA0),
      (R:$AA; G:$AA; B:$AA; RGB:$AD55),
      (R:$55; G:$55; B:$55; RGB:$52AA),
      (R:$55; G:$55; B:$FF; RGB:$52BF),
      (R:$55; G:$FF; B:$55; RGB:$57EA),
      (R:$55; G:$FF; B:$FF; RGB:$57FF),
      (R:$FF; G:$55; B:$55; RGB:$FAAA),
      (R:$FF; G:$55; B:$FF; RGB:$FABF),
      (R:$FF; G:$FF; B:$55; RGB:$FFEA),
      (R:$FF; G:$FF; B:$FF; RGB:$FFFF),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$14; G:$14; B:$14; RGB:$10A2),
      (R:$20; G:$20; B:$20; RGB:$2104),
      (R:$2C; G:$2C; B:$2C; RGB:$2965),
      (R:$38; G:$38; B:$38; RGB:$39C7),
      (R:$44; G:$44; B:$44; RGB:$4228),
      (R:$50; G:$50; B:$50; RGB:$528A),
      (R:$61; G:$61; B:$61; RGB:$630C),
      (R:$71; G:$71; B:$71; RGB:$738E),
      (R:$81; G:$81; B:$81; RGB:$8410),
      (R:$91; G:$91; B:$91; RGB:$9492),
      (R:$A1; G:$A1; B:$A1; RGB:$A514),
      (R:$B6; G:$B6; B:$B6; RGB:$B5B6),
      (R:$CA; G:$CA; B:$CA; RGB:$CE59),
      (R:$E2; G:$E2; B:$E2; RGB:$E71C),
      (R:$FF; G:$FF; B:$FF; RGB:$FFFF),
      (R:$00; G:$00; B:$FF; RGB:$001F),
      (R:$40; G:$00; B:$FF; RGB:$401F),
      (R:$7D; G:$00; B:$FF; RGB:$781F),
      (R:$BE; G:$00; B:$FF; RGB:$B81F),
      (R:$FF; G:$00; B:$FF; RGB:$F81F),
      (R:$FF; G:$00; B:$BE; RGB:$F817),
      (R:$FF; G:$00; B:$7D; RGB:$F80F),
      (R:$FF; G:$00; B:$40; RGB:$F808),
      (R:$FF; G:$00; B:$00; RGB:$F800),
      (R:$FF; G:$40; B:$00; RGB:$FA00),
      (R:$FF; G:$7D; B:$00; RGB:$FBE0),
      (R:$FF; G:$BE; B:$00; RGB:$FDE0),
      (R:$FF; G:$FF; B:$00; RGB:$FFE0),
      (R:$BE; G:$FF; B:$00; RGB:$BFE0),
      (R:$7D; G:$FF; B:$00; RGB:$7FE0),
      (R:$40; G:$FF; B:$00; RGB:$47E0),
      (R:$00; G:$FF; B:$00; RGB:$07E0),
      (R:$00; G:$FF; B:$40; RGB:$07E8),
      (R:$00; G:$FF; B:$7D; RGB:$07EF),
      (R:$00; G:$FF; B:$BE; RGB:$07F7),
      (R:$00; G:$FF; B:$FF; RGB:$07FF),
      (R:$00; G:$BE; B:$FF; RGB:$05FF),
      (R:$00; G:$7D; B:$FF; RGB:$03FF),
      (R:$00; G:$40; B:$FF; RGB:$021F),
      (R:$7D; G:$7D; B:$FF; RGB:$7BFF),
      (R:$9D; G:$7D; B:$FF; RGB:$9BFF),
      (R:$BE; G:$7D; B:$FF; RGB:$BBFF),
      (R:$DE; G:$7D; B:$FF; RGB:$DBFF),
      (R:$FF; G:$7D; B:$FF; RGB:$FBFF),
      (R:$FF; G:$7D; B:$DE; RGB:$FBFB),
      (R:$FF; G:$7D; B:$BE; RGB:$FBF7),
      (R:$FF; G:$7D; B:$9D; RGB:$FBF3),
      (R:$FF; G:$7D; B:$7D; RGB:$FBEF),
      (R:$FF; G:$9D; B:$7D; RGB:$FCEF),
      (R:$FF; G:$BE; B:$7D; RGB:$FDEF),
      (R:$FF; G:$DE; B:$7D; RGB:$FEEF),
      (R:$FF; G:$FF; B:$7D; RGB:$FFEF),
      (R:$DE; G:$FF; B:$7D; RGB:$DFEF),
      (R:$BE; G:$FF; B:$7D; RGB:$BFEF),
      (R:$9D; G:$FF; B:$7D; RGB:$9FEF),
      (R:$7D; G:$FF; B:$7D; RGB:$7FEF),
      (R:$7D; G:$FF; B:$9D; RGB:$7FF3),
      (R:$7D; G:$FF; B:$BE; RGB:$7FF7),
      (R:$7D; G:$FF; B:$DE; RGB:$7FFB),
      (R:$7D; G:$FF; B:$FF; RGB:$7FFF),
      (R:$7D; G:$DE; B:$FF; RGB:$7EFF),
      (R:$7D; G:$BE; B:$FF; RGB:$7DFF),
      (R:$7D; G:$9D; B:$FF; RGB:$7CFF),
      (R:$B6; G:$B6; B:$FF; RGB:$B5BF),
      (R:$C6; G:$B6; B:$FF; RGB:$C5BF),
      (R:$DA; G:$B6; B:$FF; RGB:$DDBF),
      (R:$EA; G:$B6; B:$FF; RGB:$EDBF),
      (R:$FF; G:$B6; B:$FF; RGB:$FDBF),
      (R:$FF; G:$B6; B:$EA; RGB:$FDBD),
      (R:$FF; G:$B6; B:$DA; RGB:$FDBB),
      (R:$FF; G:$B6; B:$C6; RGB:$FDB8),
      (R:$FF; G:$B6; B:$B6; RGB:$FDB6),
      (R:$FF; G:$C6; B:$B6; RGB:$FE36),
      (R:$FF; G:$DA; B:$B6; RGB:$FED6),
      (R:$FF; G:$EA; B:$B6; RGB:$FF56),
      (R:$FF; G:$FF; B:$B6; RGB:$FFF6),
      (R:$EA; G:$FF; B:$B6; RGB:$EFF6),
      (R:$DA; G:$FF; B:$B6; RGB:$DFF6),
      (R:$C6; G:$FF; B:$B6; RGB:$C7F6),
      (R:$B6; G:$FF; B:$B6; RGB:$B7F6),
      (R:$B6; G:$FF; B:$C6; RGB:$B7F8),
      (R:$B6; G:$FF; B:$DA; RGB:$B7FB),
      (R:$B6; G:$FF; B:$EA; RGB:$B7FD),
      (R:$B6; G:$FF; B:$FF; RGB:$B7FF),
      (R:$B6; G:$EA; B:$FF; RGB:$B75F),
      (R:$B6; G:$DA; B:$FF; RGB:$B6DF),
      (R:$B6; G:$C6; B:$FF; RGB:$B63F),
      (R:$00; G:$00; B:$71; RGB:$000E),
      (R:$1C; G:$00; B:$71; RGB:$180E),
      (R:$38; G:$00; B:$71; RGB:$380E),
      (R:$55; G:$00; B:$71; RGB:$500E),
      (R:$71; G:$00; B:$71; RGB:$700E),
      (R:$71; G:$00; B:$55; RGB:$700A),
      (R:$71; G:$00; B:$38; RGB:$7007),
      (R:$71; G:$00; B:$1C; RGB:$7003),
      (R:$71; G:$00; B:$00; RGB:$7000),
      (R:$71; G:$1C; B:$00; RGB:$70E0),
      (R:$71; G:$38; B:$00; RGB:$71C0),
      (R:$71; G:$55; B:$00; RGB:$72A0),
      (R:$71; G:$71; B:$00; RGB:$7380),
      (R:$55; G:$71; B:$00; RGB:$5380),
      (R:$38; G:$71; B:$00; RGB:$3B80),
      (R:$1C; G:$71; B:$00; RGB:$1B80),
      (R:$00; G:$71; B:$00; RGB:$0380),
      (R:$00; G:$71; B:$1C; RGB:$0383),
      (R:$00; G:$71; B:$38; RGB:$0387),
      (R:$00; G:$71; B:$55; RGB:$038A),
      (R:$00; G:$71; B:$71; RGB:$038E),
      (R:$00; G:$55; B:$71; RGB:$02AE),
      (R:$00; G:$38; B:$71; RGB:$01CE),
      (R:$00; G:$1C; B:$71; RGB:$00EE),
      (R:$38; G:$38; B:$71; RGB:$39CE),
      (R:$44; G:$38; B:$71; RGB:$41CE),
      (R:$55; G:$38; B:$71; RGB:$51CE),
      (R:$61; G:$38; B:$71; RGB:$61CE),
      (R:$71; G:$38; B:$71; RGB:$71CE),
      (R:$71; G:$38; B:$61; RGB:$71CC),
      (R:$71; G:$38; B:$55; RGB:$71CA),
      (R:$71; G:$38; B:$44; RGB:$71C8),
      (R:$71; G:$38; B:$38; RGB:$71C7),
      (R:$71; G:$44; B:$38; RGB:$7227),
      (R:$71; G:$55; B:$38; RGB:$72A7),
      (R:$71; G:$61; B:$38; RGB:$7307),
      (R:$71; G:$71; B:$38; RGB:$7387),
      (R:$61; G:$71; B:$38; RGB:$6387),
      (R:$55; G:$71; B:$38; RGB:$5387),
      (R:$44; G:$71; B:$38; RGB:$4387),
      (R:$38; G:$71; B:$38; RGB:$3B87),
      (R:$38; G:$71; B:$44; RGB:$3B88),
      (R:$38; G:$71; B:$55; RGB:$3B8A),
      (R:$38; G:$71; B:$61; RGB:$3B8C),
      (R:$38; G:$71; B:$71; RGB:$3B8E),
      (R:$38; G:$61; B:$71; RGB:$3B0E),
      (R:$38; G:$55; B:$71; RGB:$3AAE),
      (R:$38; G:$44; B:$71; RGB:$3A2E),
      (R:$50; G:$50; B:$71; RGB:$528E),
      (R:$59; G:$50; B:$71; RGB:$5A8E),
      (R:$61; G:$50; B:$71; RGB:$628E),
      (R:$69; G:$50; B:$71; RGB:$6A8E),
      (R:$71; G:$50; B:$71; RGB:$728E),
      (R:$71; G:$50; B:$69; RGB:$728D),
      (R:$71; G:$50; B:$61; RGB:$728C),
      (R:$71; G:$50; B:$59; RGB:$728B),
      (R:$71; G:$50; B:$50; RGB:$728A),
      (R:$71; G:$59; B:$50; RGB:$72CA),
      (R:$71; G:$61; B:$50; RGB:$730A),
      (R:$71; G:$69; B:$50; RGB:$734A),
      (R:$71; G:$71; B:$50; RGB:$738A),
      (R:$69; G:$71; B:$50; RGB:$6B8A),
      (R:$61; G:$71; B:$50; RGB:$638A),
      (R:$59; G:$71; B:$50; RGB:$5B8A),
      (R:$50; G:$71; B:$50; RGB:$538A),
      (R:$50; G:$71; B:$59; RGB:$538B),
      (R:$50; G:$71; B:$61; RGB:$538C),
      (R:$50; G:$71; B:$69; RGB:$538D),
      (R:$50; G:$71; B:$71; RGB:$538E),
      (R:$50; G:$69; B:$71; RGB:$534E),
      (R:$50; G:$61; B:$71; RGB:$530E),
      (R:$50; G:$59; B:$71; RGB:$52CE),
      (R:$00; G:$00; B:$40; RGB:$0008),
      (R:$10; G:$00; B:$40; RGB:$1008),
      (R:$20; G:$00; B:$40; RGB:$2008),
      (R:$30; G:$00; B:$40; RGB:$3008),
      (R:$40; G:$00; B:$40; RGB:$4008),
      (R:$40; G:$00; B:$30; RGB:$4006),
      (R:$40; G:$00; B:$20; RGB:$4004),
      (R:$40; G:$00; B:$10; RGB:$4002),
      (R:$40; G:$00; B:$00; RGB:$4000),
      (R:$40; G:$10; B:$00; RGB:$4080),
      (R:$40; G:$20; B:$00; RGB:$4100),
      (R:$40; G:$30; B:$00; RGB:$4180),
      (R:$40; G:$40; B:$00; RGB:$4200),
      (R:$30; G:$40; B:$00; RGB:$3200),
      (R:$20; G:$40; B:$00; RGB:$2200),
      (R:$10; G:$40; B:$00; RGB:$1200),
      (R:$00; G:$40; B:$00; RGB:$0200),
      (R:$00; G:$40; B:$10; RGB:$0202),
      (R:$00; G:$40; B:$20; RGB:$0204),
      (R:$00; G:$40; B:$30; RGB:$0206),
      (R:$00; G:$40; B:$40; RGB:$0208),
      (R:$00; G:$30; B:$40; RGB:$0188),
      (R:$00; G:$20; B:$40; RGB:$0108),
      (R:$00; G:$10; B:$40; RGB:$0088),
      (R:$20; G:$20; B:$40; RGB:$2108),
      (R:$28; G:$20; B:$40; RGB:$2908),
      (R:$30; G:$20; B:$40; RGB:$3108),
      (R:$38; G:$20; B:$40; RGB:$3908),
      (R:$40; G:$20; B:$40; RGB:$4108),
      (R:$40; G:$20; B:$38; RGB:$4107),
      (R:$40; G:$20; B:$30; RGB:$4106),
      (R:$40; G:$20; B:$28; RGB:$4105),
      (R:$40; G:$20; B:$20; RGB:$4104),
      (R:$40; G:$28; B:$20; RGB:$4144),
      (R:$40; G:$30; B:$20; RGB:$4184),
      (R:$40; G:$38; B:$20; RGB:$41C4),
      (R:$40; G:$40; B:$20; RGB:$4204),
      (R:$38; G:$40; B:$20; RGB:$3A04),
      (R:$30; G:$40; B:$20; RGB:$3204),
      (R:$28; G:$40; B:$20; RGB:$2A04),
      (R:$20; G:$40; B:$20; RGB:$2204),
      (R:$20; G:$40; B:$28; RGB:$2205),
      (R:$20; G:$40; B:$30; RGB:$2206),
      (R:$20; G:$40; B:$38; RGB:$2207),
      (R:$20; G:$40; B:$40; RGB:$2208),
      (R:$20; G:$38; B:$40; RGB:$21C8),
      (R:$20; G:$30; B:$40; RGB:$2188),
      (R:$20; G:$28; B:$40; RGB:$2148),
      (R:$2C; G:$2C; B:$40; RGB:$2968),
      (R:$30; G:$2C; B:$40; RGB:$3168),
      (R:$34; G:$2C; B:$40; RGB:$3168),
      (R:$3C; G:$2C; B:$40; RGB:$3968),
      (R:$40; G:$2C; B:$40; RGB:$4168),
      (R:$40; G:$2C; B:$3C; RGB:$4167),
      (R:$40; G:$2C; B:$34; RGB:$4166),
      (R:$40; G:$2C; B:$30; RGB:$4166),
      (R:$40; G:$2C; B:$2C; RGB:$4165),
      (R:$40; G:$30; B:$2C; RGB:$4185),
      (R:$40; G:$34; B:$2C; RGB:$41A5),
      (R:$40; G:$3C; B:$2C; RGB:$41E5),
      (R:$40; G:$40; B:$2C; RGB:$4205),
      (R:$3C; G:$40; B:$2C; RGB:$3A05),
      (R:$34; G:$40; B:$2C; RGB:$3205),
      (R:$30; G:$40; B:$2C; RGB:$3205),
      (R:$2C; G:$40; B:$2C; RGB:$2A05),
      (R:$2C; G:$40; B:$30; RGB:$2A06),
      (R:$2C; G:$40; B:$34; RGB:$2A06),
      (R:$2C; G:$40; B:$3C; RGB:$2A07),
      (R:$2C; G:$40; B:$40; RGB:$2A08),
      (R:$2C; G:$3C; B:$40; RGB:$29E8),
      (R:$2C; G:$34; B:$40; RGB:$29A8),
      (R:$2C; G:$30; B:$40; RGB:$2988),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000),
      (R:$00; G:$00; B:$00; RGB:$0000));





More information about the fpc-pascal mailing list