2008-11-26 47 views
0

我已經閱讀了一個示例並試圖複製它的方法,但結果很奇怪。這是一筆交易,所以我不想購買一個包來做到這一點。此外,它將在Ba​​sic中的多值數據庫上執行,而不是很多程序員再次寫入。 如果任何人都可以發佈這個小例子這將是最有幫助的。具體來說,我需要一個以8x11紙爲中心的盒子,其中左側1/3填充綠色,中間1/3填充黃色,最後1/3填充紅色。然後在盒子的每種顏色內畫一條直線3點。我需要編寫一個程序來使用HP PCL 5e/HP/GL2繪製圖形

謝謝。

回答

0

問題解決:我的想法的錯誤是,它是300 dpi和600 dpi之間的差異,所以我除以2,答案似乎幾乎是正確的。真正的問題是3oo dpi和720 Decipoint之間的差異。真正的因素需要2.4,現在它完美的作品。

1

最簡單的方法是繪製3個盒子。你必須自己定位每個人做自己的數學,以確定從哪裏開始第一個使其居中等。

首先將光標置於第一個框的左上角,繪製它,移動在下一個框的左上角繪製它,併爲最後一個做相同的操作。下面是一些代碼:

<esc>&u300D<esc>*t300R<esc>*p300x300Y<esc>*r3U<esc>*v2S<esc>*c300a300b5P<esc>*p600x300Y<esc>*r3U<esc>*v3S<esc>*c300a300b5P<esc>*p900x300Y<esc>*r3U<esc>*v1S<esc>*c300a300b5P 

這裏是說明:

<esc>&u300D<esc>*t300R -- set the Unit of Measure and Resolution (in this case 300 dpi) 
<esc>*p300x300Y -- move cursor to 300x 300y (1 inch x 1 inch) 
<esc>*r3U<esc>*v2S -- set the color palette to RGB and use color 2 (green) 
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern 
<esc>*p600x300Y -- move cursor to 600x 300y 
<esc>*r3U<esc>*v3S -- set the color palette to RGB use color 3 (yellow) 
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern 
<esc>*p900x300Y -- move cursor to 900x 300y 
<esc>*r3U<esc>*v1S -- set the color palette to RGB use color 1 (red) 
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern 

下面是其他顏色和調色板,請記住,這是簡單的方法,你可以指定自己的RGB等

RGB Palette 
<esc>*r3U<esc>*v1S - Red     
<esc>*r3U<esc>*v2S - Green 
<esc>*r3U<esc>*v3S - Yellow 
<esc>*r3U<esc>*v4S - Blue 
<esc>*r3U<esc>*v5S - Magenta 
<esc>*r3U<esc>*v6S - Cyan 

CMYK Palette 
<esc>*r-3U<esc>*v1S - Cyan 
<esc>*r-3U<esc>*v2S - Magenta 
<esc>*r-3U<esc>*v3S - Blue 
<esc>*r-3U<esc>*v4S - Yellow 
<esc>*r-3U<esc>*v5S - Green 
<esc>*r-3U<esc>*v6S - Red 
<esc>*r-3U<esc>*v7S - Black 
相關問題