Similar documents
2 PostScript PostScript (token) 437 == 437 == PostScript PostScript 437 == PostScript (operator) 437 == == ==

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

Bar-Code_GUIDE

バーコードプリントガイド

¥ƥ­¥¹¥ȥ¨¥ǥ£¥¿¤λȤ¤˽

基礎情報処理 I (文字型)

コンピュータグラフィックス - 第4回 色彩の表現

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

PPS40511.PDF

データロジックスキャニング株式会社

10

H02_ROM_ indd

untitled

PR300 電力モニタ 通信インタフェース (RS-485通信,Ethernet通信)

gs-cjk project gs: Ghostscript PostScript/PDF AFPL Ghostscript GNU Ghostscript c: Chinese j: Japanese k: Korean gs-cjk: A

DS-3300 プログラミングマニュアル 設定項目 ページ 初期値設定マップ 1-2 ファームウェアバージョン情報 2 システム設定 3 読取機能設定 4 インターフェース設定 5 バーコード規格別読取設定 6-7 チェックデジット設定 8 読取桁数設定 9 キャラクタ付加設定 10 数字バーコード

A-GAGE High - Resolution MINI ARRAY Instruction Manual Printed in Japan J20005M

MS240 JISⅡ半角カナ文字データを含むカード読み取り設定例

4 Mule(Emacs)

EPSON PS Tools HTMLヘルプ <Macintosh版>

専門基礎11(情報の表現)

~/WWW-local/compIID (WWW IID ) $ mkdir WWW-local $ cd WWW-local $ mkdir compiid 3. Emacs index.html n (a) $ cd ~/WWW/compIID

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

Microsoft Word - 5J0080_EAN-128MenuBook_v023.doc


6 Tgif William Chia-Wei Chang tgif 3.0 pixmap URL Tgif 6.1: Tgif

WelcomeToPS_Finish

World Wide Web =WWW Web ipad Web Web HTML hyper text markup language CSS cascading style sheet Web Web HTML CSS HTML

第一章 系统讯息

johokiso-graphics

EPSON GT-9700F ユーザーズガイド

データフォーマットの設定例 Ver.F

Adobe Postscript 3 Expansion Unit

r7.dvi

型番 USB :F830-U RS232C:F830-R 組込み式 2 次元コードリーダー F830 詳細設定マニュアル Ver1.0 1


ch31.dvi

ように記述をします div1 要素 span 要素 2 個 div3 要素 span 要素 4 個 div5 要素 span 要素 1 個 div7 要素 span 要素 2 個 div2 要素 span 要素 1 個 div4 要素 span 要素 2 個 div6 要素 span 要素 2 個

untitled

Garment Creator

EPSON GT-7200/8200U ユーザーズガイド

5 LATEX 2ε 2010

Barcode Setup Manual

G-XML

1 1 2 Unix SVG SVG SVG SVG

SVG資料第6回目(その3) SVGとHTMLの間でデータを交換する

2 n ImageJ (intensity) ImageJ Bit

(Visual Secret Sharing Scheme) VSSS VSSS 3 i

EPSON PX-V500 プリンタ操作ガイド

QuickScan L Bar Code Scanner スキャナ設定ガイド

4-1. html css html ht tp ht tp html HyperTex t Markup Language: html <meta ht tp - equiv="content-type" content=" tex t /html; charset=utf-

TitleWeb における画像とテキストの融合 Author(s) 安岡, 孝一 Citation (2003): 1-12 Issue Date URL Right Type Conference Paper

Barcode Setup Manual

EPSON PM-G700プリンタ操作ガイド

PM-A850 スキャナ操作ガイド(Windows編)

Adobe Postscript 3 Expansion Unit

1 1.1 PC PC PC PC PC workstation PC hardsoft PC PC CPU 1 Gustavb, Wikimedia Commons.


コマンドリファレンスREV14.PDF

