JP5199512B2 - Program and image processing method - Google Patents

Program and image processing method Download PDF

Info

Publication number
JP5199512B2
JP5199512B2 JP2012260042A JP2012260042A JP5199512B2 JP 5199512 B2 JP5199512 B2 JP 5199512B2 JP 2012260042 A JP2012260042 A JP 2012260042A JP 2012260042 A JP2012260042 A JP 2012260042A JP 5199512 B2 JP5199512 B2 JP 5199512B2
Authority
JP
Japan
Prior art keywords
image data
rgb
darkening
element image
html file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2012260042A
Other languages
Japanese (ja)
Other versions
JP2013059110A (en
Inventor
拓男 紀平
Original Assignee
株式会社 ディー・エヌ・エー
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社 ディー・エヌ・エー filed Critical 株式会社 ディー・エヌ・エー
Priority to JP2012260042A priority Critical patent/JP5199512B2/en
Publication of JP2013059110A publication Critical patent/JP2013059110A/en
Application granted granted Critical
Publication of JP5199512B2 publication Critical patent/JP5199512B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Color Image Communication Systems (AREA)
  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Description

この発明は、ウエブアプリケーションの基盤となっているホームページ記述言語HTMLの最新バージョンHTML5による画像操作手法に関し、具体的には、HTMLのうちcanvas要素を使用可能なものに対応したブラウザーに指定画像を指定特性で色変換して表示させる処理を行わせるHTMLファイルに関する。なお、この明細書では、ブラウザーという語を、プログラムを指す語としてだけでなく、ブラウザーが稼働するコンピューターを指す語としても使用する。   The present invention relates to an image manipulation technique based on the latest version HTML5 of a homepage description language HTML that is the basis of a web application. Specifically, a designated image is designated in a browser corresponding to an HTML that can use a canvas element. The present invention relates to an HTML file that performs a process of color-converting and displaying with characteristics. In this specification, the word browser is used not only as a word indicating a program but also as a word indicating a computer on which the browser is operated.

HTMLファイルはブラウザーにより解釈され、HTMLファイル制作者の意図したホームページが表示される。つまり、HTMLファイルはHTML言語により記述され、ブラウザーに特定のホームページの表示処理を実行させるコンピュータープログラムの一種であるといえる。したがって、この発明を適用して記述されたHTMLファイルはプログラムであり、この発明はプログラムに関する発明である。   The HTML file is interpreted by the browser, and the home page intended by the HTML file creator is displayed. That is, the HTML file is described in the HTML language, and can be said to be a kind of computer program that causes a browser to execute a specific homepage display process. Therefore, the HTML file described by applying the present invention is a program, and the present invention relates to a program.

さらに、Adobe Flash(登録商標)などによって普及しているSWFファイルを本発明に係るHTMLファイルに自動変換するファイル変換方法およびファイル変換プログラムが、本発明の射程に含まれている。   Furthermore, the scope of the present invention includes a file conversion method and a file conversion program for automatically converting a SWF file popularized by Adobe Flash (registered trademark) into an HTML file according to the present invention.

出願人はMobage(商標登録出願中)と名付けたソーシャルメディアを運営し、怪盗ロワイヤル(登録商標)などの多くの種類のゲームコンテンツを携帯電話機向けに提供している。こうしたゲームコンテンツの多くはHTMLファイルやSWFファイルにより構成されており、ゲーム中のアニメーション表現はSWFファイルにより創りだされている。よく知られているように、SWFファイルを制作者の意図どおりに情報端末のブラウザーで再生するには、情報端末のブラウザーにSWFファイルを実行するプログラム(Flash Player(登録商標)が有名である)が組み込まれている必要がある。   The applicant operates a social media named “Mobage” (pending trademark registration), and provides many kinds of game contents such as Kaito Royale (registered trademark) for mobile phones. Many of these game contents are composed of HTML files and SWF files, and animation expressions in the game are created by SWF files. As is well known, a SWF file is played on the browser of the information terminal in order to play it on the browser of the information terminal as intended by the creator (Flash Player (registered trademark) is famous). Must be built in.

大流行のスマートフォンやタブレット端末などと呼ばれる最新型の情報端末、その他一部の情報端末では、ブラウザーがFlash Playerに対応していない機種がある。こうしたFlash Playerに対応していないブラウザーでは、ゲームコンテンツ中のSWFファイルによるアニメーション表現を正しく再生することができない。一方、Flash Player非対応の最新型の情報端末では、ブラウザーがHTML5に対応しているものが多い。   Some of the latest information terminals, such as the popular smartphones and tablet terminals, and some other information terminals, browsers do not support Flash Player. Such browsers that do not support Flash Player cannot correctly reproduce the animation expression by the SWF file in the game content. On the other hand, many of the latest information terminals that do not support Flash Player have browsers that support HTML5.

ゲームコンテンツ中のSWFファイルによるアニメーション表現の典型的な手法の1つを説明する。ゲームキャラクタのフルカラーの画像データがある。この画像データを原画像データとし、これを登場させる場面のゲーム状況に応じて、原画像データの色をさまざまに変化させるという手法である。つまり、1つの原画像データの色を適宜に変換しながらさまざまなゲーム場面に登場(表示)させるのである。   One typical technique for expressing an animation using a SWF file in game content will be described. There is full color image data of the game character. This image data is used as original image data, and the color of the original image data is changed variously according to the game situation of the scene where it appears. That is, it appears (displays) in various game scenes while appropriately converting the color of one original image data.

SWF形式では、上記の手法を簡便に使用できるように、原画像データに対する色変換特性を2種類のパラメータ「MultTerm」および「AddTerm」で表現することとしている。   In the SWF format, the color conversion characteristics for the original image data are expressed by two types of parameters “MultTerm” and “AddTerm” so that the above method can be used easily.

「MultTerm」は、原画像データの全ピクセルのRGB輝度値を指定比率で低下させるパラメータであり、R輝度値・G輝度値・B輝度値の減衰率をそれぞれRedMultTerm・GreenMultTerm・BlueMultTermにより個別に指定することができる。   “MultTerm” is a parameter that reduces the RGB luminance value of all pixels of the original image data by the specified ratio, and specifies the attenuation rate of R luminance value, G luminance value, and B luminance value individually by RedMultTerm, GreenMultTerm, and BlueMultTerm, respectively. can do.

「AddTerm」は、原画像データの全ピクセルのRGB輝度値に対して指定値だけ加算または減算するパラメータであり、R輝度値・G輝度値・B輝度値に対する加減算値をそれぞれRedAddTerm・GreenAddTerm・BlueAddTermにより個別に指定することができる。   “AddTerm” is a parameter for adding or subtracting a specified value to or from the RGB luminance value of all pixels of the original image data. Can be specified individually.

SWFファイルにおいて原画像データを指定する記述と色変換パラメータ「MultTerm」および「AddTerm」の値を記述しておくと、SWFファイルを実行するプログラムがこれを解釈し、原画像データを指定特性で色変換した画像データを高速で生成して表示する。   If the description specifying the original image data and the values of the color conversion parameters “MultTerm” and “AddTerm” are described in the SWF file, the program that executes the SWF file interprets this, and the original image data is colored with the specified characteristics. The converted image data is generated and displayed at high speed.

===発明が解決しようとする課題===
この発明を創作するそもそもの契機は、上述したSWFファイルとFlash Playerの組み合わせにおける原画像を色変換して高速表示する機能を、Flash Playerに非対応でありHTML5に対応したブラウザーとHTMLファイルの組み合わせにおいて実現しようということである。
=== Problems to be solved by the invention ===
The original opportunity to create this invention is the combination of the above-mentioned SWF file and Flash Player, which is a combination of a browser and HTML file that is not compatible with Flash Player and that supports high-speed display of the original image by color conversion. It is to achieve in.

上述した色変換の処理は、煎じ詰めると、原画像データの全ピクセルのRGB各輝度値に一定値を乗じるとともに、乗算結果に別の一定値を加算または減算することである。そこで、HTMLファイル中に JavaScript で記述したプログラムの機能により、HTML5のAPIを使い、原画像データの各ピクセルのRGB各輝度値を1ピクセルずつ逐次に取得して前記の計算を行い、計算結果で原画像データの各ピクセルを更新する処理をブラウザーに実行させる方式が試みられた。   The above-described color conversion process is to multiply the RGB luminance values of all the pixels of the original image data by a certain value and add or subtract another certain value to the multiplication result. Therefore, using the function of the program described in JavaScript in the HTML file, using the HTML5 API, the RGB luminance values of each pixel of the original image data are sequentially obtained one pixel at a time, and the above calculation is performed. An attempt was made to cause the browser to execute a process for updating each pixel of the original image data.

この試みは完全に失敗であった。処理対象の画像データのピクセル数はきわめて多いので、HTML5のAPIで規定されたピクセル操作機能を使い、HTMLファイルからブラウザーにピクセル操作を指示して画像データの全ピクセルのデータを更新するのにはかなりの時間がかかり、ブラウザーがHTMLファイルを読み込んでから色変換後の画像が表示されるまでの時間が許容できない長さになる。   This attempt was completely unsuccessful. Since the number of pixels of the image data to be processed is extremely large, it is necessary to use the pixel operation function defined by the HTML5 API to instruct the browser to perform pixel operation from the HTML file and update the data of all pixels of the image data It takes a considerable amount of time, and the time from when the browser reads the HTML file until the image after color conversion is displayed is unacceptably long.

===発明の概要===
HTML5では、ブラウザーによりビットマップ形式の画像を描いたり色を塗ったりすることを可能にするcanvas要素の仕様が策定された。HTMLファイルにおいてcanvas要素を使った プログラムを記述することにより、指定した画像データをビットマップキャンバスに読み込み、それを下地画像とし、その上に図形を描いて指定のモードで合成し、あらたな画像をビットマップキャンバスに生成して表示することができる。
=== Summary of Invention ===
In HTML5, a canvas element specification that allows a browser to draw and paint a bitmap image has been established. By writing a program that uses the canvas element in an HTML file, the specified image data is read into the bitmap canvas, it is used as the base image, a figure is drawn on it, and the new image is composed in the specified mode. It can be generated and displayed on a bitmap canvas.

この発明に係るHTMLファイルにおいては、まず、指定した画像データ(原画像データ)をビットマップキャンバスに読み込む。そして、この原画像データに対して上述したようなピクセル操作を行うのではなく、原画像データを下地とし、適切な合成モードに設定した上で原画像データの全域を適切な色で均一に塗りつぶす、という処理を何回か行うことで原画像データの色を変換して表示するプログラミング方式を創作した。このプログラミング方式に従ってHTMLファイルを記述することで、ブラウザーがHTMLファイルを読み込んで色変換後の画像を表示するのに要する処理時間がきわめて短くなる。   In the HTML file according to the present invention, first, designated image data (original image data) is read into a bitmap canvas. Then, instead of performing the pixel operation as described above on the original image data, the original image data is used as a background, and an appropriate composition mode is set, and the entire area of the original image data is uniformly painted with an appropriate color. A programming method was created by converting the color of the original image data and displaying it by performing the above process several times. By describing the HTML file in accordance with this programming method, the processing time required for the browser to read the HTML file and display the color-converted image becomes extremely short.

===発明の核心===
この発明の核心とするところは、つぎの事項(1)〜(9)により特定されるHTMLファイルである。
(1)HTMLのうちcanvas要素を使用可能なものに対応したブラウザーに指定画像を指定特性で色変換して表示させる処理を行わせるHTMLファイルであること
(2)HTMLファイルは、記述1〜記述5を含むこと
(3)記述1は、ビットマップ展開された3個の同じ原画像データを生成させること
(4)記述2は、darker合成モードにより、高輝度R原色データを原画像データに均一に上書きさせ、高輝度G原色データを原画像データに均一に上書きさせ、高輝度B原色データを原画像データに均一に上書きさせ、原画像データを三原色分解したR原画像データ・G原画像データ・B原画像データを生成させること
(5)記述3は、原画像データのRGBの各輝度値を減衰させる割合いに対応した、R減衰処理用の輝度値・透明度と、G減衰処理用の輝度値・透明度と、B減衰処理用の輝度値・透明度を含むこと
(6)記述3は、標準描画モード等により、R減衰処理用の輝度値・透明度の黒データをR原画像データに均一に上書きさせることにより暗化R画像データを生成させ、G減衰処理用の輝度値・透明度の黒データをG原画像データに均一に上書きさせることにより暗化G画像データを生成させ、B減衰処理用の輝度値・透明度の黒データをB原画像データに均一に上書きさせることにより暗化B画像データを生成させること
(7)記述4は、原画像データのRGBの各輝度値に加算または減算する値に対応した、R加減算処理用の輝度値・透明度のR原色データと、G加減算処理用の輝度値・透明度のG原色データと、B加減算処理用の輝度値・透明度のB原色データを含むこと
(8)記述4は、加算の場合はlighter 合成モードにより、減算の場合はdarker合成モードにより、R加減算処理用の輝度値・透明度のR原色データを暗化R画像データに均一に上書きさせることにより暗化シフトR画像データを生成させ、G加減算処理用の輝度値・透明度のG原色データを暗化G画像データに均一に上書きさせることにより暗化シフトG画像データを生成させ、B加減算処理用の輝度値・透明度のB原色データを暗化B画像データに均一に上書きさせることにより暗化シフトB画像データを生成させること
(9)記述5は、暗化シフトR画像データと暗化シフトG画像データと暗化シフトB画像データを合成させて色変換後の画像データとして表示出力させること
=== The core of the invention ===
The core of the present invention is an HTML file specified by the following items (1) to (9).
(1) It is an HTML file that causes a browser that supports the canvas element that can use the canvas element to perform processing for color-converting and displaying a specified image with specified characteristics. (2) The HTML file is described in the description 1 to description. (3) Description 1 generates three identical original image data that have been bitmap-expanded. (4) Description 2 uniformly converts high-luminance R primary color data into original image data in the darker synthesis mode. R original image data / G original image data obtained by uniformly overwriting the original image data with the high luminance G primary color data, overwriting the high luminance B primary color data with the original image data uniformly, and separating the original image data into the three primary colors. Generation of B original image data (5) Description 3 describes the luminance value / transparency for R attenuation processing corresponding to the ratio of attenuating each luminance value of RGB of the original image data, and G Including luminance value / transparency for attenuation processing and luminance value / transparency for B attenuation processing (6) Description 3 describes that the black data of the luminance value / transparency for R attenuation processing is converted to the R original in the standard drawing mode. The darkened R image data is generated by uniformly overwriting the image data, and the darkened G image data is generated by uniformly overwriting the G original image data with the black value of the brightness value and transparency for G attenuation processing. , Generation of darkened B image data by uniformly overwriting B original image data with black data of luminance value / transparency for B attenuation processing (7) Description 4 describes RGB luminance values of the original image data R addition / subtraction processing brightness value / transparency R primary color data, G addition / subtraction processing brightness value / transparency G primary color data, and B addition / subtraction processing brightness value / transparency B primary color day (8) In description 4, the lighter composition mode is used for addition and the darker composition mode is used for subtraction, so that the R primary color data for luminance value / transparency for R addition / subtraction processing is uniformly converted into darkened R image data. The darkening shift R image data is generated by overwriting, and the darkening G image data is generated by uniformly overwriting the darkening G image data with the G primary color data of the luminance value / transparency for G addition / subtraction processing, The dark shift B image data is generated by uniformly overwriting the dark B image data with the B primary color data of the brightness value and transparency for the B addition / subtraction process. (9) Description 5 includes the dark shift R image data and The darkening shift G image data and the darkening shift B image data are combined and displayed and output as image data after color conversion.

この発明のHTMLファイルの核心部分をなすプログラムの記述例(実施例ではJavaScriptを用いているが、実際にはプログラム言語は問わない)(前半)Description example of the program that forms the core of the HTML file of the present invention (in the embodiment, JavaScript is used, but the programming language is not particularly limited) (first half) この発明のHTMLファイルの核心部分をなすプログラムの記述例(実施例ではJavaScriptを用いているが、実際にはプログラム言語は問わない)(後半)Description example of the program that forms the core of the HTML file of the present invention (JavaScript is used in the embodiment, but the programming language is not particularly limited) (second half)

===SWFファイルから本発明のHTMLファイルへ===
以下では、本発明のファイル変換方法(ファイル変換プログラム)により既存のSWFファイルを本発明のHTMLファイルに変換した実施例として説明する。また、変換元のSWFファイルは色変換処理の対象となる原画像やその他のテキスト情報などを含んだ文書情報が規定されているところ、以下においては、色変換処理の対象となる原画像にのみ着目し、変換後のHTMLファイルにおいて原画像を色変換処理して表示出力するためのプログラム論理を摘出して説明する。
=== From SWF file to HTML file of the present invention ===
In the following, an example in which an existing SWF file is converted into an HTML file of the present invention by the file conversion method (file conversion program) of the present invention will be described. In addition, in the conversion source SWF file, document information including an original image to be subjected to color conversion processing and other text information is defined. In the following description, only the original image to be subjected to color conversion processing is specified. Attention is focused on the program logic for color-converting and displaying the original image in the converted HTML file.

===原画像とMultTermとAddTerm ===
ファイル変換プログラムにより、SWFファイルから抽出した色変換対象である原画像を特定する画像ファイル名「test.png」を図1A・図1Bに示したHTMLファイル実施例の行番号64に記述している。また、この原画像を色変換処理の特性を規定する乗算パラメータ「MultTerm」と加減算パラメータ「AddTerm」を上記SWFファイルから抽出し、HTMLファイル実施例の行番号5と6に記述している。
=== Original image, MultTerm, and AddTerm ===
An image file name “test.png” for specifying an original image which is a color conversion target extracted from the SWF file by the file conversion program is described in line number 64 of the HTML file embodiment shown in FIGS. 1A and 1B. . Further, a multiplication parameter “MultTerm” and an addition / subtraction parameter “AddTerm” that define the characteristics of the color conversion process are extracted from the SWF file and described in line numbers 5 and 6 of the HTML file embodiment.

HTMLでは、RGBの最大輝度値を255としている。これを前提とし、行番号5の記述 {R: 50, G: 75, B: 200} は、ファイル名「test.png」のビットマップ画像の各ピクセル輝度値に以下の乗算処理を加えることを示している。
(1)R輝度値に(50/255)を乗じる。
(2)G輝度値に(75/255)を乗じる。
(3)B輝度値に(200/255)を乗じる。
In HTML, the maximum luminance value of RGB is set to 255. Based on this assumption, the description of line number 5 {R: 50, G: 75, B: 200} adds the following multiplication process to each pixel brightness value of the bitmap image with the file name “test.png”: Show.
(1) Multiply the R luminance value by (50/255).
(2) Multiply the G luminance value by (75/255).
(3) Multiply the B luminance value by (200/255).

行番号6の記述 {R: 127, G: 56, B: -100}は、上記の乗算後の各ピクセル輝度値に以下の加減算処理を行うことを示している。
(4)R輝度値の乗算結果に127を加算する。
(5)G輝度値の乗算結果に56を加算する。
(6)B輝度値の乗算結果に100を減算する。
以上が元となるSWFファイルから抽出した情報に基づいて作成されたHTMLファイルの記述の一部である。
The description {R: 127, G: 56, B: -100} in line number 6 indicates that the following addition / subtraction processing is performed on each pixel luminance value after the multiplication.
(4) 127 is added to the multiplication result of the R luminance value.
(5) 56 is added to the multiplication result of the G luminance value.
(6) Subtract 100 from the multiplication result of the B luminance value.
The above is a part of the description of the HTML file created based on the information extracted from the original SWF file.

===原画像の三原色分解===
HTMLファイル実施例では、行番号9〜30により色変換処理の準備をし、行番号33〜36の処理を色を変えて3回行うことで、ファイル名「test.png」の原画像を三原色分解し、R原画像データとG原画像データとB原画像データを用意したキャンバス上に生成する。
=== Three primary color separation of original image ===
In the embodiment of the HTML file, the color conversion process is prepared by line numbers 9 to 30, and the process of line numbers 33 to 36 is performed three times with different colors, so that the original image with the file name “test.png” has three primary colors. The original R data, the G original image data, and the B original image data are generated on the prepared canvas.

行番号33の処理で原画像データをキャンバス上に展開する。行番号34の処理で描画合成モードを「darker」合成モードに設定する。この状態で、RGB輝度値(255、0、0)の高輝度R原色データを原画像データに均一に上書きすることでR原画像データが生成され、RGB輝度値(0、255、0)の高輝度G原色データを原画像データに均一に上書きすることでG原画像データが生成され、RGB輝度値(0、0、255)の高輝度B原色データを原画像データに均一に上書きすることでB原画像データが生成される。これらの処理を行番号35と36で行う。   The original image data is developed on the canvas by the process of line number 33. The drawing composition mode is set to the “darker” composition mode in the process of line number 34. In this state, the R original image data is generated by uniformly overwriting the original image data with the high luminance R primary color data of the RGB luminance values (255, 0, 0), and the RGB luminance values (0, 255, 0) are obtained. G primary image data is generated by uniformly overwriting the high luminance G primary color data on the original image data, and the high luminance B primary color data of RGB luminance values (0, 0, 255) is uniformly overwritten on the original image data. Thus, B original image data is generated. These processes are performed at line numbers 35 and 36.

===乗算処理===
行番号39〜42は乗算処理の記述である。まずR輝度値に(50/255)を乗じる処理について説明する。描画合成モードは標準モードに設定する。このモードで、RGB輝度値(0、0、0)の黒色で透明度(アルファ値)が1−(50/255)の黒データをキャンバス上のR原画像データに均一に上書きすることで、R原画像データの全ピクセルの輝度値を一定比率で減衰させた暗化R画像データが生成される。
=== Multiplication processing ===
Line numbers 39 to 42 are descriptions of multiplication processing. First, a process of multiplying the R luminance value by (50/255) will be described. The drawing composition mode is set to the standard mode. In this mode, the R original image data on the canvas is uniformly overwritten with black data of RGB luminance values (0, 0, 0) and transparency (alpha value) of 1- (50/255). Darkened R image data in which the luminance values of all the pixels of the original image data are attenuated at a constant ratio is generated.

同様に、標準モードにおいて、RGB輝度値(0、0、0)の黒色で透明度(アルファ値)が1−(75/255)の黒データをキャンバス上のG原画像データに均一に上書きすることで、G原画像データの全ピクセルの輝度値を一定比率で減衰させた暗化G画像データが生成される。   Similarly, in the standard mode, black data of RGB luminance values (0, 0, 0) and transparency (alpha value) of 1- (75/255) are uniformly overwritten on the G original image data on the canvas. Thus, darkened G image data in which the luminance values of all the pixels of the G original image data are attenuated at a constant ratio is generated.

同様に、標準モードにおいて、RGB輝度値(0、0、0)の黒色で透明度(アルファ値)が1−(200/255)の黒データをキャンバス上のB原画像データに均一に上書きすることで、B原画像データの全ピクセルの輝度値を一定比率で減衰させた暗化B画像データが生成される。   Similarly, in the standard mode, black data of RGB luminance values (0, 0, 0) and transparency (alpha value) of 1- (200/255) are uniformly overwritten on the B original image data on the canvas. Thus, darkened B image data in which the luminance values of all the pixels of the B original image data are attenuated at a constant ratio is generated.

===加減算処理===
行番号45〜55は加減算処理の記述である。RおよびGの「AddTerm 」の値は正値であり、この場合は加算処理を行うように、描画合成モードを「lighter 」合成モードに設定する。まずR輝度値に127を加算する処理について説明する。ここでは、RGB輝度値(255、0、0)で透明度(アルファ値)が(127/255)のR原色データをキャンバス上の暗化R画像データに均一に上書きすることで、暗化R画像データの全ピクセルの輝度値を一定値だけ増加させた暗化シフトR画像データが生成される。
=== Addition / subtraction processing ===
Line numbers 45 to 55 are descriptions of addition / subtraction processing. The values of “AddTerm” for R and G are positive values. In this case, the drawing composition mode is set to the “lighter” composition mode so as to perform addition processing. First, a process of adding 127 to the R luminance value will be described. Here, the dark R image is obtained by uniformly overwriting the dark R image data on the canvas with R primary color data having an RGB luminance value (255, 0, 0) and transparency (alpha value) (127/255). Darkening shift R image data in which the luminance values of all the pixels of the data are increased by a certain value is generated.

同様に、「lighter 」合成モードにおいて、RGB輝度値(0、255、0)で透明度(アルファ値)が(56/255)のG原色データをキャンバス上の暗化G画像データに均一に上書きすることで、暗化G画像データの全ピクセルの輝度値を一定値だけ増加させた暗化シフトG画像データが生成される。   Similarly, in the “lighter” composition mode, the G primary color data with RGB luminance values (0, 255, 0) and transparency (alpha value) (56/255) are uniformly overwritten on the darkened G image data on the canvas. Thus, darkened shift G image data in which the luminance values of all the pixels of the darkened G image data are increased by a certain value is generated.

Bの「AddTerm 」の値は負値(−100)であり、この場合は減算処理を行うように、描画合成モードを「darker」合成モードに設定する。そしてRGB輝度値(0、0、0)の黒色で透明度(アルファ値)が(100/255)の黒データをキャンバス上の暗化B画像データに均一に上書きすることで、暗化B画像データの全ピクセルの輝度値を一定値だけ減少させた暗化シフトB画像データが生成される。   The value of “AddTerm” in B is a negative value (−100). In this case, the drawing composition mode is set to the “darker” composition mode so as to perform subtraction processing. Then, the dark B image data is uniformly overwritten on the dark B image data on the canvas with black data of RGB luminance values (0, 0, 0) and transparency (alpha value) (100/255). Darkening-shifted B image data in which the luminance values of all the pixels are reduced by a certain value is generated.

===三原色画像の合成===
最後に、行番号58〜62の処理により、描画合成モードを「lighter 」合成モードに設定し、上記のように生成された暗化シフトR画像データと暗化シフトG画像データと暗化シフトB画像データとを1つのキャンバス上に塗り重ねることで、ファイル名「test.png」の原画像データを乗算パラメータ「MultTerm」と加減算パラメータ「AddTerm」に基づいて色変換した画像データが完成し、これが表示出力される。
=== Composition of three primary color images ===
Finally, the drawing composition mode is set to the “lighter” composition mode by the processing of the line numbers 58 to 62, and the darkening shift R image data, the darkening shift G image data, and the darkening shift B generated as described above. By painting the image data on a single canvas, the original image data of the file name “test.png” is color-converted based on the multiplication parameter “MultTerm” and the addition / subtraction parameter “AddTerm”. Display output.

===発明の効果===
以上のHTMLファイル実施例の説明から明らかなように、指定画像を指定特性で色変換して表示させる処理について、HTMLファイルからブラウザーにピクセル単位のデータ操作を指示するのではなく、キャンバス上に展開したビットマップ画像(原画像データおよびその派生データ)の全域に適切な輝度値・透明度の色データを均一に上書きする処理を指示しているのである。そのため、HTMLファイルからブラウザーに対してピクセル単位のデータ操作を指示するものに比べ、処理速度は格段に高速化し、ブラウザーがHTMLファイルを読み込んで色変換後の画像を表示するのに要する処理時間がきわめて短くなる。
=== Effect of Invention ===
As is clear from the above description of the HTML file embodiment, the processing for displaying the specified image by color conversion with the specified characteristics is displayed on the canvas instead of instructing the browser to operate the data in units of pixels from the HTML file. A process for uniformly overwriting color data with appropriate luminance values and transparency over the entire bitmap image (original image data and its derivative data) is instructed. Therefore, the processing speed is significantly faster than that instructing the browser to operate the data in units of pixels from the HTML file, and the processing time required for the browser to read the HTML file and display the image after color conversion. It becomes very short.

===補足事項===
「MultTerm」に対応したR乗算値とG乗算値とB乗算値のいずれか、もしくはすべてが等しい値である場合、乗算処理に際して原画像データの三原色分解を必要としない場合があり、また、後続の加減算処理についても三原色分解の一部もしくは全部を必要としない場合があり得る。こうした場合には三原色分解の処理を省略することも可能である。さらに、色変換の特性によっては、原画像の各色の輝度値に乗ずるべき値が0になる場合もあるし1になる場合もあり得る。同様に、各色の乗算結果に加減算するべき値が0になる場合もあるし正の最大輝度値、もしくは負の最大輝度値になる場合もあり得る。
=== Additional Notes ===
When any or all of the R multiplication value, the G multiplication value, and the B multiplication value corresponding to “MultTerm” are equal values, the three primary color separation of the original image data may not be required in the multiplication process, and the subsequent As for the addition / subtraction processing, there may be a case where some or all of the three primary color separations are not required. In such a case, the process of separating the three primary colors can be omitted. Furthermore, depending on the characteristics of color conversion, the value to be multiplied by the luminance value of each color of the original image may be 0 or may be 1. Similarly, the value to be added to or subtracted from the multiplication result of each color may be 0, or may be a positive maximum luminance value or a negative maximum luminance value.

Claims (4)

HTMLファイルに記述されたcanvas要素を使用することによって原画像データを色変換して表示させる処理をコンピューターに実行させるためのプログラムであって、
前記コンピューターに、
前記原画像データを三原色分解してRGBの要素画像データをビットマップキャンバス上に生成する三原色分解処理と、
RGBそれぞれについて前記要素画像データの全ピクセルの輝度値を一定比率で均一に減衰させることにより、RGB各要素画像データを暗化要素画像データにそれぞれ変換する暗化画像変換処理と、
RGBそれぞれについて前記暗化要素画像データの全ピクセルの輝度値を一定値だけ均一に増減させることにより、RGB各暗化要素画像データを暗化シフト要素画像データにそれぞれ変換する暗化シフト画像変換処理と、
RGB各暗化シフト要素画像データを全て合成させて前記原画像データから色変換された画像データを生成し、生成された当該画像データを表示出力させる処理と、
を実行させるためのプログラム。
A program for causing a computer to execute processing for color-converting and displaying original image data by using a canvas element described in an HTML file,
On the computer,
Three primary color separation processing for generating RGB elemental image data on a bitmap canvas by separating the original image data into three primary colors;
Darkening image conversion processing for converting each element image data of RGB into darkening element image data by uniformly attenuating the luminance values of all the pixels of the element image data at a constant ratio for each of RGB;
Darkening shift image conversion processing for converting each of the RGB darkening element image data into darkening shift element image data by uniformly increasing / decreasing the luminance values of all pixels of the darkening element image data by a certain value for each of RGB When,
A process of combining all the RGB darkening shift element image data to generate color-converted image data from the original image data, and displaying and outputting the generated image data;
A program for running
前記暗化画像変換処理において、
ビットマップキャンバス上に生成されたRGB各要素画像データそれぞれに、HTMLファイルの記述により指定されたRGB各輝度値及び透明度の画像データを均一に上書きすることにより、RGB各要素画像データを、要素画像データの全ピクセルの輝度値を一定比率で減衰させた暗化要素画像データにそれぞれ変換する、ことを特徴とする請求項1に記載のプログラム。
In the dark image conversion process,
Each RGB element image data generated on the bitmap canvas is uniformly overwritten with RGB brightness values and transparency image data specified by the description of the HTML file, so that each RGB element image data is converted into an element image. 2. The program according to claim 1, wherein the brightness values of all the pixels of the data are respectively converted into darkening element image data attenuated at a constant ratio.
前記暗化シフト画像変換処理において、
HTMLファイルの記述により指定されたRGB各輝度値が正値である場合には、
ビットマップキャンバス上に上書きされたRGB各暗化要素画像データそれぞれに、HTMLファイルの記述により指定されたRGB各輝度値及び透明度の画像データを均一に上書きすることにより、RGB各暗化要素画像データを、前記暗化要素画像データの全ピクセルの輝度値を一定値だけ増加させた暗化シフト要素画像データにそれぞれ変換し、
HTMLファイルの記述により指定されたRGB各輝度値が負値である場合には、
ビットマップキャンバス上に上書きされたRGB各暗化要素画像データそれぞれに、HTMLファイルの記述により指定されたRGB各輝度値及び透明度の画像データを均一に上書きすることにより、RGB各暗化要素画像データを、前記暗化要素画像データの全ピクセルの輝度値を一定値だけ減少させた暗化シフト要素画像データにそれぞれ変換する、ことを特徴とする請求項2に記載のプログラム。
In the darkening shift image conversion process,
When the RGB luminance values specified by the description of the HTML file are positive values,
Each of the RGB darkening element image data overwritten on the bitmap canvas is uniformly overwritten with the RGB brightness values and transparency image data specified by the description of the HTML file. Is converted into darkening shift element image data in which the luminance values of all pixels of the darkening element image data are increased by a certain value, respectively.
When each luminance value specified by the description of the HTML file is a negative value,
Each of the RGB darkening element image data overwritten on the bitmap canvas is uniformly overwritten with the RGB brightness values and transparency image data specified by the description of the HTML file. The program according to claim 2, wherein the program is converted into darkening shift element image data in which luminance values of all pixels of the darkening element image data are reduced by a certain value.
HTMLファイルに記述されたcanvas要素を使用することによって、SWFファイルの記述により指定された原画像データを色変換して表示させる画像処理方法であって、
コンピューターが、
前記原画像データを三原色分解してRGBの要素画像データをビットマップキャンバス上に生成し、
前記SWFファイルの記述により指定された色変換パラメータに従って、RGBそれぞれについて前記要素画像データの全ピクセルの輝度値を一定比率で均一に減衰させることにより、RGB各要素画像データを暗化要素画像データにそれぞれ変換し、
前記SWFファイルの記述により指定された色変換パラメータに従って、RGBそれぞれについて前記暗化要素画像データの全ピクセルの輝度値を一定値だけ均一に増減させることにより、RGB各暗化要素画像データを暗化シフト要素画像データにそれぞれ変換し、
RGB各暗化シフト要素画像データを全て合成させて前記原画像データから色変換された画像データを生成し、生成された当該画像データを表示出力させる、
ことを特徴とする画像処理方法。
An image processing method for displaying original image data specified by a description in a SWF file by performing color conversion by using a canvas element described in an HTML file,
Computer
The original image data is separated into three primary colors to generate RGB element image data on a bitmap canvas,
According to the color conversion parameter specified by the description of the SWF file, the luminance values of all the pixels of the element image data are uniformly attenuated at a constant ratio for each of RGB, thereby converting the RGB element image data into dark element image data. Convert each
In accordance with the color conversion parameter specified by the description of the SWF file, each of the RGB darkening element image data is darkened by uniformly increasing / decreasing the luminance values of all the pixels of the darkening element image data by a certain value for each of RGB. Convert to shift element image data,
All the RGB darkening shift element image data are combined to generate image data color-converted from the original image data, and the generated image data is displayed and output.
An image processing method.
JP2012260042A 2012-11-28 2012-11-28 Program and image processing method Active JP5199512B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012260042A JP5199512B2 (en) 2012-11-28 2012-11-28 Program and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012260042A JP5199512B2 (en) 2012-11-28 2012-11-28 Program and image processing method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2011165918A Division JP5149430B2 (en) 2011-07-28 2011-07-28 Image processing method, file conversion method, and file conversion program

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2013021451A Division JP5255165B2 (en) 2013-02-06 2013-02-06 program

Publications (2)

Publication Number Publication Date
JP2013059110A JP2013059110A (en) 2013-03-28
JP5199512B2 true JP5199512B2 (en) 2013-05-15

Family

ID=48134500

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012260042A Active JP5199512B2 (en) 2012-11-28 2012-11-28 Program and image processing method

Country Status (1)

Country Link
JP (1) JP5199512B2 (en)

Also Published As

Publication number Publication date
JP2013059110A (en) 2013-03-28

Similar Documents

Publication Publication Date Title
JP5149430B2 (en) Image processing method, file conversion method, and file conversion program
AU2014202632B2 (en) Content adjustment in graphical user interface based on background content
CN111193876B (en) Method and device for adding special effect in video
US20120246554A1 (en) Performing binary composition of images onto an html canvas element
CN103294429A (en) Display method and device
JP2009117952A5 (en)
JP5650275B2 (en) program
CN106547530A (en) A kind of interface processing method and device
JP5255165B2 (en) program
US9872005B2 (en) Moving image reproducing apparatus
JP5199512B2 (en) Program and image processing method
CN113344633A (en) Advertisement picture processing method and device
JP2017182702A5 (en)
CN114307143A (en) Image processing method and device, storage medium and computer equipment
JP2010282200A (en) Structure of animation font file and text-displaying method for mobile terminal
JP6098995B2 (en) Image processing apparatus, image forming apparatus, and program
CN102761754A (en) Curve color matching method
CN100452879C (en) Conversion method between files in different types
CN110975284A (en) Unity-based NGUI resource rendering processing method and device
US9361855B2 (en) Computer-implemented methods and systems for a color generator
JP4772726B2 (en) Color conversion processing program, processing device, and processing method
Powers Painting the Web
Liu Application of Photoshop Graphics and Image Technology in VR Animation
Jackson et al. Android UI Theme Design and Digital Media Concepts
Egenæs Backend Books: Tools for Experimental Publishing

Legal Events

Date Code Title Description
A975 Report on accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A971005

Effective date: 20121219

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130108

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130207

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160215

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 5199512

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250