201205423 .六、發明說明: 【發明所屬之技術領域】 [0001] 本發明涉及一種印表機,尤指一種具有圖片裁剪功能的 印表機及其圖片裁剪的方法。 【先前技術】 [0002] 目前,使用印表機列印圖片時,需要先將印表機與一電 腦相連接。使用者將圖片或者照片存放在電腦中,如果 使用者只需要列印圖片或者照片中的某一個區域,使用 者還需要在電腦中對待列印的圖片或者照片進行裁剪, 然後再通過印表機對裁剪後的圖片或者照片進行列印。 [0003] 但是,這種列印方式需要使用者先將數碼相機中的圖片 ' 或者照片拷貝到電腦中,並利用電腦進行相應的裁剪編 輯,然後才能通過印表機進行列印。這樣,對於使用者 來說,不是十分方便。 【發明内容】 [0004] 鑒於以上内容,有必要提供一種方便快捷的具有圖片裁 〇 剪功能的印表機及其圖片裁剪的方法。 [0005] 根據本發明的一方面,提供一種具有圖片裁剪功能的印 表機,所述印表機包括: [0006] 一顯示幕; [0007] —存儲單元,用於存儲待列印的圖片; [0008] 一圖片解碼器,用於從所述存儲單元讀取一圖片,按照 該圖片的編碼格式進行解碼,轉換為點陣圖,顯示到所 述顯示幕上,所述圖片解碼器還用於獲取該圖片的長和 099125192 表單編號A0101 第3頁/共15頁 0992044249-0 201205423 寬的圖元值; [0009] 一裁剪框處理模組,用於在所述顯示幕顯示的圖片圖層 之上繪製一裁剪框,用於選取一圖片區域; [0010] 一蒙版繪製模組,用於向所述裁剪框與該圖片邊界之間 的區域繪製一特定透明度的蒙版圖層,以明顯區分所述 裁剪框内外的區域; [0011] 一裁剪區域記錄器,用於記錄所述裁剪框内選取的圖片 區域,及 [0012] 一列印模組,用於列印所述裁剪區域記錄器所記錄的圖 片區域。 · [0013] 根據本發明的另一方面,提供一種在印表機上實現圖片 裁剪的方法,該方法包括以下步驟: [0014] 一圖片解碼器從一存儲單元讀取一圖片; [0015] 所述圖片解碼器按照該圖片的編碼格式對該圖片解碼, 並將該圖片顯示到一顯示幕上; [0016] 所述圖片解碼器獲取該圖片的長和寬的圖元值; [0017] —裁剪框處理模組初始化一裁剪框的位置和大小; [0018] 一蒙版繪製模組向所述裁剪框與該圖片邊界之間的區域 添加一特定透明度的蒙版圖層,以明顯區分所述裁剪框 内外的區域; [0019] 調整所述裁剪框的位置和大小,選定一圖片區域; [0020] 所述蒙版繪製模組根據調整後所述裁剪框的位置和大小 099125192 表單編號A0101 第4頁/共15頁 0992044249-0 201205423 [0021] [0022] [0023]Ο [0024] Ο ’重新繪製所述裁剪框與該圖片邊界之間的區域的蒙版 圖屠; 一裁剪區域記錄器記錄所述裁剪框内選取的圖片區域; 及 一列印模組列印所述裁剪區域記錄器所記錄的圖片區域 〇 與習知技術相比,上述具有圖片裁剪功能的印表機和在 印表機上實現圖片裁剪的方法中,使用者可以直接在印 表機上裁剪圖片以選取合適區域,然後列印,無需接入 另外的計算設備,方便快捷。 【實施方式】 請參閱圖1,示意性的示出了根據本發明一種實施方式的 具有圖片裁剪功能的印表機的功能模組圖1該印表機包 ;.... 括一存儲單元1 〇2、一顯示幕1〇4、一圖片解碼器106、 一裁剪框處理模組108、—蒙版繪製模組η〇、一裁剪區 域記錄器112及一列乎模組114 β所述存儲單元1〇2連接 所述圖片解碼器1 〇6 ’所述囷片解碼器106同時連接所述 顯不幕104和所述裁前框處理模組108,所述裁剪框處理 模組108同時連接所述顯示幕104和所述蒙版繪製模組 110 ’所述蒙版緣製模組11G同時連接所述顯示幕1〇4和 所述裁剪區域記錄器112,所述裁剪區域記錄器112連接 所述列印模組114。 所述存儲單元102,用於切待列印關片。所述存健單 元102,可以是印表機内置的記憶體,也可以是與印表機 099125192 表單編號A0101 0992044249-0 [0025] 201205423 [0026] [0027] [0028] [0029] 上的讀卡器或USB介面連接的外置存放裝…口 a , 遷可以是通 過無線或有線網路與印表機相連接的存放妒置 所述顯示幕104,用於呈現使用者介面。 戶斤述圖片解碼器106,用於從所述存儲置_ 丨、仔储早兀102讀取一圖 片,按照其編碼格式進行解碼,轉換為點陣圖 ,顯示到所述顯示幕104上,所述圖片醢说 解碼器106還用於 獲取該圖片的長和寬的圖元值。所述圖片解碼器1〇6支援 的編碼格式包括BMP、JPEG、PNG、GIF、TIFF等。 所述裁剪框處理模組108,用於在所述顯示幕1〇4顯示的 圈片圖層之上繪製一裁剪框,用於選取一圏片區域。在 本實施方式中’所述裁剪框為一矩形框。 所述篆版繪製模組110,用於向所述裁剪框與該圖片邊界 之間的區域繪製一特定透明度的蒙版圖層,以明顯區分 所述裁剪框内外的區域。蒙版圖層的透明度由阿爾法通 道(Alpha Channel)的值來確定,在一摘使用32位元存 儲的圖片中,阿爾法通道的值有0到2 5 5總共2 5 6個級別, 從0到255,數值越大,不透明的程度越大,〇表示完全透 明,255表示完全不透明。在本實施方式中,所述特定透 明度的蒙版圖層的阿爾法通道的值設定為1〇〇。 Ο201205423. VI. Description of the Invention: [Technical Field] [0001] The present invention relates to a printer, and more particularly to a printer having a picture cropping function and a method for cropping the same. [Prior Art] [0002] At present, when printing a picture using a printer, it is necessary to first connect the printer to a computer. The user stores the picture or photo on the computer. If the user only needs to print a picture or an area in the photo, the user also needs to cut the picture or photo to be printed on the computer, and then pass the printer. Print the cropped picture or photo. [0003] However, this printing method requires the user to copy the picture ' or the photo in the digital camera to the computer first, and use the computer to perform the corresponding crop editing, and then print through the printer. This is not very convenient for the user. SUMMARY OF THE INVENTION [0004] In view of the above, it is necessary to provide a convenient and quick printer with a picture cropping function and a method for cropping the same. [0005] According to an aspect of the present invention, a printer having a picture cropping function is provided, the printer comprising: [0006] a display screen; [0007] a storage unit for storing a picture to be printed [0008] a picture decoder, configured to read a picture from the storage unit, decode according to the encoding format of the picture, convert to a bitmap, display to the display screen, and the picture decoder further Used to get the length of the picture and 099125192 Form No. A0101 Page 3 / Total 15 Page 0992044249-0 201205423 Wide element value; [0009] A crop box processing module for the picture layer displayed on the display Drawing a cropping frame for selecting a picture area; [0010] a mask drawing module for drawing a mask layer of a specific transparency to an area between the crop frame and the picture boundary, Distinguishing between the inside and outside of the cropping frame; [0011] a cropping area recorder for recording the selected image area in the cropping frame, and [0012] a printing module for printing the cropping area recorder Recorded map Area. [0013] According to another aspect of the present invention, a method for implementing picture cropping on a printer is provided, the method comprising the steps of: [0014] a picture decoder reading a picture from a storage unit; [0015] The picture decoder decodes the picture according to the coding format of the picture, and displays the picture on a display screen; [0016] the picture decoder obtains the picture value of the length and width of the picture; [0017] - the crop frame processing module initializes the position and size of a crop frame; [0018] a mask drawing module adds a mask layer of a specific transparency to the region between the crop frame and the image boundary to clearly distinguish The area inside and outside the cropping frame is adjusted; [0019] adjusting the position and size of the cropping frame to select a picture area; [0020] the mask drawing module according to the position and size of the cropping frame after the adjustment 099125192 Form number A0101 Page 4 of 15 0992044249-0 201205423 [0022] [0024] Ο 'Repainting the mask of the area between the crop frame and the border of the picture; a crop area recorder Remember a picture area selected in the crop frame; and a print module printing the picture area recorded by the crop area recorder. Compared with the prior art, the above-mentioned printer with picture cropping function and the printer In the method of realizing image cropping, the user can directly crop the image on the printer to select a suitable area, and then print, without accessing another computing device, which is convenient and quick. Embodiments Referring to FIG. 1 , a functional module of a printer with a picture cropping function according to an embodiment of the present invention is schematically illustrated in FIG. 1 . The printer package includes a storage unit. 1 〇 2, a display screen 1 〇 4, a picture decoder 106, a crop frame processing module 108, a mask drawing module η〇, a crop area recorder 112, and a list 114 114 The unit decoder 2 is connected to the picture decoder 1 〇 6 '. The chip decoder 106 simultaneously connects the display screen 104 and the pre-cut frame processing module 108, and the crop frame processing module 108 is simultaneously connected. The display screen 104 and the mask drawing module 110' are simultaneously connected to the display screen 1〇4 and the crop area recorder 112, and the crop area recorder 112 is connected. The printing module 114. The storage unit 102 is configured to cut a printed piece. The storage unit 102 may be a built-in memory of the printer, or may be read by the printer 099125192 Form No. A0101 0992044249-0 [0025] 201205423 [0026] [0027] [0028] [0029] The external storage device connected to the card device or the USB interface can be a storage device connected to the printer through a wireless or wired network to display the user interface. The picture decoder 106 is configured to read a picture from the storage device _ 丨, 仔 兀 兀 102, decode it according to its encoding format, convert it into a bitmap, and display it on the display screen 104. The picture said decoder 106 is further configured to obtain the length and width primitive values of the picture. The encoding formats supported by the picture decoder 1〇6 include BMP, JPEG, PNG, GIF, TIFF, and the like. The cropping frame processing module 108 is configured to draw a cropping frame on the circle layer displayed on the display screen 1〇4 for selecting a slice region. In the present embodiment, the crop frame is a rectangular frame. The template drawing module 110 is configured to draw a mask layer of a specific transparency to an area between the crop frame and the border of the image to clearly distinguish an area inside and outside the crop frame. The transparency of the mask layer is determined by the value of the alpha channel (Alpha Channel). In a picture stored in 32-bit, the value of the alpha channel has 0 to 2 5 5 total 2 5 6 levels, from 0 to 255. The larger the value, the greater the degree of opacity, 〇 indicates complete transparency, and 255 indicates complete opacity. In the present embodiment, the value of the alpha channel of the mask layer of the specific transparency is set to 1 〇〇. Ο
[0030] 所述裁剪區域記錄器112,甩於記錄所述裁剪框内選取的 圖片區域。記錄所述裁剪框内選取的圖片區域,有多種 方式,可以將所選取的圖片區域重新存儲為一張新的圖 片’還可以將所選取的圆片區域在原圖片中所處的位置 記錄到一個標記檔當中。考慮到印表機的嵌入式系統環 099125192 表單編號A0101 第6.頁/兴15頁 0992044249-0 201205423 境對存儲空間和處理性能的要求,在本實施方式中,所 述裁剪區域記錄器112將所述裁剪框的四個頂點在原圖片 中所處的座標保存在一可擴展標記語言(Xml)檔中,根據 所述裁剪框的四個頂點在原圖片中所處的座標,即可指 定選取的圖片區域。 [0031] 所述列印模組114,用於列印所述裁剪區域記錄器112所 記錄的圖片區域。在本實施方式中’所述列印模組114從 所述可延伸標記語言檔中讀取所選取的圖片區域在原圖 G [0032] 片中的位置’然後將該圖片區域列印出來。 : . Ο 請參閱圖2 ’示意性的示出了根據本發明心_種實施方式的 在印表機上裁剪圖片的使用者介面。在所述使用者介面 的示意圖中,波浪線填充的矩形A表示所述圖片解碼器 10 6從所述存儲單元1〇2讀取並顯示在所述顧示幕上 的待裁剪圖片’矩形峰示所述裁剪框y在本實施方式中 ,所述裁剪框為-矩形框,置於待裁剪圖”圖層之上 ,裁剪框的四個頂點(左上角、右上角、左下角、右下 角)及四條邊的中點(左邊、下邊、右邊、上邊)都可 以拖動’以調整裁剪框的大彳m裁剪框的四個頂點 均可以在水平和豐直方向上拖動,裁煎框的左邊線和右 邊線的可以在水平方向上拖動,婦框的上邊線和 下邊線的中點可以在豎直方向上拖動。 在所述裁剪框與待裁剪圖片邊界之間的區域C,即較暗的 部分,是所述蒙版繪製模組110繪製的一特定透明度的蒙 版圖層,用以明顯區分所述裁剪框内外的區域。 099125192 表單編號Α0101 第7頁/共15頁 0992044249-0 [0033] 201205423 [0034] 請參閱圖3,示意性的示出了根據本發明一種實施方式的 在印表機上實現圖片裁剪的方法的流程圖,包括以下步 驟: [0035] 在步驟S20中,所述圖片解碼器106從所述存儲單元102 讀取一圖片。 [0036] 在步驟S22中,所述圖片解碼器1 06按照該圖片的編碼格 式對其解碼,並將其顯示到所述顯示幕1 〇4上。 [0037] 在步驟S24中,所述圖片解碼器106獲取該圖片的長和寬 的圖元值。 [0038] 在步驟S26中,所述裁剪框處理模組108初始化一裁剪框 的位置和大小。考慮到用戶的使用習慣和偏好,在本實 施方式中,所述裁剪框為一矩形框,初始位置居於該圖 片的正中,初始長和寬等同於該圖片的長和寬,也即在 初始化狀態下,所述裁剪框預設選取該圖片的全部區域 [0039] 在步驟S28中,所述蒙版繪製模組110根據步驟S28中所 述裁剪框初始化的位置和大小,向所述裁剪框與該圖片 邊界之間的區域添加一特定透明度的蒙版圖層,以明顯 區分所述裁剪框内外的區域。在本實施方式中,初始化 的裁剪框選取該圖片的全部區域,因此初始化的蒙版圖 層的大小為零,使用者將不會看到初始化的蒙版圖層。 在本實施方式中,所述特定透明度的蒙版圖層的阿爾法 通道的值設定為1 0 0。 [0040] 在步驟S30中,調整所述裁剪框的位置和大小,選取使用 099125192 表單編號 A0101 第 8 頁/共 15 頁 0992044249-0 201205423 [0041] [0042] [0043] Ο [0044] Ο [_ [0046] [0047] 者要列印的圖片區域。 在步驟S32中,所述蒙版繪製模組110根據步驟S32中調 整後所述裁剪框的位置和大小,重新繪製所述裁剪框與 該圖片邊界之間的區域的蒙版圖層,以明顯區分所述裁 剪框内外的區域。 在步驟S34中,所述裁剪區域記錄器112記錄所述裁剪框 内選取的圖片區域。 在步驟S36中,所述列印模組114列印所述裁剪區域記錄 器112所記錄的圖片區域。 綜上所述,本發明係合乎發明專利申請條件,爰依法提 出專利申請。惟,以上所述僅為本發明之較佳實施例, 舉凡熟悉本案技藝之人士其所爰依本案之創作精神所作 之等效修飾或變化,皆應涵蓋於以下之申請專利範圍内 〇 【圖式簡單說明】 圖1是本發明一種實施方式中具有圖片裁剪功能的印表機 的功能模組圖。 圖2是本發明一種實施方式中在印表機上裁剪圖片的使用 者介面的示意圖。 圖3是本發明一種實施方式中在印表機上實現圖片裁剪的 方法的流程圖。 【主要元件符號說明】 存儲單元:102 099125192 表單編號Α0101 第9頁/共15頁 0992044249-0 [0048] 201205423 [0049] 顯示幕:104 [0050] 圖片解碼器:106 [0051] 裁剪框處理模組:108 [0052] 蒙版繪製模組:110 [0053] 裁剪區域記錄器:112 [0054] 列印模組:114 099125192 表單編號A0101 第10頁/共15頁 0992044249-0[0030] The crop area recorder 112 is configured to record a picture area selected in the crop frame. Recording the selected image area in the cropping frame, there are multiple ways to re-stor the selected image area as a new picture', and also record the position of the selected wafer area in the original picture to a In the marker file. Considering the embedded system ring 099125192 of the printer, Form No. A0101, page 6. Hing 15 page 0992044249-0 201205423, the requirements for storage space and processing performance, in the present embodiment, the crop area recorder 112 will The coordinates of the four vertices of the crop frame in the original picture are saved in an Extensible Markup Language (Xml) file, and the selected coordinates can be specified according to the coordinates of the four vertices of the crop frame in the original picture. Picture area. [0031] The printing module 114 is configured to print a picture area recorded by the crop area recorder 112. In the present embodiment, the printing module 114 reads the position of the selected picture area in the original picture G [0032] from the extensible markup language file and then prints the picture area. 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 In the schematic diagram of the user interface, the wavy line filled rectangle A represents the picture to be cropped by the picture decoder 106 from the storage unit 1 〇 2 and displayed on the screen. In the present embodiment, the cropping frame is a rectangular box placed on the layer to be cropped, and the four vertices of the cropping frame (upper left corner, upper right corner, lower left corner, lower right corner) And the midpoints of the four sides (left, bottom, right, top) can be dragged to adjust the width of the crop box. The four vertices of the crop frame can be dragged in the horizontal and vertical directions. The line and the right line can be dragged in the horizontal direction, and the upper line of the woman frame and the midpoint of the lower line can be dragged in the vertical direction. In the area C between the crop frame and the boundary of the picture to be cropped, The darker portion is a mask layer of a specific transparency drawn by the mask drawing module 110 to clearly distinguish the inner and outer regions of the crop frame. 099125192 Form number Α0101 Page 7 of 15 0992044249-0 [0033] 201205423 [0034] Please Referring to FIG. 3, a flow chart of a method for implementing picture cropping on a printer according to an embodiment of the present invention is schematically illustrated, including the following steps: [0035] In step S20, the picture decoder 106 is The memory unit 102 reads a picture. [0036] In step S22, the picture decoder 106 decodes the picture according to the picture's encoding format and displays it on the display screen 1 〇 4. 0037] In step S24, the picture decoder 106 acquires the primitive value of the length and width of the picture. [0038] In step S26, the crop box processing module 108 initializes the position and size of a crop frame. In the embodiment, the cropping frame is a rectangular frame, and the initial position is in the middle of the image, and the initial length and width are equivalent to the length and width of the image, that is, in the initialization state. Next, the cropping frame presets to select the entire area of the picture. [0039] In step S28, the mask drawing module 110 according to the position and size of the cutting frame initialization in step S28, to the cropping frame and The picture boundary A mask layer of a specific transparency is added between the regions to clearly distinguish the regions inside and outside the crop frame. In this embodiment, the initialized crop frame selects the entire region of the image, so the size of the initialized mask layer is Zero, the user will not see the initialized mask layer. In this embodiment, the value of the alpha channel of the mask layer of the specific transparency is set to 1 0 0. [0040] In step S30, the adjustment is performed. The position and size of the cropping frame are selected, using 099125192 Form No. A0101 Page 8 / Total 15 Page 0992044249-0 201205423 [0041] [0042] [0044] Ο [0044] Ο [_ [0046] [0047] Printed picture area. In step S32, the mask drawing module 110 re-renders the mask layer of the area between the cropping frame and the image boundary according to the position and size of the cropping frame adjusted in step S32, so as to clearly distinguish The area inside and outside the crop frame. In step S34, the crop region recorder 112 records the selected image region within the crop frame. In step S36, the printing module 114 prints the image area recorded by the crop area recorder 112. In summary, the present invention is in accordance with the conditions of the invention patent application, and the patent application is filed according to law. However, the above description is only the preferred embodiment of the present invention, and equivalent modifications or variations made by those skilled in the art to the spirit of the present invention should be included in the following claims. Brief Description of the Drawings Fig. 1 is a functional block diagram of a printer having a picture cropping function in an embodiment of the present invention. 2 is a schematic illustration of a user interface for cropping a picture on a printer in accordance with an embodiment of the present invention. 3 is a flow chart of a method of implementing picture cropping on a printer in accordance with an embodiment of the present invention. [Main component symbol description] Storage unit: 102 099125192 Form number Α 0101 Page 9 / Total 15 page 0992044249-0 [0048] 201205423 [0049] Display screen: 104 [0050] Picture decoder: 106 [0051] Crop box processing mode Group: 108 [0052] Mask drawing module: 110 [0053] Crop area recorder: 112 [0054] Printing module: 114 099125192 Form number A0101 Page 10 / Total 15 page 0992044249-0