2 TEX, TEX Donald Knuth 2 3 ( ) TEX ( ) , WWW 4 TEX (.tex,.dvi,.ps,.pdf ) 3 TEX ( ) ( ) 5 (.tex Windows, Mac, Unix, MS-DOS TEX TEX ( ) & METAFON

ohp1.dvi

PM-A850 プリンタ操作ガイド(Windows編)

101NEO資料

untitled

文字コードとその実装

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

掲示用ヒート表 第34回 藤沢市長杯 2017

Z D

EPSON PX-500 プリンタ操作ガイド

6 2 s µ µµµ µµµµ µ µ h µs µ µµµµ µ µ µ s mµµµµµ µµµ µµ µ u m µmµµµµµ µµ µ µ µ µ µ µ µ µ s 1

Jlspec

tottori2013-print.key

Epson Edge Print

H02_ROM_ indd


データロジックスキャニング株式会社

Microsoft Word - SP605取扱説明書1_0a.doc

r1.dvi

untitled

Q&A集

kbd_reference.ps

EPSON GT-9800F ユーザーズガイド 

title_PoD

★結果★ 藤沢市長杯 掲示用ヒート表

Adobe Bridge Bridge Bridge Bridge P10 Bridge Finder 2

MYWORDⅤ Pro 操作マニュアル

コンパイラ

2 BASIC DATA DATA DATA DATA Data BASIC tbasic 1 File OS OS *2 (0, 1) OS 0,1 0,1 *2 USB OS


Essential Guide for Graphic Users

橡J_ptvr_common.PDF

08+11Extra

6 2 1

BIT -2-

EPSON GT-7400U ユーザーズガイド

ORCA (Online Research Control system Architecture)


EPSON GT-9800F ユーザーズガイド

Welch Allyn Data Collection Inc., All rights reserved.

MovingTextsAnime1 の説明 HTML の記述 (MovingTextsAnime1.html) id 属性 stage の div 要素 ( アニメーションが動くステージ ) を作り その中にボックスやテキストを記述します id 属性 div1 のdiv 要素から id 属性 div

Transcription:

April, 2008

iii v 1 1 1.1.................................. 1 1.2 3.............................. 3 1.3 3.......................... 3 1.4................................... 4 1.5 HSV/HSB........................ 5 1.6........................... 6 1.7 GIMP..................... 7 2 9 2.1.................... 9 2.2.......................... 12 3 17 3.1.......................... 20 3.2................... 24 3.3................... 30 3.4............................ 35 3.5.......................... 39 3.6............................. 41 3.7.................... 45 3.8........................... 47 4 Postscript 51 4.1 Postscript............................ 51 4.2............................ 53

iv 4.3 Postscript............................. 55 4.4........................... 57 4.5............................... 60 4.6.................... 62

v Postscript

1 1 1.1 370 nm 700 nm *1 A Red, Green, Blue 3 3 1.1 1.1 3 3 3 3 3 *2 *1 1 nm = 100 1 mm *2 3 2

2 1 R G 20 1 500 1 X X 1 X 10 1 Y 2 Y 4

1.2 3 3 1.2 3 3 Red( ), Green( ), Blue( ) 3 RGB Cyan( ), Magenta( ), Yellow( ) 3 (CMY) (K) CMYK 4 1.2 R Y M G C B R, G, B C. M, Y 1.3 3 R, G, B 3 C, M, Y Y = R + G C = G + B M = B + R R, G, B C, M. Y 3 Cyan (W) R Magenta G Yellow B Cyan Magenta R G B C, M, Y

4 1 White W, Black K *3 W, K ( 1.2) W = R + G + B K = 0 1.4 3 3 R, G, B 0 1 1.3 (Color Space) (1,0,0) R 1.3 B (0,0,1) K (0,0,0) G (0,1,0) RGB 1 1 1.3 C, M, Y, W *3 Blue B

1.5 HSV/HSB 5 1.5 HSV/HSB RGB CMY(K) 3 (Hue) (Saturation) (Value, Brightness) HSV HSB HSB B RGB B HSV HSV *4 1.4 12 12 1.5.1 12 180 2 1.4 12 : *4 1

6 1 1.6 RGB CMYK RGB R,G,B 3 0 1 0 1 ( ) 2 16 0,1,2,..., 0 255 256 256 = 2 8 16 2 255 256 3 0(0), 1(1), 2(2),..., A(10), B(11), C(12), D(13), E(14), F(15), 10(16), 11(17),..., F9(249), FA(250)FB(251), FC(252), FD(253), FE(254), FF(255) 1.1 HTML #FF0000 3 16 1.1 16 Red (1, 0, 0) FF,00,00 Green (0, 1, 0) 00,FF,00 Blue (0, 0, 1) 00,00,FF Cyan (0, 1, 1) 00,FF,FF Magenta (1, 0, 1) FF,00,FF Yellow (1, 1, 0) FF,FF,00 White (1, 1, 1) FF,FF,FF Black (0, 0, 0) 00,00,00

1.7 GIMP 7 1.7 GIMP GIMP UNIX, Widows, Mac *5 GIMP 1.5 RGB HSV CMYK 1.5 GIMP : 360 *5 Adobe Photoshop

9 2 2.1 2.1.1 (raster) 525 1 24 2.1.2 2.1 (pixel) *1 R, G, B 3 2.1 ( ) 1 ( ) *1

10 2 2.1.3 4 : 3 PC 1024 768 1280 1024, 1600 1200 2.1.4 256 RGB 0 255 256 2 8 2 8 1 B *2 3 B 3 1024 768 786432 1 786432 3 = 2359296 B 1024 2304 KB 2.3 MB *3 2.1.5 ABC8ABC8ABC8ABC8ABC8ABC8ABC8ABC8ABC8ABC8 "ABC8" 4 10 *2 1 B 1 Byte( ) 2 1 bit( ) b *3

2.1 11 ABC8*0A *0A 0A (10 10 ) 40 7 *4 PNG, JPEG, GIF 3 2.1 JPEG, PNG GIF 2.1 3 PNG.png JPEG.jpg, jpeg GIF.gif 256 *4 JPEG JPEG

12 2 2.1.6 2.2 αξ *5 2.2 ( ) 2.2 2.2.1 α 2.3 *5 ξ x

2.2 13 αξ αξ αξ αξ 2.3 2.2.2 2.4 2.4 2.2.3 Postscript Adobe *6 Postscript *7 DTP *8 Postscript 2.5 4 *6 *7 Postscript PS post( ) (script) *8 Desk-Top Publishing.

14 2 %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 200 150 1 0.5 0 setrgbcolor 100 75 moveto 100 75 40 45 180 arc fill 0 0 0.8 setrgbcolor 10 10 moveto 190 10 lineto 190 140 lineto stroke /Times-Bold findfont 20 scalefont setfont 100 20 moveto (ABC) show 2.5 ABC Postscript *9 DTP Postscript 1985 Java SVG Adobe DTP Adobe Illustrator Photoshop GNU Ghostscript Postscript * 10 2.2.4 PDF, Portable Document Format PDF WWW PDF Adobe Postscript PDF OS * 11 *9 *10 1 Ghostscript Ghostscript *11 OS Windows

2.2 15

16 2 2.2.5 SVG SVG Scalable Vector Graphics Scalable scale SVG HTML XML W3C(http://www.w3c.org) XML MathML * 12 SVG * 13 HTML SVG Wikipedia <?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/tr/2001/rec-svg-20010904/dtd/svg10.dtd"> <svg xmlns="http://www.w3.org/2000/svg"> <style type="text/css"> circle:hover {fill-opacity:0.9;} </style> <g style="fill-opacity:0.7;"> <circle cx="6.5cm" cy="3.2cm" r="100" style="fill:red; stroke:black" /> <circle cx="4.6cm" cy="6.0cm" r="100" style="fill:blue; stroke:black" /> <circle cx="8.2cm" cy="6.0cm"r="100" style="fill:green; stroke:black" /> </g> </svg> 2.6 SVG : *12 SVG *13 rendering

17 3 Sourceforge netpbm project Netpbm *1 3.0.6 (Meadow/Emacs) feet.pbm P1 # feep.pbm 24 7 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 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 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 0 0 0 *1 http://netpbm.sourceforge.net/doc/

18 3 1. 24 0 a 0 0 0 0 4 b C-a c C-k d C-y 6 2. 7 a C-k C-k b C-y 7 3. INS (Ovwrt ) 4. 0 1 5. INS (Ovwrt ) 6. GIMP 3.1 feep.pbm 3.1 PBM

19 3.0.7 2 feep.pgm, feep.ppm GIMP 3.2,3.3 P2 # feep.pgm 24 7 15 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 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 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 0 0 0 P3 # feep.ppm 4 4 15 0 0 0 0 0 0 0 0 0 15 0 15 0 0 0 0 15 7 0 0 0 0 0 0 0 0 0 0 0 0 0 15 7 0 0 0 15 0 15 0 0 0 0 0 0 0 0 0 3.2 PGM 3.3 PPM

20 3 3.1 3.1.1 PBM PBM Portable Bit Map *2 18 feep.pbm 3 P1 # feep.pbm 24 7 P1 # feep.pbm # 24 7 3 (header) 4 24 7 168 0 1 0 1 *2 bit map 1 bit PBM

3.1 21 168 PBM 16 x 20 PBM 3.4 3.4 PBM 2 N N bit

22 3 3.1.2 PGM PGM Portable Gray Map PBM 2 19 feep.pgm P2 # feep.pgm 24 7 15 PGM P2 PBM 4 15 0 7, 11, 15 0 15 0 15 15 ( ) 15 0 15 16 16 = 2 4 16 1 0 15 16 0 F *3 0 15 PBM 0 1 *3 20 30 16 1 2 15 255

3.1 23 3.1.3 PPM PPM Portable Pixel Map 19 feep.ppm P3 # feep.ppm 4 4 15 P3 3 4 4 4 15 PGM 0 0 0 0 0 0 0 0 0 15 0 15 0 0 0 0 15 7 0 0 0 0 0 0 0 0 0 0 0 0 0 15 7 0 0 0 15 0 15 0 0 0 0 0 0 0 0 0 4 12 3 1 RGB *4 15 15 15 15 1.1 3 1 12 12 PGM 8 12 PPM *5 *4 3 1 1 *5

24 3 3.2 1024 1024 1 3 1 PPM 3.2.1 240 180 0 255 256 PPM 1. PPM P3 2. # 3. 240 180 4. 255 0 0 240 180 # ppm001.rb puts "P3" puts "# PPM test" puts "240 180" puts "255" for i in 0.. 239 for j in 0.. 179 print "255 0 0 " end end

3.2 25 3.2.2 puts print ppm001.rb puts puts "P3" print print "P3\n" print \n print puts 3.2.3 for for for 2 (2D) *6 # doubleloop.rb for i in 0.. 7 for j in 0.. 9 print j, ",", i," " end print "\n" end 10 8 0, 1, 2,...,9 0, 1, 2,...,7 *6 2D 3D D dimension

26 3 j i 3.5 i 0 1 2 3 4... j 0 1 2 3 4... 3.5 i, j 3.2.4 ppm001.rb 120 100 puts "120 100" for i in 0.. 119 for j in 0.. 99 119, 99 120, 100 nx, ny # ppm002.rb nx = 240; ny = 180 puts "P3" puts "# PPM test" puts "#{nx} #{ny}"

3.2 27 puts "255" for i in 0... nx for j in 0... ny print "255 0 0 " end end nx ny 3.2.5 2 ppm002.rb..... 3.1 3.1 2 a.. b a b a... b a b-1 1... 3.2.6 irb irb Ruby irb irb irb irb(main):001:0>

28 3 10 + 20 a = 120 a a * 2 30, 120 irb 1 Ruby *7 3.2.7 ppm002.rb puts "#{nx} #{ny}" (") #{ } irb x = 125 "x = #{x}" "#{x*3}" x = #{x} 2 #{x} x 3 x*3 ( ) C, Java *7

3.2 29 3.2.8 nx, ny n Number x n

30 3 3.3 3.3.1 PPM 240 180 255 0 0 8 240 180 8 = 345600 10 1 1 1 Byte 340 KB ls ls -l 340 KB 10 1 3.3.2 (ASCII code) irb irb(main):001:0>10 + 10

3.3 31 => 20 irb irb "a" "a" irb(main):002:0>"a" => "A" 65.chr irb(main):003:0>65.chr => "A" "A" 65 "A" 32 126 0 31, 127 255 "\024" 8 256 RangeError: 256 out of char range char character 256 1 32 126 95 (ASCII code) 3.2 256 irb 8

32 3 3.2 ASCII : 16 2 1 2 41H A 20H SP 0 1 2 3 4 5 6 7 0 (NUL) (DLE) SP 0 @ P p 1 (SOH) (DC1)! 1 A Q a q 2 (STX) (DC2) " 2 B R b r 3 (ETX) (DC3) # 3 C S c s 4 (EOT) (DC4) $ 4 D T d t 5 (ENQ) (NAK) % 5 E U e u 6 (ACK) (SYN) & 6 F V f v 7 (BEL) (ETB) 7 G W g w 8 (BS) (CAN) ( 8 H X h x 9 (HT) (EM) ) 9 I Y i y A (NL) (SUB) * : J Z j z B (VT) (ESC) + ; K [ k { C (NP) (FS), < L \ l D (CR) (GS) - = M ] m } E (SO) (RS). > N ^ n ~ F (SI) (US) /? O _ o (DEL) 1. 1 Byte 2. 1 Byte 0 255 (0x00 0xFF) 3. 1 1 4.

3.3 33 3.3.3 ppm002.rb # ppm002.rb nx = 240; ny = 180 puts "P3" puts "# PPM test" puts "#{nx} #{ny}" puts "255" for i in 0... nx for j in 0... ny print "255 0 0 " end end PPM 2 P6 "255 0 0" 255.chr, 0.chr, 0.chr 3 2 ppm002.rb ppm003.rb

34 3 # ppm003.rb nx = 240; ny = 180 puts "P6" puts "# PPM test" puts "#{nx} #{ny}" puts "255" for i in 0... nx for j in 0... ny print 255.chr, 0.chr, 0.chr end end GIMP ls -l PPM

3.4 35 3.4 2 3.6 bicolor001.rb, bicolor002.rb 3.6 # bicolor001.rb nx = 240; ny = 180 puts "P6" puts "# PPM test" puts "#{nx} #{ny}" puts "255" r = 255.chr g = 200.chr b = 255.chr for i in 0... ny if i > ny / 2 then r = 0.chr end

36 3 for j in 0... nx print r, g, b end end # bicolor002.rb nx = 240; ny = 180 puts "P6" puts "# PPM test" puts "#{nx} #{ny}" puts "255" g = 200.chr b = 255.chr for i in 0... ny for j in 0... nx r = 255.chr if j > nx / 2 then r = 0.chr end print r, g, b end end 3 3 2 3.6 r, g, b 3 RGB Ruby Cyan = 0.chr + 255.chr + 255.chr Magenta = 255.chr + 0.chr + 255.chr print Cyan

3.4 37 # bicolor004.rb cyan = 0.chr + 255.chr + 255.chr magenta = 255.chr + 0.chr + 255.chr color = cyan nx = 240; ny = 180 puts "P6" puts "# PPM test" puts "#{nx} #{ny}" puts "255" for i in 0... ny for j in 0... nx if i > ny / 2 then print magenta else print cyan end end end 16 16 wheat #F5DEB3 orange #FFA500 hotpink #E179B4 tomato #FF6347 lavender #E6E6FA turquoise #40E0D0 16 HTML 16 10 16

38 3 Ruby, C, Java 16 0x Wheat = 0xF5.chr + 0xDE.chr + 0xB3.chr 0xFF 0xff Cyan = 0.chr + 0xFF.chr + 0xFF.chr magenta = 0xFF.chr + 0.chr + 0xFF.chr 3 4 4

3.5 39 3.5 3.7 *8 # grad001.rb nx = 400; ny = 80 g = 250 puts "P6" puts "# Draw Gradient " puts "#{nx} #{ny}" puts "255" for i in 0... ny for j in 0... nx r = j % 255 b = j % 255 print r.chr + g.chr + b.chr end end 3.7 3.5.1 % ) test.rb *9 *8 (gradation) (gradient) *9

40 3 for i in 0.. 20 puts i % 9 end 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 0 1 2 for i 0 20 1 9 j RGB r b 0 255 0 3.8

3.6 41 3.6 1 2 3.6.1 (x a) 2 + (y b) 2 = r 2 (3.1) (a, b) r ( 3.9 ) (a, b) r (x.y) ( 3.9 ) (x a) 2 + (y b) 2 < r 2 y r (a,b) r q O x p 3.9 r ( ) r 2 = p 2 + q 2 r = p 2 + q 2

42 3 3.10 nx, ny cx1, cy1 rad1 j i j i r A B 3.10 A B # circle001.rb nx = 240; ny = 180 cx1 = 100; cy1 = 60; rad1 = 50; srad1 = rad1 ** 2 indigo = 0x4b.chr + 0x00.chr + 0x82.chr gold = 0xff.chr + 0xd7.chr + 0x00.chr puts "P6" puts "# Draw Cirlce " puts "#{nx} #{ny}" puts "255" for i in 0... ny for j in 0... nx if (j - cx1) ** 2 + (i - cy1) ** 2 < srad1 then

3.6 43 print gold else print indigo end end end RGB ( 3.11 ) 3.11

44 3 3.6.2 (3.1) p(x a) 2 + q(y b) 2 = 1 (3.2) (3.2) p q p(x a) 2 q(y b) 2 = 1 (3.3) 3.12 2 5 1.5 1 0.5 4 3 2 1 0 0-0.5-1 -1.5-1 -2-3 -4-2 -2-1.5-1 -0.5 0 0.5 1 1.5 2-5 -4-2 0 2 4 3.12 ( ) ( ) 3 5

3.7 45 3.7 x, y 3.13 2 (2, 1) 5 2 2 + ( 1) 2 = 5 2 j j=cx i ( 4, 4) ( 3, 4) ( 2, 4) ( 1, 4) (0, 4) (1, 4) (2, 4) (3, 4) (4, 4) ( 4, 3) ( 3, 3) ( 2, 3) ( 1, 3) (0, 3) (1, 3) (2, 3) (3, 3) (4, 3) ( 4, 2) ( 3, 2) ( 2, 2) ( 1, 2) (0, 2) (1, 2) (2, 2) (3, 2) (4, 2) 1 2 5 ( 4, 1) ( 3, 1) ( 2, 1) ( 1, 1) (0, 1) (1, 1) (2, 1) (3, 1) (4, 1) i=cy 0 1 4 ( 4,0) ( 3,0) ( 2,0) ( 1,0) (0,0) (1,0) (2,0) (3,0) (4,0) ( 4,1) ( 3,1) ( 2,1) ( 1,1) (0,1) (1,1) (2,1) (3,1) (4,1) ( 4,2) ( 3,2) ( 2,2) ( 1,2) (0,2) (1,2) (2,2) (3,2) (4,2) ( 4,3) ( 3,3) ( 2,3) ( 1,3) (0,3) (1,3) (2,3) (3,3) (4,3) ( 4,4) ( 3,4) ( 2,4) ( 1,4) (0,4) (1,4) (2,4) (3,4) (4,4) 3.13 (0,0) 2 2 10 3 x**2+y**2 3.14 8 7 6 5 4 3 2 1 0-2 -1.5-1 -0.5 0 0.5 1 1.5 3.14-1.5 2-2 -1-0.5 0 0.5 1 1.5 2

46 3 0, 1, 4, 9, 16,... 255 for i in 0.. 50 puts i ** 2 % 255 end (i ** 2 + j ** 2) % 255 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 25, 56, 89, 124, 161, 0, 41, 84, 129, 176, 25, 76, 129, 184, 41, 100, 161, 24, 89, 156, 25, 96, 169, 44, 121, 0, 81, 164, 49, 136, 25, 116, 9, 104, 1, 100 3.15 # circle_grad001.rb nx = 400; ny = 400 r = 0; g = 0 cx1 = 200; cy1 = 200 puts "P6" puts "# Draw Gradient " puts "#{nx} #{ny}" puts "255" for i in 0... ny for j in 0... nx b = ((j-cx1) ** 2 + (i-cy1) ** 2) % 255 print r.chr + g.chr + b.chr end end 3.15 3 3

3.8 47 3.8 3.8.1 rand irb irb rand(6) rand(6) rand(6)... 0 5 6 rand rand(n) 0 n 1 rand(0) rand() 0 1 irb r = rand(256) r = 120 + rand(136)

48 3 3.8.2 (Buffer) [0,0,0] 2 # buff001.rb def print_buffer(buff,nx,ny) # for i in 0... ny for j in 0... nx r = buff[i][j][0] g = buff[i][j][1] b = buff[i][j][2] print r.chr + g.chr + b.chr end end end def print_header(nx,ny) # puts "P6" puts "# Bufferd version" print nx, " ", ny,"\n" puts 255 end nx = 400; ny = 300 # nx ny [0,0,0] # buff = Array.new(ny){Array.new(nx){[0,0,0]}} # print_header(nx,ny) # # for i in (ny / 2-20)... (ny / 2 + 20) for j in (nx / 2-20)... (nx / 2 + 20) buff[i][j] = [0xff,0xff,0] end

3.8 49 end # for i in 0... ny for j in 0... i buff[i][j][2] = 0xa0 end end print_buffer(buff,nx,ny) #

51 4 Postscript 4.1 Postscript 4.1.1 Postscript Ghostscript Postscript(PS) Adobe Systems *1 Postscript Postscript Postscript PS (DTP) DTP Mac Apple Postscript Ghostscript(GS) Postscript GNU Unix, Windows, Mac *2 Ghostscript PS GSview Ghostscript GSview 4.1.2 Postscript Postscript Java Graphics2D PS PS *1 Adobe *2 Ghostscript

52 4 Postscript 4.1.3 Postscript Postscript Adobe *3 2 PDF Postscript Language Reference Manual(PLRM) Postscript Postscript Language Tutorial and Cookbook Blue Book Postscript http://www.cs.kyoto-wu.ac.jp/~konami/documents/ps/ *3

4.2 53 4.2 4.2.1 Ghostscript GS Cygwin GS gswin32 GS (250,300) 120 70 moveto 250 300 lineto stroke (120,70) ( 4.1) 4.1 Ghostscript Postscript (stack) 4.2 (1) 120 push 70 push 1 (3) (3) "moveto" moveto 2 ( pop ) (120, 70) (6) (1) 120 120 (2) 70 70 120 (3) moveto (4) 250 300 300 250 (5) lineto 4.2 PS : (120,70) (250,300) 250 300 (5) "lineto" 2 ( )

54 4 Postscript stroke

4.3 Postscript 55 4.3 Postscript 4.3.1 EPS Postscript DTP 1 EPS (Encapsulated Postscript) PS EPS BoundingBox 2 %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 400 300 2 %%BoundingBox: 4 (4.3 ) A4 210 mm 297 mm 0 0 595 842 %%BoundingBox: -200-150 200 150 Postscript 4.3.2 PS (pt) 1 pt = 1/72 = 25.4/72 mm = 0.3528 mm PS PS (0, 0) (EPS ) moveto lineto "r" rmoveto, rlineto % % EPS ( ) def def (definition) Ruby C x = 24 PS x

56 4 Postscript /x 200 def p1 100 150 /p1 {100 150} def PS /m {moveto} def m moveto

4.4 57 4.4 4.4.1 Postscript 55, 250, 120 120 250 55 55 250 120 4.4.2 pstack gs pstack gs 20 30 pstack moveto pstack 1 pstack 20, 30 2 pstack GS pstack /p {pstack} def p 4.4.3 Postscript 10 20 add % => 30 30 12 sub % => 18 14 7 mul % => 98

58 4 Postscript 72 30 div % => 2.4 72 30 idiv % => 2 40 6 mod % ( ) => 4 24 neg % => -24 10, 20 add 10 20 30 pstack 10 20 pstack add pstack ( +) 10 + 20 Postscript 4 1 ( ) 4 + 5 6 4 5 add 6 sub 1. (10 + 20)/2 2. 20 + 40/4 (exchange) 50 100 exch % => 100 50 (duplicate) push 60 dup % => 60 60 10 20 30 40 50 3 copy % => 10 20 30 40 50 30 40 50 3 30 40 50 (roll) 10 20 30 40 50 60 5 2 roll % => 10 50 60 20 30 40 5 20 30 40 50 60

4.4 59 5 60 50 40 30 20 10 2 40 30 20 60 50 10 4 2 ( ) 120 150 => -120 150 exch neg exch 1. 120 150 => -120-150 2. 66 77 88 120 250 => -120-250 66 77 88 120 250 3. 240 280 => 260 ( )

60 4 Postscript 4.5 4.5.1 setrgbcolor 0 1 RGB setgray 1.1 1 0 0 setrgbcolor % 0.8 setgray % 4.5.2 2 setlinewidth % 2 pt [3 3] 0 setdash % [] 0 setdash % 4.5.3 3 50 50 moveto 50 50 moveto 50 50 moveto 200 50 lineto 200 50 lineto 200 50 lineto 250 150 lineto 250 150 lineto 250 150 lineto 100 150 lineto 100 150 lineto 100 150 lineto stroke closepath fill stroke (100,150) (250,150) (100,150) (250,150) (100,150) (250,150) (50,50) (200,50) (50,50) (200,50) (50,50) (200,50)

4.5 61 4.5.4 ( ) x y 4.3 90 x y arc stroke/fill 180 O 0 270 4.4 4.3 newpath newpath newpath newpath 90 60 50 30 270 arc 90 60 50 30 270 arc 90 60 50 0 360 arc stroke fill stroke (90,60) 50 (90,60) 50 4.4

62 4 Postscript 4.6 4.6.1 4.5 (0, 0) 30 2 100 80 translate O 100 4.5 80 (translate) 2 (100, 80) %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: -50-50 200 120 0 0 30 0 360 arc stroke 0.5 setgray newpath 100 80 translate 0 0 30 0 360 arc stroke (100, 80) 2 1 100 80 30 0 360 arc stroke

4.6 63 4.6.2 Postscript scale 2 1.5 2 1.5 scale 4.6 2 1.5 scale 4.6 2 1.5, (x, y) a b 1. x y translate (x, y) 2. a b scale 3. (0, 0) 20 (80, 40) 40, 30 4.7

64 4 Postscript 0 0 20 0 360 arc stroke 80 40 translate 2 1.5 scale 0 0 20 0 360 arc stroke 1. 1 1/a 1/b scale 1/a 1/b 1 1 2. 2 -x -y translate x y (0, 0) 2 1.5 0.5 0.666677 1 2 div 1 1.5 div 80, 40 80, 40 neg 0 0 20 0 360 arc stroke 80 40 translate 2 1.5 scale 0 0 20 0 360 arc stroke 1 2 div 1 1.5 div scale % 1 80 neg 40 neg translate % 2 4 3 2 3 4 4 (20, 100), (30, 50), (100, 90) Postscript

4.6 65 4.6.3 rotate rotate 4.8 30 rotate 4.8 30 rotate 30 4.9 translate 1 45 4.9 50 50 translate % (50,50) 45 rotate % 45 0.9 2.3 scale % 2 0 0 20 0 360 arc stroke % 1 0.9 div 1 2.3 div scale % 45 neg rotate 50 neg 50 neg translate

66 4 Postscript 4.6.4 4.10 1. translate (x 0, y 0) 2. moveto (0, r) translate 3. 60 rotate 60 x x 4. lineto (r, 0) 1 5. 3 4 5 6 6. closepath stroke x 60 x r (x0,y0) 60 4.10 2 x repeat 5 Postscript repeat 5 5 { } repeat 4 5-14 -5 moveto 28 0 rlineto 0 10 rlineto -28 0 rlineto closepath stroke (30, 30) 45 4 6 repeat 45 4 4 7 144 Postscript Postscript