intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Đồ họa máy tính - Chương 5 Tô màu, Font chữ - Bài 17

Chia sẻ: Nguyễn Nhi | Ngày: | Loại File: PDF | Số trang:17

111
lượt xem
16
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Xử lý ký tự trên màn hình Để biểu diễn các ký tự trên màn hình ng-ời ta sử dụng 2 byte cho 1 ký tự một byte mã (code) của ký tự một byte - thuộc tính (attribute) của ký tự. Mã của ký tự là một số trong tập từ 0-256 Byte thuộc tính dùng để xác định tính chất hiển thị của ký tự trên màn hình nh- màu sắc, chế độ hiện nhấp nháy (Blink).....

Chủ đề:
Lưu

Nội dung Text: Đồ họa máy tính - Chương 5 Tô màu, Font chữ - Bài 17

  1. Kü thuËt §å ho¹ m¸y tÝnh Line(500,150,450,30); Line(400,80,450,30); Line(50,50,400,80); Repeat To_Mau(250,70,White,RanDom(14)+1); settextjustify(1,1); settextstyle(1,0,2); Outtextxy(320,400,'Press ESCAPE to Exit'); Repeat Until KeyPressed; Until (KeyPressed)And(ReadKey=#27); CloseGraph; End. $17. Xö lý ký tù trªn mμn h×nh §Ó biÓu diÔn c¸c ký tù trªn mµn h×nh ng−êi ta sö dông 2 byte cho 1 ký tù mét byte - m· (code) cña ký tù mét byte - thuéc tÝnh (attribute) cña ký tù. M· cña ký tù lµ mét sè trong tËp tõ 0-256 Byte thuéc tÝnh dïng ®Ó x¸c ®Þnh tÝnh chÊt hiÓn thÞ cña ký tù trªn mµn h×nh nh− mµu s¾c, chÕ ®é hiÖn nhÊp nh¸y (Blink)..... Mçi ký tù cã khu«n mÉu cña nã ng−êi ta gäi lµ shape hay pattern cña ký tù. Khu«n mÉu cña ký tù ®−îc l−u trong m¸y b»ng mét sè byte nµo ®ã tuú thuéc vµo khu«n mÉu cña ký tù. Trong m¸y tÝnh ng−êi ta dµnh 32 byte ®Ó l−u gi÷ khu«n mÉu cho mäi ký tù. Ng−êi ta t¹o c¸c byte biÓu diÔn khu«n mÉu cña mét ký tù theo nguyªn t¾c sau: ë chÕ ®é hép ký tù 8x8: ë chÕ ®é hép ký tù 8x14 94
  2. Kü thuËt §å ho¹ m¸y tÝnh C¸ch t¹o khu«n mÉu ký tù nh− trªn gäi lµ c¸ch t¹o theo kiÓu bitmap. ¦u ®iÓm cña c¸ch nµy ®¬n gi¶n. Song nh−îc ®iÓm lµ khã thay ®æi kÝch th−íc ký tù khi cÇn phãng to thu nhá. Ng−êi ta cã thÓ t¹o khu«n mÉu, ký tù theo mét c¸ch kh¸c ghi l¹i to¹ ®é cña c¸c ®o¹n th¼ng t¹o nªn ký tù - c¸ch nµy gäi lµ kiÓu vect¬ - −u ®iÓm cña c¸ch nµy lµ cho phÐp thay ®æi kÝch cì cña ký tù. TËp c¸c khu«n mÉu cña bé 256 ký tù gäi lµ font cña ký tù + Mét vµi ®Æc ®iÓm cÇn chó ý trong qu¸ tr×nh t¹o font 1. Khi c¸c ký tù xuÊt hiÖn trªn mµn h×nh nã sÏ xuÊt hiÖn trong khu«n khæ hép ký tù. MÆc dï c¸c ký tù cã kho¶ng c¸ch c¸ch xa nhau nh−ng gi÷a c¸c hép ký tù kh«ng cã kho¶ng c¸ch trªn mµn h×nh Vïng c¸c dot t¹o ra khu«n mÉu 2. §Ó t¹o ra kho¶ng c¸ch theo hµng ngang vµ chiÒu ®øng gi÷a c¸c ký tù mÆc dï c¸c hép ký tù xÕp liÒn nhau, khi t¹o font ng−êi ta t¹o theo nguyªn t¾c khu«n mÉu cña ký tù tËp trung vÒ gãc trªn bªn tr¸i + L−u gi÷ font ký tù ë chÕ ®é v¨n b¶n trong bé nhí Trong m¸y tÝnh ng−êi ta quy ®Þnh chuÈn chiÒu réng cña mçi ký tù lµ 8 dot, chiÒu cao tèi ®a cña mçi ký tù lµ 32 dßng (32 scanline) tõ ®ã suy ra ®Ó l−u gi÷ font cña mét ký tù tèi ®a cÇn 32 byte Mét bé font gåm 256 ký tù cÇn: 95
  3. Kü thuËt §å ho¹ m¸y tÝnh 256x32 =8192 ~8Kb ë chÕ ®é EGA bé nhí mµn h×nh cho phÐp n¹p s½n (Resident) tèi ®a 4 bé font nghÜa lµ trong 4 nhí mµn h×nh ®−îc chia thµnh 4 khèi mçi khèi (Block) 8 Kb ®Ó ch÷a font cña mçi tËp ký tù ë chÕ ®é v¨n b¶n cña VGA ®é nhí mµn h×nh cho phÐp n¹p s½n 8 bé font. §iÒu ®ã cã nghÜa lµ bé nhí mµn h×nh ®−îc chia thµnh 8 khèi (block) mçi khèi 8 Kb ®Ó l−u tr÷ 8 bé font ë mçi thêi ®iÓm cña EGA, VGA chØ cho phÐp kÝch ho¹t (active) hai bé font cïng mét lóc nghÜa lµ ë mét thêi ®iÓm chØ cã 2 bé font ®−îc ®em ra sö dông ë chÕ ®é v¨n b¶n c¸c bitplane 0 vµ bit plane 1 ®−îc sö dông ®Ó chøa d÷ liÖu vÒ tËp c¸c ký tù bit plane 0 ®−îc chia thµnh 4 hoÆc 8 khèi ®Ó chøa c¸c bé font bit plane 1 dïng ®Ó chøa thuéc tÝnh cña ký tù §Ó x¸c ®Þnh ®Þa chØ b¾t ®Çu khu«n cña ký tù trong mét font ta cã thÓ tÝnh theo nguyªn t¾c: character shape.addresso=font base address + (character code
  4. Kü thuËt §å ho¹ m¸y tÝnh 10 load user character set text 11 load ROM 9x14 set text (monochome) 12 load ROM 8x8 set text (color) 14 load ROM 8x16 set text 20 load USER 8x8 set 21 load USE Set graphics 22 load ROM 8x14 set graphics 23 load ROM 8x8 set graphics (color) 24 load ROM 8x16 set graphics (only VGA) 30 Retur font information graphics (only VGA) Trong m¸y tÝnh cã mét sè tËp font ®· chøa s½n trong BIOS ROM khi m¸y tÝnh khëi ®éng tuú thuéc vµo mode ho¹t ®éng nã sÏ l¹i tù ®éng n¹p s½n (Resident) vµo trong bé nhí mµn h×nh. D−íi ®©y lµ b¶ng c¸c font chuÈn (Default font) ®−îc sö dông ë c¸c mode ë chÕ ®é text: mode character box size color 4,5 8x8 color 6 8x8 monox color D,E 8x8 color F 8x14 mono/color 10 8x14 color 11 8x16 (VGA) mono/color 12 8x16 (VGA) color 13 8x8 (VGA) color ë chÕ ®é graphics dïng c¸c font chuÈn sau: Mode character box size color 0,1 8x8 color 0,1 8x14 color 0,1 9x16 (VGA) color 2,3 8x8 color 97
  5. Kü thuËt §å ho¹ m¸y tÝnh 2,3 8x14 color 2,3 9x16 (VGA) color 7 9x14 mono/color 7 9x16 (VGA) mono/color Chó ý: §Ó ®æi tõ mode nµy sang mode kh¸c ta sö dông ng¾t sè 10h, víi dÞch vô ng¾t 0, cô thÓ: Int=10h AH=$00 AL=Sè hiÖu Mode bit sè 7 trong thanh ghi AL cã vai trß ®Æc biÖt nÕu nã cã gi¸ trÞ 0 gi¶i phãng bé nhí mµn h×nh khi ®æi mode, nÕu cã gi¸ trÞ 1 kh«ng gi¶i phãng nhí mµn h×nh khi ®æi mode VÝ dô: int=$10 AH=$00 AL=$03 §æi mode 3 kh«ng gi¶i phãng mµn h×nh 2. Tõ mode text sang mode graphic bé nhí mµn h×nh lu«n lu«n ®−îc gi¶i phãng + HiÓn thÞ ký tù trong chÕ ®é graphics ë chÕ ®é ®å ho¹ bé nhí mµn h×nh kh«ng ®−îc sö dông ®Ó chøa c¸c bé font ký tù nh− trong chÕ ®é v¨n b¶n, c¸c bit plane ®−îc sö dông ®Ó l−u tr÷ d÷ liÖu cña c¸c ®iÓm ¶nh (pixel) v× vËy tËp c¸c font ch÷ ë chÕ ®é ®å ho¹ ®−îc ®Ó ë RAM khi hiÖn lªn mµn h×nh nã thùc hiÖn ®äc c¸c mÉu ký tù vµo c¸c bit plane nh− c¸c ¶nh. Chóng ta cã thÓ sö dông c¸c ch−¬ng tr×nh truy nhËp bé nhí mµn h×nh ë chÕ ®é ®å ho¹ ®Ó ®−a c¸c ký tù tõ bé nhí vµo bé nhí mµn h×nh Ch¼ng h¹n: Gi¶ sö ta cã tËp font ®Ó ë RAM font cã kÝch th−íc 8x14=112 byte khi ®ã ta sÏ thùc hiÖn c¸c phÐp ®äc mét ¶nh vµo vÞ trÝ (x,y) nµo ®ã cã kÝch th−íc ¶nh 12 byte §Ó kÕt thóc phÇn nµy chóng ta h·y lµm quen víi mét sè dÞch vô ng¾t liªn quan ®Õn tËp font cña c¸c ký tù VÝ dô 1 Ch−¬ng tr×nh ®äc font ch÷ lËp b»ng TURBO PASCAL: Program Chuong_trinh_doc_font; Uses Crt,Dos; Var i,j:integer; Chon:char; TGAL:Byte; 98
  6. Kü thuËt §å ho¹ m¸y tÝnh dem:integer; fnt : Array[1..256*16] of Byte; Procedure Menu; Begin TextColor(RED); TextColor(YELLOW); Writeln(' º CHUONG TRINH DOC FONT º'); Writeln(' SU DUNG CO NGAT CUA ROMBIOS º'); Writeln(' º 1. AL=0 Tai font chu cua NSD º'); Writeln(' º 2. AL=1 Tai fon chu 8x14 cua ROM º'); Writeln(' º 3. AL=2 Tai fon chu 8x8 cua ROM º'); Writeln(' º 4. AL=4 Tai font chu 8x16 cua ROM (VGA) º'); Writeln(' º 5. Q q X x Tro ve chuong trinh º'); TextColor(WHITE); Writeln; Write(' Ban chon so may : '); end; {*********************************************************} Procedure Load_font; Var R:Registers; sm,os,i : Word; Begin R.ah:=$11; R.al:=TGAL; R.bl:=0; R.cx:=256; R.dx:=33; intr($10,R); End; {*********************************************************} Procedure Tra_ve_font_ban_dau; Var R:Registers; Begin R.ah:=$11; R.al:=4; R.bl:=0; intr($10,R); End; {*********************************************************} Begin Repeat Clrscr; Menu; Chon:=ReadKey; Writeln(chon); 99
  7. Kü thuËt §å ho¹ m¸y tÝnh Case chon of '1' : TGAL:=0; '2' : TGAL:=1; '3' : TGAL:=2; '4' : TGAL:=4; '5','q','Q','X','x': Exit; End; clrscr; Load_font; dem:=0; for i:=33 to 255 do begin Write(' ',chr(i)); inc(dem); if dem mod 20 = 0 then begin Writeln; Writeln; end; end; Readln; Tra_ve_font_ban_dau; Until Pos(chon,'5qQXx')>0; End. VÝ dô 2 §−a tÖp font VGA 8x16 cña ng−êi sö dông vµo ho¹t ®éng ë chÕ ®é v¨n b¶n vµ ®å ho¹, ch−¬ng tr×nh ®−îc lËp b»ng TURBO PASCAL cã sö dông UNIT : a. TÖp UNIT : FONTVN.PAS UNIT FontVN; INTERFACE Procedure Load_Graph_Font; Procedure Load_Text_Font; Procedure UnLoadFont; Function Vn(S : String) : String; Procedure Out_Text(st : string); procedure Sch_Repl(Var S : String; Sch, Repl : String); (*************************************************) IMPLEMENTATION Uses Crt,Graph, Dos; Type Font = Array[1..256*16] of Byte; Const Fnt : Font=( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,126,129,165,129,129,189,153,129,129,126, 0, 0, 0, 0, 0, 0,126,255,219,255,255,195,231,255,255,126, 0, 0, 0, 0, 100
  8. Kü thuËt §å ho¹ m¸y tÝnh 0, 0, 0, 0,108,254,254,254,254,124, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 56,124,254,124, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, 24, 60, 60,231,231,231,153, 24, 60, 0, 0, 0, 0, 0, 0, 0, 24, 60,126,255,255,126, 24, 24, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 60, 60, 24, 0, 0, 0, 0, 0, 0, 255,255,255,255,255,255,231,195,195,231,255,255,255,255,255,255, 0, 0, 0, 0, 0, 60,102, 66, 66,102, 60, 0, 0, 0, 0, 0, 255,255,255,255,255,195,153,189,189,153,195,255,255,255,255,255, 0, 0, 30, 14, 26, 50,120,204,204,204,204,120, 0, 0, 0, 0, 0, 0, 60,102,102,102,102, 60, 24,126, 24, 24, 0, 0, 0, 0, 0, 0, 63, 51, 63, 48, 48, 48, 48,112,240,224, 0, 0, 0, 0, 0, 0,127, 99,127, 99, 99, 99, 99,103,231,230,192, 0, 0, 0, 0, 0, 0, 24, 24,219, 60,231, 60,219, 24, 24, 0, 0, 0, 0, 0,128,192,224,240,248,254,248,240,224,192,128, 0, 0, 0, 0, 0, 2, 6, 14, 30, 62,254, 62, 30, 14, 6, 2, 0, 0, 0, 0, 0, 0, 24, 60,126, 24, 24, 24, 24,126, 60, 24, 0, 0, 0, 0, 0, 0,102,102,102,102,102,102,102, 0,102,102, 0, 0, 0, 0, 0, 0,127,219,219,219,123, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0,124,198, 96, 56,108,198,198,108, 56, 12,198,124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,254,254,254, 0, 0, 0, 0, 0, 0, 24, 60,126, 24, 24, 24, 24,126, 60, 24,126, 0, 0, 0, 0, 0, 24, 60,126, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24,126, 60, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 12,254, 12, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 96,254, 96, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,192,192,192,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40,108,254,108, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 56, 56,124,124,254,254, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,254,124,124, 56, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 60, 60, 60, 24, 24, 24, 0, 24, 24, 0, 0, 0, 0, 0,102,102,102, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,108,108,254,108,108,108,254,108,108, 0, 0, 0, 0, 24, 24,124,198,194,192,124, 6,134,198,124, 24, 24, 0, 0, 0, 0, 0, 0, 0,194,198, 12, 24, 48, 96,198,134, 0, 0, 0, 0, 0, 0, 56,108,108, 56,118,220,204,204,204,118, 0, 0, 0, 0, 0, 48, 48, 48, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 24, 48, 48, 48, 48, 48, 48, 24, 12, 0, 0, 0, 0, 0, 0, 48, 24, 12, 12, 12, 12, 12, 12, 24, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,102, 60,255, 60,102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24,126, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 12, 24, 48, 96,192,128, 0, 0, 0, 0, 101
  9. Kü thuËt §å ho¹ m¸y tÝnh 0, 0,124,198,198,206,214,214,230,198,198,124, 0, 0, 0, 0, 0, 0, 24, 56,120, 24, 24, 24, 24, 24, 24,126, 0, 0, 0, 0, 0, 0,124,198, 6, 12, 24, 48, 96,192,198,254, 0, 0, 0, 0, 0, 0,124,198, 6, 6, 60, 6, 6, 6,198,124, 0, 0, 0, 0, 0, 0, 12, 28, 60,108,204,254, 12, 12, 12, 30, 0, 0, 0, 0, 0, 0,254,192,192,192,252, 14, 6, 6,198,124, 0, 0, 0, 0, 0, 0, 56, 96,192,192,252,198,198,198,198,124, 0, 0, 0, 0, 0, 0,254,198, 6, 6, 12, 24, 48, 48, 48, 48, 0, 0, 0, 0, 0, 0,124,198,198,198,124,198,198,198,198,124, 0, 0, 0, 0, 0, 0,124,198,198,198,126, 6, 6, 6, 12,120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 24, 24, 48, 0, 0, 0, 0, 0, 0, 6, 12, 24, 48, 96, 48, 24, 12, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254, 0, 0,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 48, 24, 12, 6, 12, 24, 48, 96, 0, 0, 0, 0, 0, 0,124,198,198, 12, 24, 24, 24, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0,124,198,198,222,222,222,220,192,124, 0, 0, 0, 0, 0, 0, 16, 56,108,198,198,254,198,198,198,198, 0, 0, 0, 0, 0, 0,252,102,102,102,124,102,102,102,102,252, 0, 0, 0, 0, 0, 0, 60,102,194,192,192,192,192,194,102, 60, 0, 0, 0, 0, 0, 0,248,108,102,102,102,102,102,102,108,248, 0, 0, 0, 0, 0, 0,254,102, 98,104,120,104, 96, 98,102,254, 0, 0, 0, 0, 0, 0,254,102, 98,104,120,104, 96, 96, 96,240, 0, 0, 0, 0, 0, 0, 60,102,194,192,192,222,198,198,102, 58, 0, 0, 0, 0, 0, 0,198,198,198,198,254,198,198,198,198,198, 0, 0, 0, 0, 0, 0, 60, 24, 24, 24, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0, 30, 12, 12, 12, 12, 12,204,204,204,120, 0, 0, 0, 0, 0, 0,230,102,108,108,120,120,108,102,102,230, 0, 0, 0, 0, 0, 0,240, 96, 96, 96, 96, 96, 96, 98,102,254, 0, 0, 0, 0, 0, 0,198,238,254,254,214,198,198,198,198,198, 0, 0, 0, 0, 0, 0,198,230,246,254,222,206,198,198,198,198, 0, 0, 0, 0, 0, 0, 56,108,198,198,198,198,198,198,108, 56, 0, 0, 0, 0, 0, 0,252,102,102,102,124, 96, 96, 96, 96,240, 0, 0, 0, 0, 0, 0,124,198,198,198,198,198,198,214,222,124, 12, 14, 0, 0, 0, 0,252,102,102,102,124,108,102,102,102,230, 0, 0, 0, 0, 0, 0,124,198,198, 96, 56, 12, 6,198,198,124, 0, 0, 0, 0, 0, 0,126,126, 90, 24, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0,198,198,198,198,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0,198,198,198,198,198,198,198,108, 56, 16, 0, 0, 0, 0, 0, 0,198,198,198,198,198,214,214,254,108,108, 0, 0, 0, 0, 0, 0,198,198,108,108, 56, 56,108,108,198,198, 0, 0, 0, 0, 0, 0,102,102,102,102, 60, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0,254,198,134, 12, 24, 48, 96,194,198,254, 0, 0, 0, 0, 0, 0, 60, 48, 48, 48, 48, 48, 48, 48, 48, 60, 0, 0, 0, 0, 0, 0, 0,128,192,224,112, 56, 28, 14, 6, 2, 0, 0, 0, 0, 102
  10. Kü thuËt §å ho¹ m¸y tÝnh 0, 0, 60, 12, 12, 12, 12, 12, 12, 12, 12, 60, 0, 0, 0, 0, 16, 56,108,198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0, 0, 48, 48, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0,224, 96, 96,120,108,102,102,102,102,220, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198,192,192,192,198,124, 0, 0, 0, 0, 0, 0, 28, 12, 12, 60,108,204,204,204,204,118, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 0, 56,108,100, 96,240, 96, 96, 96, 96,240, 0, 0, 0, 0, 0, 0, 0, 0, 0,118,204,204,204,204,204,124, 12,204,120, 0, 0, 0,224, 96, 96,108,118,102,102,102,102,230, 0, 0, 0, 0, 0, 0, 24, 24, 0, 56, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0, 6, 6, 0, 14, 6, 6, 6, 6, 6, 6,102,102, 60, 0, 0, 0,224, 96, 96,102,108,120,120,108,102,230, 0, 0, 0, 0, 0, 0, 56, 24, 24, 24, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0,236,254,214,214,214,214,214, 0, 0, 0, 0, 0, 0, 0, 0, 0,220,102,102,102,102,102,102, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0, 0, 0, 0,220,102,102,102,102,102,124, 96, 96,240, 0, 0, 0, 0, 0, 0,118,204,204,204,204,204,124, 12, 12, 30, 0, 0, 0, 0, 0, 0,220,118, 98, 96, 96, 96,240, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198, 96, 56, 12,198,124, 0, 0, 0, 0, 0, 0, 16, 48, 48,252, 48, 48, 48, 48, 54, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,204,204,204,204,204,204,118, 0, 0, 0, 0, 0, 0, 0, 0, 0,102,102,102,102,102, 60, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,198,198,214,214,254,108, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,108, 56, 56, 56,108,198, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,198,198,198,198,198,126, 6, 12,248, 0, 0, 0, 0, 0, 0,254,204, 24, 48, 96,198,254, 0, 0, 0, 0, 0, 0, 14, 24, 24, 24,112, 24, 24, 24, 24, 14, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 0, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0,112, 24, 24, 24, 14, 24, 24, 24, 24,112, 0, 0, 0, 0, 0, 0,118,220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 56,108,198,198,198,254, 0, 0, 0, 0, 0, 0, 0,108, 56, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 12, 24,108, 56, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 96, 48,108, 56, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 48, 16,108, 56, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 20, 40,108, 56, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0,108, 56, 0,120, 12,124,204,204,204,118, 0, 48, 48, 0, 0, 0, 56,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 6, 12, 56,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 192, 96, 56,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 28, 4, 56,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 103
  11. Kü thuËt §å ho¹ m¸y tÝnh 54,108, 56,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0, 56,108, 0,120, 12,124,204,204,204,118, 0, 48, 48, 0, 0, 0, 56,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 6, 12, 56,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 192, 96, 56,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 28, 4, 56,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 54,108, 56,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 0, 56,108, 0,124,198,254,192,192,198,124, 0, 48, 48, 0, 0, 0, 0, 6, 2,126,198,198,198,198,198,124, 0, 0, 0, 0, 0, 12, 24, 6, 2,126,198,198,198,198,198,124, 0, 0, 0, 0, 0, 96, 48, 6, 2,126,198,198,198,198,198,124, 0, 0, 0, 0, 0, 56, 8, 22, 2,126,198,198,198,198,198,124, 0, 0, 0, 0, 0, 54,108, 6, 2,126,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0, 0, 6, 2,126,198,198,198,198,198,124, 0, 48, 48, 0, 0, 0, 56,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 6, 12, 56,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 192, 96, 56,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 14, 2, 60,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 54,108, 56,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0, 56,108, 0,124,198,198,198,198,198,124, 0, 48, 48, 0, 0, 0, 0, 6, 2,206,204,204,204,204,204,118, 0, 0, 0, 0, 0, 12, 24, 6, 2,206,204,204,204,204,204,118, 0, 0, 0, 0, 0, 96, 48, 6, 2,206,204,204,204,204,204,118, 0, 0, 0, 0, 0, 56, 8, 22, 2,206,204,204,204,204,204,118, 0, 0, 0, 0, 0, 54,108, 6, 2,206,204,204,204,204,204,118, 0, 0, 0, 0, 0, 0, 0, 6, 2,206,204,204,204,204,204,118, 0, 48, 48, 0, 0, 0, 12, 24, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0, 96, 48, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 56, 8, 16, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0, 54,108, 0,120, 12,124,204,204,204,118, 0, 0, 0, 0, 0, 0, 0, 0, 0,120, 12,124,204,204,204,118, 0, 48, 48, 0, 0, 0, 12, 24, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 0, 96, 48, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 56, 8, 16, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 0, 54,108, 0,124,198,254,192,192,198,124, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198,254,192,192,198,124, 0, 48, 48, 0, 0, 0, 12, 24, 0, 56, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0, 48, 24, 0, 56, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 17, 68, 17, 68, 17, 68, 17, 68, 17, 68, 17, 68, 17, 68, 17, 68, 85,170, 85,170, 85,170, 85,170, 85,170, 85,170, 85,170, 85,170, 221,119,221,119,221,119,221,119,221,119,221,119,221,119,221,119, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,248, 24, 24, 24, 24, 24, 24, 24, 24, 0, 56, 8, 16, 0, 56, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 0, 0, 54,108, 0, 56, 24, 24, 24, 24, 24, 60, 0, 0, 0, 0, 104
  12. Kü thuËt §å ho¹ m¸y tÝnh 0, 0, 24, 24, 0, 56, 24, 24, 24, 24, 24, 60, 0, 24, 24, 0, 0, 0, 12, 24, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 54, 54, 54, 54, 54,246, 6,246, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 0, 0, 0, 0, 0,254, 6,246, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,246, 6,254, 0, 0, 0, 0, 0, 0, 0, 0, 54, 54, 54, 54, 54, 54, 54,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 48, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,248, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 31, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 31, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24,255, 24, 24, 24, 24, 24, 24, 24, 24, 0, 56, 8, 16, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 0, 0, 54,108, 0,124,198,198,198,198,198,124, 0, 0, 0, 0, 54, 54, 54, 54, 54, 55, 48, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 48, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,247, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0,247, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 48, 55, 54, 54, 54, 54, 54, 54, 54, 54, 0, 0, 0, 0, 0,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 54, 54, 54, 54, 54,247, 0,247, 54, 54, 54, 54, 54, 54, 54, 54, 24, 24, 24, 24, 24,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,198,198,198,198,198,124, 0, 48, 48, 0, 0, 0, 0, 0, 0,255, 0,255, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 12, 24, 0,204,204,204,204,204,204,118, 0, 0, 0, 0, 0, 0, 96, 48, 0,204,204,204,204,204,204,118, 0, 0, 0, 0, 0, 56, 8, 16, 0,204,204,204,204,204,204,118, 0, 0, 0, 0, 0, 0,108,216, 0,204,204,204,204,204,204,118, 0, 0, 0, 0, 0, 0, 0, 0, 0,204,204,204,204,204,204,118, 0, 48, 48, 0, 0, 0, 12, 24, 0,198,198,198,198,198,198,126, 6, 12,248, 0, 0, 0, 96, 48, 0,198,198,198,198,198,198,126, 6, 12,248, 0, 24, 24, 24, 24, 24, 24, 24,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 24, 24, 24, 24, 24, 24, 24, 24, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255, 0, 0, 56, 8, 16,198,198,198,198,198,198,126, 6, 12,248, 0, 0, 0, 54,108, 0,198,198,198,198,198,198,126, 6, 12,248, 0, 255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118,220,216,216,216,220,118, 0, 0, 0, 0, 0, 0, 0, 0,120,204,216,204,198,198,198,204,192,192, 0, 0, 0, 0, 0,254,198,198,192,192,192,192,192,192, 0, 0, 0, 0, 0, 0, 0, 0,128,254,108,108,108,108,108,108, 0, 0, 0, 0, 105
  13. Kü thuËt §å ho¹ m¸y tÝnh 0, 0, 0,254,198, 96, 48, 24, 48, 96,198,254, 0, 0, 0, 0, 0, 0, 0, 0, 0,126,216,216,216,216,216,112, 0, 0, 0, 0, 0, 0, 0, 0,102,102,102,102,102,124, 96, 96,192, 0, 0, 0, 0, 0, 0, 0,118,220, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0,126, 24, 60,102,102,102, 60, 24,126, 0, 0, 0, 0, 0, 0, 0, 56,108,198,198,254,198,198,108, 56, 0, 0, 0, 0, 0, 0, 56,108,198,198,198,108,108,108,108,238, 0, 0, 0, 0, 0, 0, 30, 48, 24, 12, 62,102,102,102,102, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0,126,219,219,219,126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6,126,207,219,243,126, 96,192, 0, 0, 0, 0, 0, 0, 28, 48, 96, 96,124, 96, 96, 96, 48, 28, 0, 0, 0, 0, 0, 0, 0,124,198,198,198,198,198,198,198,198, 0, 0, 0, 0, 0, 0, 0, 0,254, 0, 0,254, 0, 0,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24,126, 24, 24, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 48, 24, 12, 6, 12, 24, 48, 0,126, 0, 0, 0, 0, 0, 0, 0, 12, 24, 48, 96, 48, 24, 12, 0,126, 0, 0, 0, 0, 0, 0, 14, 27, 27, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,216,216,216,112, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0,126, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118,220, 0,118,220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,198,198,198,198,198,126, 6, 12,248, 24, 0, 0, 12, 30, 12, 60,108,204,204,204,204,118, 0, 0, 0, 0, 0, 0,248,108,102,102,246,102,102,102,108,248, 0, 0, 0, 0, 0, 15, 12, 12, 12, 12, 12,236,108,108, 60, 28, 0, 0, 0, 0, 0,216,108,108,108,108,108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,112,152, 48, 96,200,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,124,124,124,124,124,124,124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); (*************************************************) var R : Registers; (*************************************************) Procedure Out_Text(st : string); Var C16 : Array[1..16] Of Byte; x,y,n,i,ofset,l,j : integer; ch1 : Char; Begin l:=length(st); For j:=1 To l Do Begin ch1:=st[j]; n:=Ord(ch1); x:=GetX; y:=GetY; 106
  14. Kü thuËt §å ho¹ m¸y tÝnh ofset:=80*y+(x div 8); For i:=1 To 16 Do Begin C16[i]:=Fnt[16*n+i]; ofset:=80*(y+i-1)+(x div 8); Mem[$A000:ofset]:=C16[i]; End; x:=x+8; if x>632 Then Begin x:=0; y:=y+19; End; moveto(x,y); End; End; (*************************************************) Procedure Sch_Repl; Var i, j : Byte; Begin j := 0; Repeat i := Pos(Sch, S); If i > 0 then Begin Delete(S, i, Length(Sch)); Insert(Repl, S, i); j := j + 1; End; Until (i = 0); End; (*************************************************) Procedure Load_Graph_Font; Begin R.AX := $1121; R.CX := 16; R.BL := 0; R.DL :=Round(480/R.CX); R.ES := Seg(Fnt); R.BP := Ofs(Fnt); Intr($10, R); End; (*************************************************) Procedure Load_Text_Font; 107
  15. Kü thuËt §å ho¹ m¸y tÝnh Begin R.AX := $1100; R.CX := 256; R.DX := 0; R.BH := 16; R.ES := Seg(Fnt); R.BP := Ofs(Fnt); Intr($10, R); End; (*************************************************) Procedure UnLoadFont; Begin R.AH := $11; R.AL := $24; R.BL := 30; Intr($10, R); End; (******************** VnString Function *******************) Function Vn(S : String) : String; Begin Sch_Repl(S, 'aw', chr(128)); Sch_Repl(S, chr(128)+'s', chr(129)); Sch_Repl(S, chr(128)+'f', chr(130)); Sch_Repl(S, chr(128)+'r', chr(131)); Sch_Repl(S, chr(128)+'x', chr(132)); Sch_Repl(S, chr(128)+'j', chr(133)); Sch_Repl(S, 'aa', chr(134)); Sch_Repl(S, chr(134)+'s', chr(135)); Sch_Repl(S, chr(134)+'f', chr(136)); Sch_Repl(S, chr(134)+'r', chr(137)); Sch_Repl(S, chr(134)+'x', chr(138)); Sch_Repl(S, chr(134)+'j', chr(139)); Sch_Repl(S, 'ee', chr(140)); Sch_Repl(S, chr(140)+'s', chr(141)); Sch_Repl(S, chr(140)+'f', chr(142)); Sch_Repl(S, chr(140)+'r', chr(143)); Sch_Repl(S, chr(140)+'x', chr(144)); Sch_Repl(S, chr(140)+'j', chr(145)); Sch_Repl(S, 'ow', chr(146)); Sch_Repl(S, chr(146)+'s', chr(147)); Sch_Repl(S, chr(146)+'f', chr(148)); Sch_Repl(S, chr(146)+'r', chr(149)); Sch_Repl(S, chr(146)+'x', chr(150)); Sch_Repl(S, chr(146)+'j', chr(151)); Sch_Repl(S, 'oo', chr(152)); 108
  16. Kü thuËt §å ho¹ m¸y tÝnh Sch_Repl(S, chr(152)+'s', chr(153)); Sch_Repl(S, chr(152)+'f', chr(154)); Sch_Repl(S, chr(152)+'r', chr(155)); Sch_Repl(S, chr(152)+'x', chr(156)); Sch_Repl(S, chr(152)+'j', chr(157)); Sch_Repl(S, 'uw', chr(158)); Sch_Repl(S, 'w', chr(158)); Sch_Repl(S, chr(158)+'s', chr(159)); Sch_Repl(S, chr(158)+'f', chr(160)); Sch_Repl(S, chr(158)+'r', chr(161)); Sch_Repl(S, chr(158)+'x', chr(162)); Sch_Repl(S, chr(158)+'j', chr(163)); Sch_Repl(S, 'as', chr(164)); Sch_Repl(S, 'af', chr(165)); Sch_Repl(S, 'ar', chr(166)); Sch_Repl(S, 'ax', chr(167)); Sch_Repl(S, 'aj', chr(168)); Sch_Repl(S, 'es', chr(169)); Sch_Repl(S, 'ef', chr(170)); Sch_Repl(S, 'er', chr(171)); Sch_Repl(S, 'ex', chr(172)); Sch_Repl(S, 'ej', chr(173)); Sch_Repl(S, 'is', chr(174)); Sch_Repl(S, 'if', chr(175)); Sch_Repl(S, 'ir', chr(181)); Sch_Repl(S, 'ix', chr(182)); Sch_Repl(S, 'ij', chr(183)); Sch_Repl(S, 'os', chr(184)); Sch_Repl(S, 'of', chr(190)); Sch_Repl(S, 'or', chr(198)); Sch_Repl(S, 'ox', chr(199)); Sch_Repl(S, 'oj', chr(208)); Sch_Repl(S, 'us', chr(210)); Sch_Repl(S, 'uf', chr(211)); Sch_Repl(S, 'ur', chr(212)); Sch_Repl(S, 'ux', chr(213)); Sch_Repl(S, 'uj', chr(214)); Sch_Repl(S, 'ys', chr(215)); Sch_Repl(S, 'yf', chr(216)); Sch_Repl(S, 'yr', chr(221)); Sch_Repl(S, 'yx', chr(222)); Sch_Repl(S, 'yj', chr(248)); Sch_Repl(S, 'dd', chr(249)); Sch_Repl(S, 'DD', chr(250)); Sch_Repl(S, '~', ''); 109
  17. Kü thuËt §å ho¹ m¸y tÝnh Vn := S; End; END. b. TÖp Ch−¬ng tr×nh : chu_viet.PAS Program Chu_viet; Uses Crt,Graph,FontVN; Var gd,gm,i: integer; st : String; Begin Clrscr; st:=VN('Xin chafo casc bajn ! '); Load_Text_Font; writeln(st); Readln; gd:=0; initgraph(gd,gm,' '); Load_Graph_font; directvideo:=False; writeln(st); moveto(0,240); Out_Text(st); Readln; closegraph; Load_Text_Font; for i:=0 to 255 do write(chr(i):4); readln; UnLoadfont; End. 110
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2