201112164 VlT〇y-〇〇29I〇〇-TW 31914twf.doc/n 六、發明說明: 【發明所屬之技術領域】 本發明是有關於—種電子裝置與1 處理務,且特別是有·一種 (Ρ1χ_色的順序值而進行的反鑛齒處理方法。像像素 【先前技術】 具有導航功能的行動震置已經非常普及,而 的重點是繪製電子地圖供制者觀看。此種軸多 邊形表示公目學校料域,衫邊線段麵觀,二 斜角的邊線會在畫©上呈贿齒狀4縣處理技ς 經過運算,在上述的邊線加上漸層色,使地圖晝面上 邊線段和多邊形看起來比較平滑,使地圖更加美觀。夕 一般行動裝置的處理器(processor)效率不高,圮憶體 容量有限,而且所使㈣作業祕並未直接提供反鑛^的 函式支援。目前存在的反鋸齒演算方法,若非耗時,就是 佔用較多記憶體資源’無關賴有·省時而且省記憶體的 兩項優勢。 牛例而0超取樣反鑛齒演算法(super-sampling ant卜aliasing)是將地圖畫布(canvas)擴展為原始晝布的ηχη 倍大小,所有物件尺寸和線段寬度必須以η倍計算繪製, 繪製完之後再將擴大的晝布經由運算縮小到原始大小。這 種演算法會消耗大量的運算和記憶體資源。 某些現成的函式庫(library),例如開放原始碼(open 201112164 vuuy-uU29I00-TW 319l4twf.d〇c/n source)的反顆粒幾何函式庫(Anti_Gmin Ge〇metry201112164 VlT〇y-〇〇29I〇〇-TW 31914twf.doc/n VI. Description of the Invention: [Technical Field] The present invention relates to an electronic device and a processing device, and particularly has one ( Anti-mineral tooth processing method based on the order value of Ρ1χ_ color. Like pixel [Prior Art] The action of the action with the navigation function has been very popular, and the focus is on drawing the electronic map for the viewer to watch. The school material area, the side line of the shirt, the sideline of the two bevels will be in the form of a bribe-toothed 4 county processing technique. After the calculation, add the gradient color on the above-mentioned side line to make the map line on the edge line. The polygons look smoother and make the map more beautiful. The processor of the general mobile device is not efficient, and the capacity of the memory is limited, and the (4) job secret does not directly provide the function support of the anti-mine. The existing anti-aliasing calculation method, if it is not time-consuming, is to occupy more memory resources. It has two advantages of irrelevant, time-saving and provincial memory. The case of the super-sampling anti-mineral tooth algorithm (super-samp) Ling ant (aliasing) is to expand the canvas to the original 昼 times, all object size and line width must be calculated in n times, after the drawing is completed, the enlarged crepe is reduced to the original size by operation. This algorithm consumes a lot of computational and memory resources. Some off-the-shelf libraries, such as the anti-particles of the open source code (open 201112164 vuuy-uU29I00-TW 319l4twf.d〇c/n source) Geometric library (Anti_Gmin Ge〇metry
Library ’以下簡稱AGG函式庫)可以在緣晝同時進行反 錯齒處理,繪製出來的圖像已經有平滑效果。因為agg 函式庫並歧料行祕置.作業㈣㈣函式庫,雖 然效果非常好,卻相當耗費運算資源。 【發明内容】 炎一 t發種反鑛齒處理方法,此方法提供-種較 ^即省計算資源和記顏資_運#方式,可以使電子裝 置的地圖呈現更加美觀。 本發㈣提供—種電子裝置,執行上料反鑛齒處理 能節省地圖顯示平滑美觀,不僅節省計算資源,也 儲存處理方法’包括下列步驟。在 為中心,分別指定目前像素。以目前像素 四方向執行判斷程序,二判::?方向、以及第 在有鋸齒的每-上斷母述方岐科鑛齒。 盤, 述方向執行計算程序,以計算其漸層階 —上ii方二上述方向的漸層階數以及預設條件’,、決定每 理齒處理。以及,在需要繼處 進行反_處理據漸層·執行漸錢色程序,以 本發明另提出—種電l-r ^ 器°第―記憶_存多】處理 仔夕個像素。處理器耦接第一記憶區, 201112164 VIT09-0029I00-TW 3l9l4twf.doc/n 在第一記憶區内指定目前像素,而且以目前像素為中心, 分別在第-方向、第二方向、第三方向、以及第四方向執 行判斷程序’以決定每—上述方向是否有麵。處理器也 在有鋸齒的每一上述方向執行計算程序,以計算矣漸層階 數。此外,處理器根據每一上述方向的漸層階數以及預設 條件,決定每一上述方向是否需要反鋸齒處理,並且在^The Library ‘hereinafter referred to as the AGG library” can perform anti-alias processing at the same time, and the drawn image has a smoothing effect. Because the agg library and the confusing line secret. The operation (4) (four) library, although the effect is very good, it is quite expensive computing resources. SUMMARY OF THE INVENTION The method for treating anti-mineral teeth of Yanyi T provides a more beautiful appearance of the map of the electronic device than the method of calculating the resource and the memory of the image. The present invention provides an electronic device for performing an anti-mineral tooth treatment, which can save the map display smooth and beautiful, not only saves computing resources, but also stores the processing method' including the following steps. At the center, specify the current pixel separately. In the current pixel four directions to execute the judgment procedure, the second sentence::? The direction, as well as the per-spinning of the parent-staple tooth. In the disc, the calculation process is performed to calculate the gradation order of the above-mentioned direction of the gradation level - the upper ii square 2 and the preset condition ', and the processing of each tooth is determined. And, in the case where it is necessary to carry out the inverse _ processing according to the gradual layer and the implementation of the gradual color program, the present invention further proposes that the type of electric l-r ^ device ° - memory _ memory is processed a pixel. The processor is coupled to the first memory area, 201112164 VIT09-0029I00-TW 3l9l4twf.doc/n to specify the current pixel in the first memory area, and is centered on the current pixel, respectively in the first direction, the second direction, and the third direction And the fourth direction executes the determination program to determine whether each of the above directions has a face. The processor also performs a calculation procedure in each of the above directions that are sawtooth to calculate the gradation order. In addition, the processor determines whether each of the above directions requires anti-aliasing according to the progressive order of each of the above directions and a preset condition, and
要反鋸齒處理的每一上述方向,根據漸層階數執行漸層塗 色程序’以進行反鑛齒處理。 基於上述,本發明使用簡單有效的演算法,並且利用 繪製地圖的顏色優先順序來進行反鋸齒處理,可產生平滑 美觀的電子地圖,而且兼具節省計算資源和節省記情體二 優點。 〜 為讓本發明之上述特徵和優點能更明顯易懂,下文特 舉實施例,並配合所附圖式作詳細說明如下。 【實施方式】 圖1為依照本發明-實施例的一種電子裝置1〇〇的方 塊圖。電子裝置100包括顯示H 11〇、處理器12〇、記憶區 U0以及記憶區140。其中記憶區13〇和14〇可以屬於同一 記憶體,也可以屬於不_記憶體。處理器12G 於顯 不器11G和記憶區13G、140之間,負責繪製電子地圖,並 且對電子地ffi作聽齒處理。記憶區13_存電子地圖, 也就是電子地圖的每-個像素的顏色值。記憶區14〇 則儲存電子地_每-個像相顏色值所對應的順序值 201112164 vnuy-uu29IOO-TW 31914twf.doc/n (細節後述)。顯糸器110負責顯示經過反鋸齒處理的電 子地圖。本發明一實施例的電子裝置1〇〇可為具有電子地 圖功能的汽車導航裝置、行動電話、個人數位助理或其他 可*攜.式行動H~弋,~-- ------ 圖4為本實施例的處理器120繪製電子地圖的流程步 驟。電子地圖的繪製有一個預設的優先順序。首先,繪製 海洋(步驟410) '然後繪製台北縣、台北市之類的城市 區域(步驟420)。然後繪製學校、公園等多邊形區域(步 驟430)。然後繪製道路、鐵路這一類的多邊線段(步驟 =0)。這時候需要反鋸齒處理的多邊形和多邊線段都已經 完成繪製,接下來就是反鋸齒處理(步驟45〇)。然後再 繪製不需要反鋸齒處理的景點小圖示(步驟46〇)以及景 點和迢路名稱(步驟470)。然後處理器12〇可以控制顯 示器110 ’使其顯示完成的地圖。 /圖4的流程中,例如海洋、公園、道路之類的每一寺 ^形必須使用唯-不重複__製,才能在反鑛齿處王 時正確判絲色重疊狀況。從各種地形在圖4流程的” 順序’可以得丨各種地形㈣應純值_製優先順序c j =例是絲製電子地紐用到的所有顏色,依據㈣ 復Γ順序從1開始編號’而得到所有顏色的順序值。南 繪製:應的順序值Ϊ低,順序值1即對應最另 ^% 圖上的顏色。本實施例的電子地圖是在記作 ^ 130進行繪製,記憶區13〇儲存 ^ 顏色值’記麵__存每-上述像料顏 201112164 VI1 U?MK)29I00-TW 31914twf.doc/n 順序值。 圖5為圖4流程中步驟45〇的流程圖,也就是處理器 12〇所執行的反鑛齒處理方法的流程圖。當步驟獨完成 枯,而要反-鑛-齒處理的電子地圖儲存在記億區13〇中,而 記憶區140尚無資料。圖5流程的第一個步驟,就是將記 憶區130的每個像素的顏色值轉換成對應的順序值,儲存 在記憶區140的對應位置(步驟51〇)。在圖5的其他步 籲驟。如果處理器12〇需要某個像素的順序值,就直接自記 $區140 δ|取,這樣可以節省將顏色值轉換成順序值的時 —圖2疋步驟510的一個範例,記舰13〇和14〇其中 的母-方格代表—個像素。假設此範例的電子地圖只有 曰X ^小’而且只有黑白兩色。自色和黑色的順序值分別 Γ同〇厂也就是白底優先㈣’錢才繪製黑色線段。 區二憶區13G儲存白色和黑色_色值,記憶 C 0則儲存轉換後的順序值1和2。 妄价^ &觸反齡處理方法是將記憶11 130的每個像 設順序逐—處理。這_設順序可以是由上到 的每個’也可以是其他順序,只要包含記憶區⑽ 依昭前絲立記舰14G的内容之後,處理器120 素Ο驟52〇Γ順序指定第一個進行反鑛齒處理的目前像 素的上、下然後以目前像素為中心,分別在目前像 二個上述二這四個方向執行判斷程序,以判斷每 疋万向疋否有鋸齒(步驟530)。 201112164 y^29I00-TW 31914twf.d〇e/n 本實施例中,在上、下 斷程序完全對稱,下面以上方為向執行的判 圖3為本實施例的像素相對位二程序的細節。 •目前像也就是本.實施 〜I央的P0表示 置。首先,在目前像素的蝴方法的^位 以及第三像素。其中第日=、第二像素、 (也就是圖3賴鄰像素 的順序值等於目前像素的順序值,而且目前像==素 大於第二像素的順序值,則判斷上方有鑛齒 值 像素如的述的判斷程序,則第- 方執行判斷程序,則第-像素、第二像S 行別為Ρ9、Ρδ *Ρ7。如果在目前像素的左方執 斷程序相同,向是否有鑛齒的條件和上方的判 的每==二向是!有_之後丄下-個步驟是在有鑛齒 ^, Λ =计异程序,以計算各方向的漸層階數(步 行的古十管程施例中’在上、下、左、右這四個方向執 計算程;4=完全對稱。以右方為例,在右方執行的 首先’比較第一像素㈣、第三像素㈣和目前像素⑽) 201112164 vnuy-u029I00-TW 31914twf.doc/n ”。若僅有第-像素__序值肖_ 的順序值相同,則自第-像素(P3)開始,沿右 顏色值的連續像素長度,做為右方的漸層階數。ϋ圖 匕如果观务目香像素.,..自姻一像素撕開始沿 右方计异,只有一個顏色相同的像素,也就是704本身。 所以在圖7的範例中,右方的漸層階數為卜To each of the above directions of the anti-aliasing process, a gradient coating process is performed according to the gradation order to perform the anti-mineral tooth treatment. Based on the above, the present invention uses a simple and efficient algorithm, and uses the color priority of the map to perform anti-aliasing processing, which can produce a smooth and beautiful electronic map, and has the advantages of saving computational resources and saving the memory. The above described features and advantages of the present invention will be more apparent from the following detailed description of the embodiments of the invention. [Embodiment] FIG. 1 is a block diagram of an electronic device 1A according to an embodiment of the present invention. The electronic device 100 includes a display H11, a processor 12A, a memory area U0, and a memory area 140. The memory areas 13〇 and 14〇 may belong to the same memory or may not belong to the memory. The processor 12G is responsible for drawing an electronic map between the display 11G and the memory areas 13G, 140, and performing an audio processing on the electronic ffi. The memory area 13_ stores an electronic map, that is, the color value of each pixel of the electronic map. The memory area 14 〇 stores the electronic sequence _ the order value corresponding to the color value of each image phase. 201112164 vnuy-uu29IOO-TW 31914twf.doc/n (details will be described later). The display 110 is responsible for displaying the electronic map processed by anti-aliasing. The electronic device 1 according to an embodiment of the present invention may be a car navigation device with an electronic map function, a mobile phone, a personal digital assistant, or other portable action H~弋,~-------- 4 is a process step of the electronic map of the processor 120 of the embodiment. The mapping of electronic maps has a preset priority order. First, the ocean is drawn (step 410) 'and then an urban area such as Taipei County, Taipei City is drawn (step 420). Then, a polygon area such as a school or a park is drawn (step 430). Then draw a polygonal line such as roads and railways (step =0). At this time, the polygons and polygon segments that need to be anti-aliased have been drawn, and then the anti-aliasing process (step 45〇). Then, draw a small map of the attraction (step 46〇) and the name of the scene and the route (step 470) that do not require anti-aliasing. The processor 12A can then control the display 110' to display the completed map. / In the flow of Figure 4, each temple such as the ocean, the park, and the road must use the unique-non-repetitive __ system to correctly judge the silk color overlap at the anti-mineral tooth. From the various sequences in the "sequence" of the flow of Figure 4, you can get a variety of terrain (four) should be pure value _ system priority cj = the example is all the colors used in the silk electronic map, according to (4) the order of reclamation is numbered from 1 ' The order value of all the colors is obtained. The south drawing: the order value should be lower, and the order value 1 corresponds to the color on the most other image. The electronic map of this embodiment is drawn as ^ 130, the memory area 13〇 Save ^ color value 'record __ save every - above image material 201112164 VI1 U? MK) 29I00-TW 31914twf.doc / n order value. Figure 5 is the flow chart of step 45 图 in the flow of Figure 4, that is, processing The flow chart of the anti-mineral tooth processing method performed by the device 12〇. When the step is completed, the electronic map to be treated by the anti-mineral-tooth processing is stored in the 13th area of the Jiyue District, and the memory area 140 has no data. The first step of the flow of 5 is to convert the color value of each pixel of the memory area 130 into a corresponding sequential value and store it in the corresponding position of the memory area 140 (step 51A). The other steps in Fig. 5 are called. If the processor 12 does not need the order value of a certain pixel, it directly records the $ area 140. δ| fetch, which saves the time when the color value is converted into a sequential value - Figure 2 一个 An example of step 510, where the mother-squares of the ship 13 〇 and 14 代表 represent - pixels. Suppose the electronic map of this example Only ^X^小' and only black and white. The order values of the color and black are the same as the white one. (4) 'The money is drawn in black. The area IIG 13G stores white and black _ color values, The memory C 0 stores the converted sequence values 1 and 2. The price ^ & touch-resistance processing method is to process each image of the memory 11 130 one by one. This _ set order can be up to each The 'can also be in other order, as long as the memory area (10) contains the content of the 14G of the front of the ship, the processor 120 sequentially specifies the first pixel of the current anti-mineral processing. Then, with the current pixel as the center, the judgment program is executed in the current four directions of the two above two to determine whether each of the universal directions is jagged (step 530). 201112164 y^29I00-TW 31914twf.d〇e /n In this embodiment, the program is completely up and down. It is said that the figure 3 executed in the upper direction is the detail of the pixel relative bit two program of the present embodiment. • The current image is also the P0 representation of the implementation of the I. First, the current pixel method of the pixel ^ bit and the third pixel. wherein the first day =, the second pixel, (that is, the order value of the adjacent pixel of FIG. 3 is equal to the order value of the current pixel, and the current order == prime is greater than the order value of the second pixel, then judge If there is a determination program in which the orthodontic value pixel is as described above, the first pixel and the second image S are Ρ9 and Ρδ*Ρ7. If the procedure is the same on the left side of the current pixel, the condition of whether there is a mineral tooth and the above judgment are == two directions! There are _ after the squat - one step is in the presence of the ore tooth ^, Λ = different program to calculate the gradation order in all directions (walking in the ancient ten tube process in the case of 'up, down, left, right this The calculation process is performed in four directions; 4 = complete symmetry. Taking the right side as an example, the first execution on the right side 'compares the first pixel (four), the third pixel (four), and the current pixel (10)) 201112164 vnuy-u029I00-TW 31914twf.doc/ n ”. If only the order value of the first-pixel __order value _ is the same, the continuous pixel length along the right color value starts from the first pixel (P3), and is the gradient order on the right side. If you look at the pixel, the pixel is torn to the right and there is only one pixel of the same color, which is 704 itself. So in the example of Figure 7, the right step is Number is
面’右僅有第三像素(P9)的順序值與目前像素 (二〇)的順序值減’則自第三像素㈣開始,沿右方計算呈 =目同顏色值的連續像素長度,做為右方的漸層階數。以 為例’如果802是目前像素,自其第三像素804開 ^右方計算,共有三個顏色相同的像素。所以在此範例 丄右方的漸層階數為3。如果8〇6是目前像素,則自盆 ^像素_開始沿右方計算,共有四個顏色相同的像 素。所以在此範例中,右方的漸層階數為4。 比命另丄方面’ t第—像素(Ρ3)和第三像素(Ρ9)的順序值 二一目剛像素(P0)的順序值相同,則以上述方式分別計算 =像素(Ρ3)和第三像素(Ρ9)的具有相關色值的連續像 素長度三並取其中較短者做為右方的漸層階數。 丄^只知例中,在其餘二個方向執行的計算程序和右方 十异㈣完全對稱,其細節可從右料算程序類推而 侍,因此不予贅述。 計算各方向的漸層階數之後,下一個步驟是根據各方 ^漸層階數以及預設條件,蚊各方向是否需要反鑛齒 &理(步驟55G)° ® 6是上述預設條件的詳細流程。首 31914twf.doc/n 20111216429I00.tw 先,檢查預設條件所判斷的方向(步驟610)。如果是上 方或下方,就檢查此方向的漸層階數是否小於預設常數(步 驟620 )。本實施例的預5又吊數為2。如果此方向的漸層階 -·數小於货設常數,·則決-定此方-向-不需要反鋸齒處理(步驟 630) ’否則決定此方向需要反据齒處理(步驟640)。 接下來,回到步驟610,如果預設條件所判斷的是右 方或左方’就檢查此方向的漸層階數是否小於預設常數(步 驟650)。如果此方向的漸層階數小於預設常數,就檢查 上方或下方是否具有大於或等於預設常數的漸層階數(步 驟660)。如果是,則決定此方向不需要反銀齒處理(步 驟670),否則決定此方向需要反鋸齒處理(步驟68〇)。 此外,在步驟㈣的檢查巾,如果此方向的漸層階數大於 或等於預財數,就決定此方向需要反職處理(步驟 在圖6的流程令,可將上下方向和左右方向互換,互 換後的流程也可㈣行正顧反_處理。 在需處理之後’下-個_ 層塗色程序,^ 根據其漸層階數執行潮 層塗色程序仃反織處理(步驟56G)。所謂的漸 的相鄰像素;入每的方向上’在目前像素 色值之間的漸層色值個::,的顏色值和目前像素的顏 量等於執行漸層塗人漸層色值的相鄰像素數 顏色值在上述漸的Γ的漸層階數。目前像素的 斫曰色值的比重與對應的相鄰像素和目前像 201112164 v 11 v;7-i/029I00-TW 31914twf.d〇c/n 素的距離呈反比。.. j兀成目七像素的反鑛齒處理之後處理器檢查是 否記憶區130的所有像素都已經處理完畢(步驟570)。 1果是’顧至韻·束。‘如果還有像秦未處理·,處,理器120 ::照t的預設順序指定下一個目前像素(步驟580), 530,對下一個目前像素進行反鑛齒處理。 如士二命為例’根據圖6的流程可知,像素702的左方 理,像素704的左方需㈣齒處 以上方向的漸層階 層色值的公式如下。為例’漸層階數為1時’漸 GC(R1) = C(P〇) /2 + C(R1) / 2 色值為填入像素7G2的右方相鄰像素的漸層 ::〇2的顏色值鄉示目前像素7。2 = =彥=。圖7左邊是反鑛齒處理之前的電子地圖, ϊ = 理之後的電子地圖。由於此範例的電 兩色,填人的漸層❹介於黑色與白色之 以圖8Α為例,像辛8〇2的& 漸層階數為3。因此,像㈣ 要填入漸層色,漸層色值的料^料二俯目鄰像素需 GC(Rl) = C(P0)*3/4 + C(Rl)M/4 GC(R2) = C(P0) * 2/4 + C(R2” 2/4 11 201112164The surface has only the third pixel (P9) sequence value and the current pixel (two 〇) sequence value minus ' then from the third pixel (four), along the right side calculated = the same color value of the continuous pixel length, do The gradient order to the right. For example, if 802 is the current pixel, it is calculated from the third pixel 804 to the right, and there are three pixels of the same color. So in this example, the gradient order on the right is 3. If 8 〇 6 is the current pixel, then from the basin ^ pixel _ starting along the right side, there are four pixels of the same color. So in this example, the gradient order on the right is 4. In the case where the order value of the second pixel (Ρ3) and the third pixel (Ρ9) is the same as the order value of the pixel (P0), the pixel (Ρ3) and the third are respectively calculated in the above manner. The contiguous pixel length of the pixel (Ρ9) having the associated color value is taken as the gradation order in which the shorter one is the right side. In the case of 丄^, the calculation program executed in the other two directions is completely symmetrical with the right side (4), and the details can be analogized from the right calculation program, so it will not be described. After calculating the gradation order in each direction, the next step is based on the gradual order of the parties and the preset conditions. Whether the mosquitoes need anti-mineral teeth in all directions (step 55G) ° 6 is the above preset condition Detailed process. First 31914twf.doc/n 20111216429I00.tw First, the direction determined by the preset condition is checked (step 610). If it is above or below, check if the gradient order in this direction is less than the preset constant (step 620). The pre-5 hoist number of this embodiment is 2. If the gradation--number in this direction is less than the set-up constant, then the ----no anti-aliasing process is required (step 630)' otherwise it is determined that this direction requires the inverse tooth processing (step 640). Next, returning to step 610, if the preset condition determines whether it is right or left, it is checked whether the gradation order of the direction is less than a preset constant (step 650). If the gradation order in this direction is less than the preset constant, it is checked whether there is a gradation order greater than or equal to the preset constant above or below (step 660). If so, it is determined that this direction does not require anti-silver tooth processing (step 670), otherwise it is determined that this direction requires anti-aliasing (step 68). In addition, in the inspection towel of step (4), if the gradation order of the direction is greater than or equal to the pre-finance number, it is determined that the direction needs to be counter-processed (the steps in the flow of FIG. 6 can be interchanged between the up-down direction and the left-right direction, The process after the interchange can also be processed in the fourth step. After the processing, the 'lower-one layer coloring program is executed, and the tidal coloring process is performed according to the gradient order (step 56G). The so-called progressive adjacent pixels; the direction of the progressive color values between the current pixel color values in each direction: the color value of the current pixel and the current pixel are equal to the gradient color value The color value of the adjacent pixel number is in the above-mentioned progressive gradation step. The current pixel's color value is proportional to the corresponding adjacent pixel and the current image is 201112164 v 11 v; 7-i/029I00-TW 31914twf.d The distance of 〇c/n is inversely proportional.. j兀 After the anti-mineral tooth processing of seven pixels, the processor checks whether all the pixels of the memory area 130 have been processed (step 570). ·Bundle. 'If there is still something like Qin Wei, ·,,,,,,,,,,,,, The next current pixel is designated (steps 580), 530, and the next current pixel is subjected to anti-mineral processing. For example, according to the flow of FIG. 6, the left side of the pixel 702 and the left side of the pixel 704 are known. The formula for the gradation level color value in the direction above (4) the tooth is as follows. For example, when the gradation order is 1, the gradual GC(R1) = C(P〇) /2 + C(R1) / 2 chromatic value is Fill in the gradient of the adjacent pixel on the right side of the pixel 7G2: the color value of 〇2 shows the current pixel 7. 2 = = Yan =. The left side of Figure 7 is the electronic map before the anti-mineral tooth processing, and the electronic map after the ϊ = Because of the electric two colors of this example, the filling gradient is between black and white, as shown in Fig. 8Α, and the gradation order of 辛8〇2 is 3. Therefore, like (4) to fill in The color of the layer, the color of the gradation color is required to be GC(Rl) = C(P0)*3/4 + C(Rl)M/4 GC(R2) = C(P0) * 2/ 4 + C(R2) 2/4 11 201112164
.J29I00-TW 31914twf.doc/n GC(R3) = C(P0) * 1/4 + C(R3) * 3/4 其中GC(R1)、GCO^'GC^)分別表示填入像素8〇2 的右方第一個、第二個、以及第三個相鄰像素的漸層色值, C(P一0)表,示像素802呦箭色值…观1.).、C(R2卜峨 表不像素802的右方第-個、第二個、以及第三個相鄰像 素原來的顏色值。 一般而言’如果目前像素的某個方向需要反鋸齒處理 而且其漸層階數為n,則目前像素在此方向的η個相鄰像 素需要填入漸層色,漸層色值的公式如下。 # GC(Ni) = C(P0) * (n+l-i)/(n+l) + C(Ni) * i/(n+l) 其中i為從1至η的正整數,GC(Ni)表示填入目前像 素在此方向的第1個相鄰像素的漸層色值,C(P0)表示目前 像素的顏色值,C(Ni)則表示目前像素在此方向的第i個相 鄰像素原來的顏色值。 圖8A是反鋸齒處理之前的電子地圖’圖是圖 的縮小圖,其中有很明顯的鋸齒。圖9Λ是經過反鋸齒處 ,的電子地圖,圖9B是圖9A的縮小圖。原先的多邊線段 籲 疋黑色’背景是白色’依照上述公式,在相鄰像素填入漸 層灰色之後,如圖9B所示,可以去除鋸齒,使電子地圖 較為平滑美觀。圖和圖11是另-組範例,其中圖10 和圖11分別是反鋸齒處理之前和之後的電子地圖。 曰~以上的反鋸齒處理方法都是以單色地圖為範例,如果 疋^色地圖’可以將其色彩空間(color space)的每個分量分 開處S °例如使用RGB (即紅、,綠、藍三原色)色彩空間 12 201112164 vuuy-uu29I00-TW 31914twf.doc/n 、個分量分開,各自進行 的電子地圖,可將其紅、綠 反鑛齒處理之後再合併。 „鑛齒處理方法只需要在儲存電子地圖的 -雜區BG.攝增.加儲存祕㈣娜 的某些實施例中,每個像素的顏色值長度為%位元,^子 地圖使用的顏色不超過扮種,每個像素的顺序值只需要 8位το。所以在這些實施例中,本發明增加的記憶區⑽, ,、§己憶空間只需要原有的記憶區13〇的四分之一。 本發明的反織處理方法不影響原本㈣子地圖繪 製時間’而是在地_製完成之後再處理反_。此外, ^發明的反齡處理方奸針對需要處理⑽素做漸層運 算’可減少非必要的額外計算時間。 以下例舉-些實驗數據,說明本發明一實施例的反鑛 齒處,方法的效能。本貫施例的電子裝置使用195 MHz的 處=器,電子地圖的解析度為32〇χ24〇。下面的表】比較 本實施例中各種反鑛齒處理方法的記憶體消耗.J29I00-TW 31914twf.doc/n GC(R3) = C(P0) * 1/4 + C(R3) * 3/4 where GC(R1), GCO^'GC^) indicate that the pixel is filled in 8〇 The gradation color value of the first, second, and third adjacent pixels on the right side of the 2, C (P 0) table, showing the pixel 802 呦 arrow color value... View 1.)., C (R2 The dice table does not represent the original color values of the first, second, and third adjacent pixels on the right side of the pixel 802. Generally speaking, if the current direction of the pixel requires anti-aliasing and its gradation order For n, the n neighboring pixels of the current pixel in this direction need to be filled with a gradation color, and the formula of the gradation color value is as follows: # GC(Ni) = C(P0) * (n+li)/(n+ l) + C(Ni) * i/(n+l) where i is a positive integer from 1 to η, and GC(Ni) represents the gradation color value of the first adjacent pixel filled in the current pixel in this direction C(P0) represents the color value of the current pixel, and C(Ni) represents the original color value of the i-th adjacent pixel of the current pixel in this direction. FIG. 8A is an electronic map before the anti-aliasing process. Zoom out the picture, which has obvious sawtooth. Figure 9 is an electronic map after anti-aliasing, Figure 9B Figure 9A is a reduced view. The original polygonal line is called black. The background is white. According to the above formula, after the adjacent pixels are filled with the gradient gray, as shown in FIG. 9B, the sawtooth can be removed to make the electronic map smoother and more beautiful. Figure 11 and Figure 11 are another example of the group, wherein Figure 10 and Figure 11 are the electronic maps before and after the anti-aliasing process. 曰 The above anti-aliasing methods are all based on monochrome maps. 'You can separate each component of its color space by S °, for example, using RGB (ie, red, green, and blue primary colors) color space 12 201112164 vuuy-uu29I00-TW 31914twf.doc/n, separate components, The electronic maps that are carried out can be combined with the red and green anti-mineral teeth. „The mineral tooth treatment method only needs to store the electronic map - the miscellaneous area BG. The increase. Some examples of the storage secret (4) Na In the case where the color value of each pixel is % bit length, the color used by the map does not exceed the size of the seed, and the order value of each pixel only needs 8 bits τ. Therefore, in these embodiments, the memory area of the present invention is increased. , , § 忆 忆 space only needs one quarter of the original memory area 13 。. The anti-weaving processing method of the present invention does not affect the original (four) sub-map drawing time 'but after the ground _ system is completed and then processed inverse _ In addition, the invention of the anti-age treatment of the traitor for the need to process (10) to do the gradation operation 'can reduce the unnecessary extra calculation time. The following exemplification - some experimental data, illustrating the anti-mineral tooth of an embodiment of the present invention, The effectiveness of the method. The electronic device of the present embodiment uses a 195 MHz device, and the resolution of the electronic map is 32 〇χ 24 〇. The following table] compares the memory consumption of various anti-mineral tooth treatment methods in this embodiment.
201112164 v ii u7-\7u29I00-TW 31914twf.doc/n 由表l可知,本發明的反鋸齒處理方法,其記憶體消 耗只比不做反鋸齒處理的狀況多出3.3%,只比AGG函式 庫多出2.2%。 下面·的表2比較表1當中各種反鋸齒處理方法繪製十…· 二張不同電子地圖所需的時間。 表2,反鋸齒處理方法的電子地圖繪製時間比較 處理方法和繪製時間(微秒) 無反鋸齒 處理 本發明 方法 AGG 函式庫 2x2 超取樣 4x4 超取樣 地圖'— 27 172 96 520 1667 地圖二 21 142 80 530 1898 地圖二 33 181 217 604 1858 地圖四 54 224 346 655 2054 地圖五 61 226 359 643 1996 地圖六 152 388 1039 828 2245 地圖七 447 739 2536 1840 2922 地圖八 522 729 5496 1660 3261 地圖九 253 459 1225 880 2422 地圖十 230 433 1166 1570 3075 地圖十一 203 353 1687 2176 3182 地圖十二 134 236 162 882 1902 平均時間 178 357 1201 1066 2374 14 201112164201112164 v ii u7-\7u29I00-TW 31914twf.doc/n It can be seen from Table 1 that the anti-aliasing processing method of the present invention consumes only 3.3% more memory than the anti-aliasing process, only the AGG function. The library is 2.2% more. Table 2 below compares the various anti-aliasing methods in Table 1 to plot the time required for two different electronic maps. Table 2, Electronic map drawing time comparison processing method and drawing time (microseconds) of anti-aliasing processing method No anti-aliasing processing AGG library 2x2 oversampling 4x4 oversampling map '- 27 172 96 520 1667 Map 2 142 80 530 1898 Map II 33 181 217 604 1858 Map IV 54 224 346 655 2054 Map V 61 226 359 643 1996 Map VI 152 388 1039 828 2245 Map Seven 447 739 2536 1840 2922 Map Eight 522 729 5496 1660 3261 Map Nine 253 459 1225 880 2422 Map ten 230 433 1166 1570 3075 Map eleven 203 353 1687 2176 3182 Map twelve 134 236 162 882 1902 Average time 178 357 1201 1066 2374 14 201112164
Viiuy-uu29I00-TW 31914twf.doc/n 〇,不糸月的反鋸齒處理方法的地圖繪製時 間退少於其餘三種反織處理方法。因此本發明的電子梦 置與其執仃的反鑛齒處理方法,不僅可提供平滑美觀的^ ,子地圖節省·脊源和#省鱗伽優點。 雖然本發明已以實施例揭露如上,然其並非用以限定 所屬技術領域中具有通常知識者,在不脫離 本發月之精神和範圍内,當可作些許之更動與潤倚,故本 發明之保護範圍當視後附之申請專利範圍所界定者為準。 【圖式簡單說明】 圖1是依照本發明一實施例的一種電子裝置的方塊 圖。 t 圖2繪示圖1的記憶區130和140的儲存内容。 程圖 圖3是依照本發明一實施例的像素相對位置示意圖。 圖4是依照本發明一實施例的一種地圖繪製方法的流Viiuy-uu29I00-TW 31914twf.doc/n 〇, the mapping time of the anti-aliasing method of the month is less than the other three anti-weaving methods. Therefore, the electronic dream device of the present invention and its stubborn anti-mineral tooth processing method can not only provide smooth and beautiful ^, sub-map saving, ridge source and # provincial scaly advantages. The present invention has been disclosed in the above embodiments, but it is not intended to limit the scope of the present invention, and the present invention may be modified and manipulated without departing from the spirit and scope of the present invention. The scope of protection is subject to the definition of the scope of the patent application. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram of an electronic device in accordance with an embodiment of the present invention. FIG. 2 illustrates the storage contents of the memory areas 130 and 140 of FIG. 1. Figure 3 is a schematic diagram of relative positions of pixels in accordance with an embodiment of the present invention. 4 is a flow of a map drawing method according to an embodiment of the invention.
圖5是圖4其中步驟450的流程p。 圖6是圖5其中步驟550的流程圖。 — 圖7、圖8A、圖8B、圖9A和圖9B是依照本發明一 實施例的反鋸齒處理的示意圖。 圖1〇和圖11是依照本發明一實施例的反鋸齒處理 效果示意圖。 15 201112164 vii w-uu29I00-TW 31914twf.doc/n 【主要元件符號說明】 1、2 :像素順序值 100 :電子裝置 --* '辱貝.-r·- .-λ - 120 :處理器 130、140 :記憶區 410-470、510-580、610-680 :流程步驟 702-706、802-808 :像素 P0-P9 :像素相對位置Figure 5 is a flow chart p of step 450 of Figure 4. 6 is a flow chart of step 550 of FIG. - Figures 7, 8A, 8B, 9A and 9B are schematic views of anti-aliasing processing in accordance with an embodiment of the present invention. 1A and 11 are schematic views showing the effect of anti-aliasing processing according to an embodiment of the present invention. 15 201112164 vii w-uu29I00-TW 31914twf.doc/n [Description of main component symbols] 1, 2: Pixel order value 100: Electronic device--* 'Miscellaneous.-r·- .-λ - 120 : Processor 130 , 140: memory areas 410-470, 510-580, 610-680: process steps 702-706, 802-808: pixels P0-P9: pixel relative position
1616