本人急需做出一个汉字点阵如果:取模方式是:横向8点左高位 字节排例:从左到右从上到下
很空易取出来,但如果取模方式:纵向8点下高位 字节排例:从左到右从上到下如果取出呢?
横向8点左高位 字节排例:从左到右从上到下
       sss:='';
    for  count:=1  to  32  do
    begin
        read(hzk16,i[n]);
        stemp:=inttohex(ord(i[n]),2)+'H';
        if ((n mod 8)<>0 )then stemp:=stemp+',';
        if stemp[1]>'9' then stemp:='0'+stemp;
        sss:=sss+stemp;
        if n mod 8=0 then sss:=sss+char(13)+char(10);
        label5.caption:=label5.caption+inttohex(ord(i[n]),2);
        n:=n+1;
        if  (n  mod  2=1)  then
        begin
        memo1.Lines.Add(label5.caption+'        '+translate(label5.caption));
        label5.caption:='';
        end;
    end;
       memo2.text:=sss; 这样取出汉字“有”的点阵为:
  02H,00H,02H,04H,0FFH,0FEH,04H,00H
04H,10H,0FH,0F8H,08H,10H,18H,10H
2FH,0F0H,48H,10H,88H,10H,0FH,0F0H
08H,10H,08H,10H,08H,50H,08H,20H如果取模方式:纵向8点下高位 字节排例:从左到右从上到下如果取出呢?
   如何写代码呢请教高手,谢谢

解决方案 »

  1.   

    var
      hzdot: array [0..15] of word;
      prndot: array [0..15, 0..1] of byte;
      i, j: Integer;
      tmp: word;
      sss: string;
    begin
      fileread(hzk16, hzdot, 32);  // 读出一个汉字的16*16点阵
      for i := 0 to 15 do
      begin
        // 将hzdot第i列转成prndot中第i行
        tmp := 0;              
        for j := 0 to 15 do
          tmp := tmp or ((hzdot[j] and ($8000 shr i)) shr (15 - j));
        pword(@prndot[i])^ := tmp;
      end;
      for i := 0 to 15 do
        memo2.lines.add := inttohex(prndot[i][0], 2)+'H,'+inttohex(prndot[i][1], 2)+'H';
    end;
      

  2.   

    代码有误,改进了一下:
    var
      hzdot: array [0..15] of word;
      prndot: array [0..15, 0..1] of byte;
      i, j: Integer;
      tmp: word;
      sss: string;
    begin
      fileread(hzk16, hzdot, 32);  // 读出一个汉字的16*16点阵
      for i := 0 to 15 do
      begin
        // 将hzdot第i列转成prndot中第i行
        tmp := 0;              
        for j := 0 to 15 do
          tmp := tmp or ((hzdot[j] and ($8000 shr i)) shr (15 - j));
        // 交换tmp的高低位字节
        prndot[i][0] := tmp shr 8;
        prndot[i][1] := tmp and $FF;
      end;
      for i := 0 to 15 do
        memo2.lines.add := inttohex(prndot[i][0], 2)+'H,'+inttohex(prndot[i][1], 2)+'H';
    end;