JP2021086414A - Information processing apparatus, information processing method, and program - Google Patents
Information processing apparatus, information processing method, and program Download PDFInfo
- Publication number
- JP2021086414A JP2021086414A JP2019215203A JP2019215203A JP2021086414A JP 2021086414 A JP2021086414 A JP 2021086414A JP 2019215203 A JP2019215203 A JP 2019215203A JP 2019215203 A JP2019215203 A JP 2019215203A JP 2021086414 A JP2021086414 A JP 2021086414A
- Authority
- JP
- Japan
- Prior art keywords
- content
- image
- elements
- layer
- svg
- 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.)
- Granted
Links
- 230000010365 information processing Effects 0.000 title claims abstract description 37
- 238000003672 processing method Methods 0.000 title claims abstract description 5
- 238000007639 printing Methods 0.000 claims abstract description 43
- 238000000034 method Methods 0.000 claims description 68
- 230000008569 process Effects 0.000 claims description 34
- 239000003550 marker Substances 0.000 claims description 15
- 238000009966 trimming Methods 0.000 claims description 6
- 238000012545 processing Methods 0.000 abstract description 64
- 238000009877 rendering Methods 0.000 abstract description 25
- 230000006870 function Effects 0.000 description 51
- 238000004891 communication Methods 0.000 description 36
- 230000008901 benefit Effects 0.000 description 10
- 238000006243 chemical reaction Methods 0.000 description 10
- 238000011161 development Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 7
- 238000003384 imaging method Methods 0.000 description 7
- 239000008186 active pharmaceutical agent Substances 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 5
- 238000001514 detection method Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 3
- 238000012937 correction Methods 0.000 description 3
- 238000013500 data storage Methods 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000012805 post-processing Methods 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 241000238370 Sepia Species 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 238000003702 image correction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Abstract
Description
本発明は、印刷に関する処理を行う情報処理装置、情報処理方法、およびプログラムに関する。 The present invention relates to an information processing apparatus, an information processing method, and a program that perform processing related to printing.
近年、カメラ機能が搭載された可搬型多機能携帯端末(モバイルコンピュータ)が普及している。このようなモバイルコンピュータは、基本的には3つの要素で構成されている。即ち、コンピュータ自身であるハードウェアと、ハードウェア上で動作するオペレーティングシステム(OS)と、そのOS上で動作するアプリケーションとで構成されている。 In recent years, portable multifunctional mobile terminals (mobile computers) equipped with a camera function have become widespread. Such a mobile computer is basically composed of three elements. That is, it is composed of hardware that is the computer itself, an operating system (OS) that runs on the hardware, and an application that runs on the OS.
このようなモバイルコンピュータ上で動作するアプリケーションの形態として、いわゆるハイブリッドアプリケーションと呼ばれる形態がある。ハイブリッドアプリケーションとは、ネイティブアプリケーションの利点とウェブアプリケーションの利点とを双方保持するアプリケーションである。以後、アプリケーションのことを「アプリ」と表記することがある。 As a form of an application that operates on such a mobile computer, there is a form called a so-called hybrid application. A hybrid application is an application that retains both the advantages of a native application and the advantages of a web application. Hereinafter, the application may be referred to as an "application".
特許文献1には、ハイブリッドアプリの形態の印刷アプリによって、印刷に用いるデータが生成される技術が記載されている。特許文献1では、印刷アプリが生成したSVGコンテンツを、OSに標準的に備えられているウェブエンジンが描画し、OSのスクリーンショット機能を用いて画像化する技術が記載されている。
OSに標準的に備えられているウェブエンジンでは、通常、SVGコンテンツを読み込むと、SVGコンテンツの各要素が解析され、画像データとして反映できる状態になったものから非同期的に出力される。これは、ウェブコンテンツを表示する場合には、少しずつでも画面が更新され続ける方が、体感待ち時間が短くなるので、ユーザビリティがよいとされているからである。 In the web engine provided as standard in the OS, when SVG content is read, each element of the SVG content is analyzed and output asynchronously from the state in which it can be reflected as image data. This is because when displaying web contents, it is said that usability is better if the screen is continuously updated even little by little because the waiting time for experiencing is shortened.
一方、印刷用の画像では、生成途中の画像は必要でないことが多い。しかしながら、SVGコンテンツにおいて複数の要素が含まれている場合、ウェブエンジンでは個々の要素で非同期的に描画が行われるので、再描画が必要な領域が発生することがある。このため、コンピュータに不必要な処理負荷を生じさせてしまう虞がある。 On the other hand, in the image for printing, the image in the process of being generated is often unnecessary. However, when a plurality of elements are included in the SVG content, the web engine draws the individual elements asynchronously, so that an area requiring redrawing may occur. Therefore, there is a risk of causing an unnecessary processing load on the computer.
本発明の一態様に係るプログラムは、アプリケーションの実行の際に、プロセッサによって翻訳されて実行されるスクリプト命令セットで構成された第一層と、前記プロセッサが実行可能な命令セットとして前記プロセッサとは異なるユニットにより予めコンパイルされている第二層と、を有し、前記第一層と前記第二層との連携によって前記アプリケーションを実行するためのプログラムであって、前記プロセッサを、複数の要素を含む印刷対象のコンテンツを生成する第一生成手段と、コンテンツに含まれる要素を非同期で描画する描画手段に対して、前記印刷対象のコンテンツに含まれる複数の要素のうち少なくとも2つ以上の要素がロードされた後に当該少なくとも2つ以上の要素を前記描画手段が描画するように、前記第一生成手段で生成された前記印刷対象のコンテンツの描画を依頼する依頼手段と、前記依頼手段による依頼に基づいて前記描画手段によって描画された画像を取得して印刷用のデータを生成する第二生成手段と、として機能させる。 The program according to one aspect of the present invention includes a first layer composed of a script instruction set that is translated and executed by a processor when an application is executed, and the processor as an instruction set that can be executed by the processor. A program having a second layer pre-compiled by different units and executing the application in cooperation with the first layer and the second layer, the processor, and a plurality of elements. With respect to the first generation means for generating the content to be printed to be included and the drawing means for drawing the elements included in the content asynchronously, at least two or more elements among the plurality of elements included in the content to be printed are present. A request means for requesting drawing of the content to be printed generated by the first generation means and a request by the request means so that the drawing means draws at least two or more elements after being loaded. Based on this, it functions as a second generation means that acquires an image drawn by the drawing means and generates data for printing.
本発明によれば、ハイブリッドアプリを用いて印刷を行う場合に、不必要な処理負荷が生じてしまうことを抑制することができる。 According to the present invention, it is possible to prevent an unnecessary processing load from being generated when printing is performed using a hybrid application.
以下、実施形態について、図面を参照して説明する。なお、以下の実施形態は本発明を限定するものではなく、また、本実施形態で説明されている特徴の組み合わせの全てが必須のものとは限らない。 Hereinafter, embodiments will be described with reference to the drawings. It should be noted that the following embodiments do not limit the present invention, and not all combinations of features described in the present embodiments are essential.
<ハイブリッドアプリの説明>
本実施形態の説明に先立って、ハイブリッドアプリの補足説明をする。ハイブリッドアプリとは、ネイティブアプリの利点とウェブアプリの利点とを双方保持するアプリである。以下、ネイティブアプリおよびウェブアプリをそれぞれ説明する。
<Explanation of hybrid app>
Prior to the explanation of this embodiment, a supplementary explanation of the hybrid application will be given. A hybrid app is an app that retains both the benefits of a native app and the benefits of a web app. The native application and the web application will be described below.
ネイティブアプリとは、通常、OS毎に用意される開発環境、及び、開発言語を用いて開発されるアプリである。例えば、A社が提供するOS上ではC/C++言語、B社が提供するOS上ではJava(登録商標)言語、C社が提供するOS上では更に異なる開発言語を用いる、という具合である。通常、ネイティブアプリは、各開発環境において予めコンパイルされ、人間が理解可能な、いわゆる高水準言語から、コンピュータのCPUが解釈可能なアセンブラ等の命令セット群に変換される。このように、通常のネイティブアプリでは、CPUが命令を直接解釈するので、高速動作が可能である、というメリットがある。 A native application is an application that is usually developed using a development environment and a development language prepared for each OS. For example, the C / C ++ language is used on the OS provided by the company A, the Java (registered trademark) language is used on the OS provided by the company B, and a different development language is used on the OS provided by the company C. Normally, a native application is precompiled in each development environment and converted from a so-called high-level language that can be understood by humans to an instruction set group such as an assembler that can be interpreted by a computer CPU. As described above, in a normal native application, since the CPU directly interprets the instruction, there is an advantage that high-speed operation is possible.
一方、ウェブアプリとは、近年では各コンピュータ上のOSに標準的に組み込まれているウェブブラウザ上で動作するアプリのことである。ウェブアプリは、ウェブブラウザが解釈できるように、一般的にはHTML5、CSS、またはJavaScript(登録商標)等を用いて開発される。これらはウェブ標準言語であるため、これらのウェブ標準言語でウェブアプリを一旦記述すれば、ウェブブラウザが動作する環境であれば動作可能である、というメリットがある。 On the other hand, a web application is an application that runs on a web browser that is built into the OS on each computer as standard in recent years. Web applications are generally developed using HTML5, CSS, JavaScript, etc. so that they can be interpreted by a web browser. Since these are web standard languages, there is an advantage that once a web application is written in these web standard languages, it can be operated in an environment in which a web browser operates.
ハイブリッドアプリでは、そのユーザーインターフェース(UI)の全て、あるいは大部分が、HTML5、CSS3、またはJavaScriptといったウェブの標準言語で記述されたスクリプト層により実行される。一方、OSの機能の呼び出し等のOSとの連携を行うための処理は、ハイブリッドアプリにおけるネイティブ層により実行される。ネイティブ層は、OSに応じたネイティブ言語で開発されており、またハイブリッドアプリを実行するプロセッサとは異なるユニットにより予めコンパイルされている。この構成により、例えば、ウェブ標準言語で記述された内容から、ネイティブ言語で記述された機能を利用することもできる。このように、ハイブリッドアプリは、一つのアプリ内部に、ウェブ標準言語によるスクリプト層とネイティブ層とを双方包含する構成となっている。このような構成により、ネイティブアプリの利点とウェブアプリの利点とを双方保持したソフトウェア構成とすることができる。また、ハイブリッドアプリは、スクリプト層については複数のプラットフォーム(OS等)に共通に利用することができるため、開発コストが低いという利点もある。 In a hybrid app, all or most of its user interface (UI) is executed by a script layer written in a standard web language such as HTML5, CSS3, or Javascript. On the other hand, processing for linking with the OS, such as calling an OS function, is executed by the native layer in the hybrid application. The native layer is developed in the native language according to the OS, and is pre-compiled by a unit different from the processor that executes the hybrid application. With this configuration, for example, it is possible to use a function written in a native language from a content written in a web standard language. In this way, the hybrid application has a configuration in which both the script layer and the native layer in the web standard language are included in one application. With such a configuration, it is possible to have a software configuration that retains both the advantages of the native application and the advantages of the web application. In addition, the hybrid application has an advantage that the development cost is low because the script layer can be commonly used for a plurality of platforms (OS and the like).
ここで、ハイブリッドアプリの形態の印刷アプリを用いて、ロゴ付きのコンテンツを印刷する場面を想定する。ハイブリッドアプリでは、まず、ウェブ言語を用いて、コンテンツにロゴを重畳させた印刷コンテンツを生成する。そして、印刷の際に、ウェブ言語で記述された印刷コンテンツをプリンタへ送信できる画像形式(JPEG、BMP、PNG、PDFなど)へ変換する。例えばSVGを用いるハイブリッドアプリの印刷コンテンツとしては、下記のようなSVGが例として挙げられる。SVG(Scalable Vecgor Graphics)とは、ウェブ標準言語で利用可能な、グラフィックを表示するための記述方法の一つである。
----------------------------------------------
[[SVG記述例1]]
<svg>
<image xlink:href=”写真” />
<g>ロゴ</g>
</svg>
----------------------------------------------
Here, it is assumed that a printing application in the form of a hybrid application is used to print content with a logo. The hybrid application first uses a web language to generate print content with a logo superimposed on the content. Then, at the time of printing, the print content described in the web language is converted into an image format (JPEG, BMP, PNG, PDF, etc.) that can be transmitted to the printer. For example, as the print content of the hybrid application using SVG, the following SVG can be mentioned as an example. SVG (Scalable Vector Graphics) is one of the description methods for displaying graphics, which can be used in a web standard language.
----------------------------------------------
[[SVG description example 1]]
<svg>
<image xlink: href = "photo"/>
<g> logo </ g>
</ svg>
----------------------------------------------
SVG記述例1では、簡略化のため細かい情報は省いている。SVG記述例1は、後述する図4(a)のように、全面に配された写真401と、写真401の一部に重畳されるロゴ402と、が含まれるSVGコンテンツ400を表している。このように、SVGコンテンツでは、複数の要素からなるコンテンツがあり得る。
In SVG description example 1, detailed information is omitted for simplification. The SVG description example 1 represents an
ハイブリッドアプリの形態の印刷アプリによって、SVG記述例1のようなSVGコンテンツが生成されると、OSに標準的に備えられているウェブエンジンがSVGコンテンツを描画する。そして、印刷アプリは、OSのスクリーンショット機能を用いて画像化して得られた画像データを用いてプリンタに印刷データを送信し、プリンタで印刷が行われる。 When the SVG content as in SVG description example 1 is generated by the print application in the form of a hybrid application, the web engine provided as standard in the OS draws the SVG content. Then, the print application transmits the print data to the printer using the image data obtained by imaging using the screenshot function of the OS, and the printer prints.
ここで、OSに標準的に備えられているウェブエンジンでは、通常、SVG記述例1のようなSVGコンテンツを読み込むと、SVGコンテンツの各要素が解析され、画像データとして反映できる状態になったものから非同期的に出力される。ウェブコンテンツを表示する場合には、少しずつでも画面が更新され続ける方が、体感待ち時間が短くなるので、ユーザビリティがよいとされているからである。 Here, in the web engine provided as standard in the OS, when SVG content such as SVG description example 1 is read, each element of the SVG content is analyzed and can be reflected as image data. Is output asynchronously from. This is because when displaying web content, it is said that usability is better if the screen is continuously updated even little by little because the waiting time for experiencing is shortened.
例えば、SVG記述例1のように、複数の要素からなるSVGコンテンツがあり、その複数の要素が重畳されるような画像が描画されることを想定する。すると、最背面に位置する要素の領域は、最前面に位置する要素で覆われることになるので、本来は、描画不要な領域である。図4(a)の例では、ロゴ402の背面に位置する写真401の領域は、本来、描画不要な領域である。SVGコンテンツの最背面に存在する要素から描画がなされると、新しい要素の描画のたびに重複した領域の再描画が発生してしまう。また、それらが透過度設定を持っていた場合、その都度、透過属性を考慮した画素値を算出する必要があり、処理負荷が増大してしまう。
For example, as in SVG description example 1, it is assumed that there is SVG content composed of a plurality of elements, and an image in which the plurality of elements are superimposed is drawn. Then, the area of the element located at the backmost surface is covered with the element located at the frontmost surface, so that it is originally an area that does not require drawing. In the example of FIG. 4A, the area of the
そこで、以下で説明する実施形態では、ハイブリッドアプリの形態の印刷アプリを用いる場合において、コンピュータに不必要な処理負荷を生じさせないように処理を制御する例を説明する。 Therefore, in the embodiment described below, when a print application in the form of a hybrid application is used, an example of controlling the processing so as not to cause an unnecessary processing load on the computer will be described.
<ハードウェア構成の説明>
図1は、本実施形態の情報処理装置115を含むシステムの例を示すブロック図である。情報処理装置115は、例えば、スマートフォンまたは携帯電話等の携帯型情報端末である。情報処理装置115は、CPU100、ROM101、RAM102、2次記憶装置103、ディスプレイ104、タッチセンサ105、加速度センサ106を有する。また、外部I/F107〜109、内部撮像デバイス110、制御バス/データバス116、およびバッテリ117を有する。尚、情報処理装置115は、図1に示す全ての構成を備えていなくてもよいし、図1に示す以外の構成を備えていてもよい。
<Explanation of hardware configuration>
FIG. 1 is a block diagram showing an example of a system including the
CPU100は、中央演算装置(プロセッサ)であり、以下で説明する各種処理をプログラムに従って実行する。図1においてCPU100は1つであるが、複数のCPUまたはCPUコアによって構成されていてもよい。ROM101には、CPU100により実行されるプログラムが記憶されている。RAM102は、CPU100によるプログラムの実行時に、各種情報を一時的に記憶するためのメモリである。
The
2次記憶装置103は、ハードディスクまたはフラッシュメモリ等の記憶装置であり、ファイルまたは画像解析等の処理結果を保持するデータベース等のデータ、および、各種プログラムを記憶する。ディスプレイ104は、各種処理を実現するための操作を受け付けるためのUI(ユーザインタフェース)、および、実行された処理による処理結果等の各種情報を表示する。ディスプレイ104は、タッチセンサ105を備えてもよい。
The
内部撮像デバイス110による撮像によって得られた画像データは、所定の画像処理を経た後、2次記憶装置103に保存される。また、画像データは、外部I/F(インタフェース)108を介して接続された外部撮像デバイス111から読み込むこともできる。
The image data obtained by imaging by the
情報処理装置115は、外部I/F109を備え、インターネット等のネットワーク113を介して通信を行うことができる。情報処理装置115は、外部I/F109を介して、ネットワーク113に接続されたサーバ114から画像データを取得することもできる。
The
情報処理装置115は、加速度センサ106を備え、情報処理装置115自身の位置姿勢に関する加速度情報を取得することができる。情報処理装置115は、外部I/F107を介してプリンタ112と接続されており、画像データ等のデータをプリンタ112に出力することができる。
The
プリンタ112は、ネットワーク113にも接続されており、外部I/F109経由で、プリンタに必要なデータを送受信することができる。
The
外部I/F107〜109は、有線通信および無線通信のうち、少なくともいずれかの通信形態を有するインタフェースであり、利用する通信形態に応じて外部デバイス(プリンタ112あるいはサーバ114)との通信を行う。有線通信には、例えば、USB、イーサネット(登録商標)等があり、無線通信には、無線LAN、NFC、Bluetooth(登録商標)、赤外線通信等がある。また、無線通信として、無線LANを利用する場合には、装置同士が直接接続する形態もあれば、無線LANルータ等の中継装置を介して接続する形態もある。また、外部I/F107〜109は、図では別々に構成されているが、一体となって構成されていてもよい。
The external I /
情報処理装置115の動作に必要な電源は、バッテリ117によって供給される。情報処理装置115が備える各種構成要素は、制御バス/データバス116を介して相互に接続され、CPU100は、この制御バス/データバス116を介して、各種構成要素を制御する。
The power supply required for the operation of the
尚、本実施形態では、情報処理装置115が、情報処理装置115が備える制御部(CPU100)によって実行されるプログラム等のソフトウェアの実行場所(ソフトウェア実行環境)となる。
In the present embodiment, the
<ソフトウェアのブロック図>
図2は、情報処理装置115で動作するソフトウェア構成のブロック図である。情報処理装置115は、スクリプト層217、ネイティブ層218、及びOS層219のプログラムを実行する。これらの各層は、CPU100がROM101または2次記憶装置103に記憶されている対応するプログラムを読み出し実行することにより実現される。
<Software block diagram>
FIG. 2 is a block diagram of a software configuration that operates in the
スクリプト層217は、画像取得部201、コンテンツ描画部205、画像処理制御部206、データ変換部207、コンテンツ操作部210、プリンタ制御部211、およびレンダリング依頼部222を有する。
The
ネイティブ層218は、画像読み込み部202、データ変換部203、データ保持部204、画像処理部208、プリンタデータ生成部212、レンダリング部216、データ保存部220、および外部デバイス通信部221を有する。
The
OS層219は、タッチイベント209、プリンタ通信部213、インタプリタ214、および状態検知部223を有する。インタプリタ214は、ウェブエンジン224を有する。
The
スクリプト層217(第一層)は、HTML5、CSS3、またはJavaScript等のウェブ標準言語を使って、テキストデータで命令セット(コンテンツの描画、画像の表示、または動画の再生等)が記述されているプログラム層である。この命令セットを、スクリプト命令セットといい、スクリプト命令セットは、プロセッサ(例えばCPU100)によって実行可能な命令セットである。スクリプト層217では、アプリケーション実行環境上で、そのアプリケーション実行環境に存在するプロセッサ(CPU100)を用いて、テキストデータの各種命令セットを翻訳して実行することになる。その実行形態としては、実行の度に命令文を一行ずつ動的に翻訳する場合、アプリケーションを起動したときに翻訳する場合、または、アプリケーションを情報処理装置115にインストールしたときに翻訳する場合等が考えられる。
The script layer 217 (first layer) describes an instruction set (drawing content, displaying an image, playing a moving image, etc.) with text data using a web standard language such as HTML5, CSS3, or Javascript. It is a program layer. This instruction set is called a script instruction set, and the script instruction set is an instruction set that can be executed by a processor (for example, CPU 100). In the
以後、スクリプト層217で処理すること、および、スクリプト層217の処理内容を「スクリプト」と呼ぶ。スクリプトの命令を情報処理装置115内で翻訳する形態の例として、ネイティブ層218またはOS層219が備えるインタプリタの機能を使用することが挙げられる。尚、本実施形態においては、アプリケーションのUIの大部分が、スクリプト層217で記述されていることを想定している。
Hereinafter, the processing by the
ネイティブ層218は、アプリケーション実行環境以外で予め翻訳(コンパイル)された命令セットが記述されているプログラム層である。形態としては、CまたはC++といった高水準言語で記述されたコードが、予めアプリケーションの開発者のPCまたはサーバ上でコンパイルされ、CPU100が解釈可能な命令の集合体となっている。以後、ネイティブ層218で処理すること、ネイティブ層218の処理内容、および、後述するOS層219の機能をネイティブ層218から呼び出すことを「ネイティブ」と呼ぶ。尚、ネイティブ層218の別の実装系として、Java(登録商標)が挙げられる。Javaは、C/C++と類似の高水準言語であり、予めアプリケーション開発時の開発環境上で中間コードに翻訳される。翻訳された中間コードは、各OSが備えるJava仮想環境上で動作する。本実施形態においては、このようなプログラム形態も、ネイティブ層218の一種に含める。
The
OS層219は、情報処理装置115のオペレーティングシステム(Operating System:OS)に対応する。OS層219は、ハードウェア機能の使用をアプリケーションに提供する役割及び固有の機能を有する。OS層219は、APIを備え、スクリプト層217およびネイティブ層218は、APIを介してOS層219の機能を使用することができる。
The
本実施形態では、スクリプト層217からネイティブ層218の呼び出しを可能にすることを「バインディング」または「バインド」と呼ぶ。ネイティブ層218は、APIを備え、APIをスクリプトが呼び出すことで、スクリプトが各種ネイティブの機能を使用することができる。このようなバインディング機能は、通常、各種OSが標準的に備えている機能である。
In the present embodiment, enabling the call of the
本実施形態では、スクリプト層217とネイティブ層218とを含むアプリのことをハイブリッドアプリと呼ぶ。また、ハイブリッドアプリは、OS層219の機能を使用するアプリでもある。本実施形態におけるハイブリッドアプリは、例えば写真などの第一画像にロゴなどの第二画像を重畳してプリンタ112に印刷をさせることが可能な印刷アプリ200であるものとする。また、印刷アプリでは、この重畳済みの画像をプレビュー表示することも可能である。以上がソフトウェアの各層の概要の説明である。以後では、図2の各ブロックの説明を行う。
In the present embodiment, an application including a
スクリプト層217の画像取得部201は、ネイティブ層218に対して、例えば印刷対象となる画像データの取得を依頼する。画像取得部201の依頼は、例えば、画像のパスを指定する方法、または、ダイアログ表示を促す方法等が挙げられる。
The
ネイティブ層218の画像読み込み部202は、画像データ群215から画像データを取得する。画像データ群215からの画像データの取得方法は、スクリプト層217の画像取得部201の依頼方法に依存する。依頼方法は、UI上に提供されているダイアログボックスから選択する、または、画像のパスから直接画像を選択する等が挙げられる。画像読み込み部202は、画像読み込み時には、画像のパスをスクリプト層217に返却してもよいし、Base64形式でスクリプト層217に返却してもよい。他にも画像に対して一意なIDを割り当て、画像を指定する場合はこのIDを利用する形態を用いてもよい。また画像読み込み部202は、OS層219に、2次記憶装置103に記憶されている画像の一覧を表示させてもよい。そして、その一覧表示においてユーザーにより選択された画像を、OS層219を介して、読み込んでもよい。
The
ネイティブ層218のデータ変換部203は、ネイティブ層218のデータをスクリプト層217で利用できる形式のデータに変換する。ネイティブ層218のデータは、例えばバイナリ形式の画像データまたはパラメータである。スクリプト層で利用できる形式のデータは、例えばテキスト形式(Base64)の画像データまたはJSONなどである。JSONは、JavaScript Object Notationの略である。一方で、ネイティブ層218のデータ変換部203は、スクリプト層217から送られてきたデータをネイティブ層218で利用できる形式のデータにする変換も行う。
The
スクリプト層217のデータ変換部207は、スクリプト層217のデータ(例:テキスト形式の処理パラメータ)をネイティブ層218で利用できる形式のデータ(例:テキスト形式(JSON形式)の処理パラメータまたは文字列)に変換する。
The
ネイティブ層218のデータ保持部204は、画像読み込み部202で読み込んだ画像データ、画像処理部208で画像処理が施された画像データ、および分割した画像群を保持する。保持される画像データは、例えば、RGB画像データに展開されており、画像処理が実行できる形式になっている。
The
スクリプト層217のコンテンツ描画部205は、印刷のためのコンテンツを、ウェブ標準言語を利用して記述する。この記述には、コンテンツ操作部210で編集操作されたスクリプトも反映される。コンテンツ描画部205で記述されたコンテンツのスクリプトは、OS層219のインタプリタ214で解釈され、ディスプレイ104に表示される。近年のPC、および、モバイルコンピュータは、基本的にHTMLおよびJavaScriptを解析するインタプリタ214を備えている。インタプリタ214は、ウェブ言語のインタプリタであるウェブエンジン224を有する。本例では、特に明言しない限り、ウェブエンジンは、レンダリングエンジンまたはウェブブラウザと、同様の意味で用いることとする。
The
スクリプト層217の画像処理制御部206は、ネイティブ層218における画像処理に用いる補正パラメータと、処理対象となる画像とを決定し、ネイティブ層218の画像処理部208に画像処理を依頼する。補正パラメータは、スクリプト層217のデータ変換部207でネイティブ層へ送信できる形式に変換された後、ネイティブ層218に送信される。
The image
ネイティブ層の画像処理部208は、画像処理制御部206で指定された画像に対し画像処理を施す。その際、どのような画像処理を施すかは、画像処理制御部206で設定されたパラメータにより決定される。画像の指定については、先述のとおりIDを利用する方法に加え、スクリプト層から画像のパスを受け取る、画像データごと受け取る方法などが考えられる。
The
なお、画像のIDを利用する方法では、ネイティブ層218からスクリプト層217に、画像および画像IDが送信される。そして、スクリプト層217からネイティブ層218へは、画像は送信されず、画像IDや画像処理制御部206で設定されたパラメータが送信されてもよい。そして、ネイティブ層218の画像読み込み部202は、画像IDにより特定された画像を読み込み、画像処理制御部206は、読み込まれた画像に対して、当該パラメータに従って画像処理を実行する。また画像読み込み部202で読み込まれる画像が、画素数の多い画像と、同内容で画素数の少ないサムネイル画像を含むファイルである場合、ネイティブ層218からスクリプト層217へはサムネイル画像が送信されてもよい。そして、画像処理制御部206が画像処理を実行する画像として、画像読み込み部202は、画像IDに従って画像を読み込んでもよい。これにより、ネイティブ層218からスクリプト層217に、画素数が多く、データ量の多い画像が送信されるのを防ぐことができる。
In the method using the image ID, the image and the image ID are transmitted from the
OS層219のタッチイベント209は、ディスプレイ104のタッチに関する情報を取得する。タッチに関する情報とは、ディスプレイ104のタッチ検知、および、タッチされた位置情報等が挙げられる。取得したタッチに関する情報は、ネイティブ層218経由でスクリプト層217のコンテンツ操作部210に送信される。
The
スクリプト層217のコンテンツ操作部210は、例えば、画像取得依頼の結果としてネイティブ層218から画像データが返却された際、その画像データを反映すべく、スクリプト命令を変更する。例えば、後述するように、DOM(Document Object Model)ツリーと呼ばれる階層モデルに変換する。また、コンテンツ操作部210は、コンテンツがウェブエンジン224で非同期的に描画されないように、スクリプト命令を変更する。詳細は後述する。
The
スクリプト層217のプリンタ制御部211は、プリンタ検知の依頼、プリンタ設定画面の表示、ならびに、プリント情報の生成および送信を制御する。プリンタ設定画面では、用紙のサイズ、用紙の種類、およびカラー・モノクロ等のプリンタ設定がされる。ここで設定された項目を基に、ネイティブ層218のプリンタデータ生成部212でプリンタデータが生成される。
The
ネイティブ層218のプリンタデータ生成部212は、スクリプト層217のプリンタ制御部211からの依頼を基に、プリンタ通信に必要なデータおよびコマンドを生成する。プリンタ通信に必要なデータとは、通信プロトコルに則ったデータである。プリンタ通信に必要なコマンドとは、印刷またはスキャン等、プリンタの動作を決定するためのデータである。このように、プリンタデータ生成部212は、プリンタの動作を決定するためのコマンドを含むプリンタデータを生成する。プリンタの動作を決定するためのコマンドには、印刷用の画像データが含まれる。また、プリンタにプリンタ情報の送信を依頼するコマンドが含まれる。
The printer
ネイティブ層218の外部デバイス通信部221は、プリンタなどの情報処理装置115と接続している外部デバイスとの通信を行うためのインタフェース(IF)である。ネイティブ層218の外部デバイス通信部221は、プリンタデータ生成部212から受け取ったデータを送信したり、プリンタ112からの情報を受信したりする。本実施形態では、外部デバイス通信部221は、OS層219のプリンタ通信部213を介して通信するが、外部デバイス通信部221が直接、外部IF107へデータを送信してもよい。尚、OS層219のプリンタ通信部213が、外部デバイスが用いる通信プロトコルに対応していれば、外部デバイス通信部221は、その機能を使えば良い。プリンタ通信部213が、外部デバイスが用いる通信プロトコルに対応していなければ、外部デバイス通信部221が、その通信プロトコルに従って通信する。
The external
OS層219のインタプリタ214は、スクリプト層217で生成されたウェブ標準言語で記述された命令を解釈・実行する。例えば、画像の描画等の命令は、インタプリタ214(ウェブエンジン224)を通して実行される。
The
画像データ群215は、画像データを保持している領域である。データ保存部220は、必要に応じて、データ保持部204が保持する画像データを画像データ群215に保存させるために機能する。
The
スクリプト層217のレンダリング依頼部222は、ネイティブ層218のレンダリング部216にレンダリング(描画)の依頼をする。その際、レンダリング依頼部222は、コンテンツ描画部205で記述されている内容をデータ変換部207で変換してからレンダリング部216部に受け渡す。レンダリング部216に受け渡す前に必要な処理があれば、レンダリング依頼部222は、コンテンツ操作部210を利用して、コンテンツ記述を編集してもよい。また、コンテンツ記述を直接編集するとUIに影響がある場合、コンテンツ記述の複製を生成して、複製したコンテンツ記述を編集してもよい。
The
レンダリング部216は、レンダリング依頼部222から受け取った内容から、プリンタへ送信するため画像データを生成するためのレンダリングを行う。このレンダリングには、例えば、スクリプト層217においてプリンタ112への出力解像度で画像を生成することが含まれる。レンダリング部216がコンテンツから画像を生成する工程では、レンダリング部216は、ウェブエンジン224の機能も利用する。尚、ネイティブ層218におけるレンダリング結果、及び、生成途中の画像はディスプレイ104に表示されない。
The
OS層219の状態検知部223は、利用しているデバイスの状態を検知する。例えば、アプリケーションを利用している状態で、着信などの他の通知があった場合、そのイベントの発生または状態変化をネイティブ層218へ送信する。
The
<フローチャート>
以下では、モバイルコンピュータの一種であるスマートフォンが、SVGコンテンツを生成する手順、および、生成したSVGコンテンツを画像に変換しプリンタ112に印刷指示する手順を説明する。
<Flowchart>
Hereinafter, a procedure in which a smartphone, which is a type of mobile computer, generates SVG content and a procedure for converting the generated SVG content into an image and instructing the
図3は本実施形態におけるフローチャートである。図3(a)は、アプリに対するユーザーの操作手順を示したフローチャートであり、図3(b)は、ユーザー操作に対応するアプリ内部の内部処理を記載したフローチャートである。ユーザー操作と内部処理とが1対多の関係にある場合も存在する。例えばS304の用紙サイズ選定では、内部処理としてS304_1とS304_2の二つの処理を行っている。このように、一つのユーザー操作に対して複数の内部処理が発生する場合は操作手順の番号に加えアンダーバーで副番号を付加している。図3(b)の処理は、CPU100が、ROM101または2次記憶装置103内に格納されたプログラムを読み込んでRAM102に展開し、これをCPU100が実行することで実現される。例えば、CPU100が、印刷アプリ200として機能する。尚、各処理の説明における記号「S」は、当該フローチャートにおけるステップであることを意味する。
FIG. 3 is a flowchart of the present embodiment. FIG. 3A is a flowchart showing a user operation procedure for the application, and FIG. 3B is a flowchart describing internal processing inside the application corresponding to the user operation. There is also a case where the user operation and the internal processing have a one-to-many relationship. For example, in the paper size selection of S304, two processes, S304_1 and S304_2, are performed as internal processes. In this way, when a plurality of internal processes occur for one user operation, a sub number is added with an underscore in addition to the operation procedure number. The process of FIG. 3B is realized when the
本実施形態では最終的に図4(a)のような写真一枚にロゴ一つが重畳されたコンテンツ(SVGコンテンツともいう)を生成し、印刷することを想定する。図4(a)のSVGコンテンツ400は、写真401の前面の一部にロゴ402が重畳して配されている例を示している。図4(b)は、印刷アプリ200によって、情報処理装置115のディスプレイ104に表示されるUI画面の例を示している。以下では、まず、SVGコンテンツの生成を説明する。
In the present embodiment, it is assumed that a content (also referred to as SVG content) in which one logo is superimposed on one photo as shown in FIG. 4A is finally generated and printed. The
ハイブリッドアプリである印刷アプリ200では、前述のとおり、ロゴが重畳されたコンテンツを、ウェブ言語を用いて生成する。本実施形態では、HTMLの一部として利用可能なSVGで印刷コンテンツを生成する例を説明する。もちろんHTMLで印刷コンテンツを生成してもよい。
As described above, the
近年のプリンタは、非常に高画質に印刷することが可能であり、それに伴い印刷時に必要な画像サイズは、2000px×3000pxなどのように非常に大きなサイズを要する。このサイズはスマートフォンの画面からはみ出るほど大きい。よって、SVGコンテンツを生成している途中の過程においては、基本的にUI用の小さなサイズでディスプレイ104の画面にコンテンツの表示が行われる。本例では、UI用に表示するSVGサイズを600px×400pxとして説明を行う。600px×400pxのSVGコンテンツのひな形は下記のようになる。
----------------------------------------------
[[SVG記述例2]]
<svg width=400 height=600 viewBox=”0 0 400 600”>
</svg>
----------------------------------------------
Recent printers can print with very high image quality, and accordingly, the image size required for printing requires a very large size such as 2000 px × 3000 px. This size is so large that it extends beyond the screen of the smartphone. Therefore, in the process of generating SVG content, the content is basically displayed on the screen of the
----------------------------------------------
[[SVG description example 2]]
<svg width = 400 height = 600 viewBox = ”0 0 400 600”>
</ svg>
----------------------------------------------
図3のフローチャートは、このSVGコンテンツのひな形を印刷アプリ200が読み込んだ時点で処理がスタートする。具体的には、S301では、ユーザーが印刷アプリ200を起動し、印刷アプリ200がSVGコンテンツのひな型を読み込む(S301_1)。S301_1では、例えば図4(b)のうちのSVGコンテンツ400がディスプレイ104の画面に表示されていない状態の画面が表示される。
The flow chart of FIG. 3 starts processing when the
SVGは、XML(Extensible Markup Language)の一種であり、特定の開始タグ(<svg>)から終了タグ(</svg>)までのひとまとまりが要素である。要素を追加していくことでコンテンツが生成される。 SVG is a kind of XML (Extension Markup Language), and a group from a specific start tag (<svg>) to an end tag (</ svg>) is an element. Content is generated by adding elements.
S302においてユーザーは、コンテンツの一部として、画像を追加する。ここでは、写真401を追加するものとする。即ち、印刷アプリ200は、S302_1で、ユーザー操作に基づいて画像をSVGコンテンツに追加する。画像の追加は画像追加ボタン403(図4(b))の押下をトリガーとし、スマートフォン端末内から、ユーザーが画像を選択することで行われる。画像選択および取得は、バインディング機能を用いて各OSが用意しているネイティブ層のAPIを利用してもよいし、HTML標準の機能を利用してもよい。例えばHTMLであれば<input type=“file” 以下略 />のようにinputタグを用いることで端末内へのファイルアクセス、および、データの取得が可能であることは周知である。当然、ネットワークを通じてSNS、クラウド、またはウェブサイトから画像取得が行われてもよい。
In S302, the user adds an image as part of the content. Here, it is assumed that
取得した画像をSVGコンテンツに追加すると、上記のSVG記述例2は、下記のようになる。
----------------------------------------------
[[SVG記述例3]]
<svg width=400 height=600 viewBox=”0 0 400 600”>
<image width=400 height=600 xlink:href=”画像データ”></image>
</svg>
----------------------------------------------
When the acquired image is added to the SVG content, the above SVG description example 2 becomes as follows.
----------------------------------------------
[[SVG description example 3]]
<svg width = 400 height = 600 viewBox = ”0 0 400 600”>
<image width = 400 height = 600 xlink: href = "image data"></image>
</svg>
----------------------------------------------
image要素は、SVGの開始タグから終了タグの間に挿入されている。XMLは、このように階層構造的にコンテンツを記述することが可能である。この例の場合、image要素は、svg要素の子要素と表現できる。逆にsvg要素は、image要素の親要素と表現できる。このように、階層構造で記述された要素は、子要素、または、親要素などと表現される。SVGの要素には、色またはフォントの種類等、様々な設定が可能である。このとき、親要素は、子要素の設定値の影響は受けず、子要素は、親要素の設定値の影響を受けるように構成されている。 The image element is inserted between the start tag and the end tag of SVG. XML can describe contents in such a hierarchical structure. In the case of this example, the image element can be expressed as a child element of the svg element. Conversely, the svg element can be expressed as the parent element of the image element. In this way, the elements described in the hierarchical structure are expressed as child elements, parent elements, and the like. Various settings such as color or font type can be set for the SVG element. At this time, the parent element is not affected by the set value of the child element, and the child element is configured to be affected by the set value of the parent element.
SVG記述例3において、image要素は、横幅(width)が600px、縦幅(height)が400pxとして設定されている。SVGも同様の数値が設定されているため、このSVGでは、写真がSVGコンテンツ中の全面に表示されることになる。image要素内の「画像データ」は、画像を示すパスでもよいし、Base64形式の画像でもよい。 In the SVG description example 3, the image element is set with a width (wise) of 600 px and a height (height) of 400 px. Since the same numerical value is set for SVG, the photograph is displayed on the entire surface of the SVG content in this SVG. The "image data" in the image element may be a path indicating an image or an image in Base64 format.
ここで、ウェブブラウザにおける考え方であるDOM(Document Object Model)を説明する。DOMとは、XMLで記述したSVGなどのコンテンツを管理するためのモデルである。先述のようなSVGコンテンツは、単なる文字列であり、このままではJavaScriptによって操作することができない。そのため、ウェブブラウザでは、HTMLまたはSVGなどのXMLを解析し、DOMツリーと呼ばれる階層構造を持ったモデルに変換し、管理することが行われている。これにより、SVGの要素に対しJavaScriptからアクセスすることが可能となり、SVGの内容の変更等の操作することが可能となる。 Here, the DOM (Document Object Model), which is a concept in a web browser, will be described. The DOM is a model for managing contents such as SVG described in XML. The SVG content as described above is just a character string and cannot be operated by Javascript as it is. Therefore, the web browser analyzes XML such as HTML or SVG, converts it into a model having a hierarchical structure called a DOM tree, and manages it. As a result, the elements of SVG can be accessed from Javascript, and operations such as changing the contents of SVG can be performed.
本実施形態では説明を簡単にするため、変更されたSVGをXML形式の文字列で表記している。実際のアプリでは、JavaScriptを実行させ、DOMとして要素の追加が行われる。即ち、SVG記述例2で示す空のSVGコンテンツに対して画像を追加する場合、JavaScriptを実行させ、DOMとして要素の追加が行われることになる。具体的にはコンテンツ操作部210が、「image要素の生成」、「image要素に設定値を追加」、「svgへ追加」をJavaScriptで実行することになる。例えば、SVGコンテンツへの要素の追加は、下記のようにして実装される。
----------------------------------------------
[[JavaScriptの実行例]]
var xmlns = “ http://www.w3.org/2000/svg ”;
var xlink = “ http://www.w3.org/1999/xlink “
var img = document.createElementNS(xmlns, “image”);
img.setAttributeNS(xlink, “href”, “画像データ”);
img.setAttribute(“width”, 400);
img.setAttribute(“height”, 600);
var svg = document.querySelector(“svg”);
svg.appendChild(img);
----------------------------------------------
In this embodiment, the modified SVG is represented by a character string in XML format for the sake of simplicity. In the actual application, Javascript is executed and the element is added as DOM. That is, when an image is added to the empty SVG content shown in SVG description example 2, Javascript is executed and an element is added as a DOM. Specifically, the
----------------------------------------------
[[Example of Javascript execution]]
var xmlns = “http: //www.w3.org/2000/svg” ;
var xlink = “http: //www.w3.org/1999/xlink”
var img = document. createElementNS (xmlns, “image”) ;
img. setAttributeNS (xlink, “href”, “image data”) ;
img. setAttribute (“width”, 400) ;
img. setAttribute (“height”, 600) ;
var svg = document. querySelector (“svg”) ;
svg. appendChild (img) ;
----------------------------------------------
次にS303で、ユーザーは、図4(b)のロゴ追加ボタン404を押下してロゴを選択し、図4(a)に示すように、S302で追加した写真401にロゴ402を追加する。即ち、S302_1において印刷アプリ200は、ロゴ402を追加する。ロゴの追加は、S302_1と同じ手順で実現できる。ただし、ロゴに関しては画面の右下に小さく表示するものとし、それを表すと下記のようなSVGとなる。
----------------------------------------------
[[SVG記述例4]]
<svg width=400 height=600 viewBox=”0 0 400 600”>
<image width=400 height=600 xlink:href=”画像データ”></image>
<image x=300 y=550 width=100 height=50 xlink:href=”画像データ”></image>
</svg>
----------------------------------------------
Next, in S303, the user presses the
----------------------------------------------
[[SVG description example 4]]
<svg width = 400 height = 600 viewBox = ”0 0 400 600”>
<image width = 400 height = 600 xlink: href = "image data"></image>
<image x = 300 y = 550 width = 100 height = 50 xlink: href = "image data"></image>
</svg>
----------------------------------------------
SVG記述例4では、新たに「x」「y」が登場している。これらはx座標、y座標のことであり、指示した数値だけ二次元平面を平行移動することになる。これにより、写真401の前面の右下の位置にロゴ402が重畳されたSVGコンテンツ400が完成する。
In SVG description example 4, "x" and "y" are newly introduced. These are the x-coordinate and the y-coordinate, and the two-dimensional plane is translated by the specified numerical value. As a result, the
次に、印刷アプリ200は、プリンタ112と通信を行い、印刷に用いる用紙サイズを決定し、レンダリングに必要な画像の画素数を取得する処理を行う。まず、用紙サイズの選定が行われる。S304でユーザーは、図4(b)に示す印刷設定ボタン405を押下する。これを受けて印刷アプリ200は、S304_1においてプリンタからプリンタ情報を取得し、S305_2において印刷アプリ200は、サイズリストをディスプレイ104に表示する。S304_1およびS305_2の処理の詳細を、図5を用いて説明する。
Next, the
<印刷設定の詳細>
図5は、プリンタ情報取得処理の詳細を示すフローチャートである。S501およびS509〜S511は、情報処理装置115のCPU100がスクリプト層217で実行する処理である。また、S502、S504、S505、S507、およびS508は、情報処理装置115のCPU100がネイティブ層218で実行する処理である。また、S503およびS506は、外部デバイスであるプリンタ112が実行する処理である。
<Details of print settings>
FIG. 5 is a flowchart showing the details of the printer information acquisition process. S501 and S509 to S511 are processes executed by the
S501で、スクリプト層217は、ネイティブ層218にプリンタ情報取得を依頼する。依頼の方法は、画像選択時と同様に、バインディング機能によりスクリプトからネイティブ固有のAPIを呼び出す。ネイティブ層218には、スクリプト層217から直接呼び出せる関数もしくはその関数を間接的に呼び出す、いわゆる、ラッパが予め用意されている。例えば、GetPrinterInfoというネイティブ関数を用意しておき、スクリプト側からその関数を呼び出す。このようにして、ネイティブ層218はスクリプト層217からの外部デバイスとの通信の要求を取得する。
In S501, the
通常、スクリプト層217からは、セキュリティ上の制限で外部デバイスと直接通信することはできない。そのため、上記のように、スクリプト層217は、一旦、ネイティブ層218へ外部デバイス情報の取得を依頼し、ネイティブ層218を介して外部デバイスと通信を行う。ネイティブ層218は、OS層219を介して、外部デバイス(例えば、プリンタ112)と通信する機能を備えている。
Normally, the
ネイティブ層218は、上記のような関数を呼び出されると、S502においてプリンタの検出、いわゆるディスカバリーを行う。例えば、ネイティブ層218は、同一無線LANルータで繋がっているプリンタを検出する。ここでは、通信可能なプリンタの検出を行うため、例えば、Bonjour(登録商標)などのプロトコルにより、ブロードキャストまたはマルチキャスト等の方法を用いてプリンタに対して通信を試みる。
When the above function is called, the
S503において、プリンタ112は、S502で送られた要求に応じて、応答する。
In S503, the
S504においてネイティブ層218は、応答があったプリンタのIPアドレスを検知して記憶する。次に、S505でネイティブ層218は、応答があったプリンタのIPアドレスに、プリンタ情報の提供を要求する。応答があったプリンタが複数の場合、ネイティブ層218は、全てのプリンタに対して情報の提供を要求する。ネイティブ層218では、プリンタの情報を取得するためのコマンドを生成する。そのコマンドは、プリンタの動作を指定する命令であり、一例として、以下のようなXMLで表現されるコマンドである。
----------------------------------------------
[[プリンタ情報取得コマンド例]]
01: <?xml version="1.0" encoding="utf-8" ?>
02: <cmd xmlns:trans="http://www.xxxx/yyyyy/">
03: <contents>
04: <operation>GetInformation</operation>
05: </contents>
06: </cmd>
----------------------------------------------
In S504, the
----------------------------------------------
[[Printer information acquisition command example]]
01: <? Xml version = "1.0" encoding = "utf-8"?>
02: <cmd xmlns: trans = "http: //www.xxxx/yyyyy/">
03: <contents>
04: <operation> GetInformation </ operation>
05: </ contents>
06: </ cmd>
----------------------------------------------
上記各行の左側に書かれている「01:」等の数値は、説明を行うために付加した行番号であり、本来のXML形式のテキストには記載されない点に留意されたい。 It should be noted that the numerical values such as "01:" written on the left side of each of the above lines are line numbers added for explanation and are not described in the original XML format text.
1行目は、ヘッダであり、XML形式で記述していることを表している。2行目のcmdは、コマンドの開始を意味する。xmlnsで名前空間を指定し、コマンドの解釈の定義を指定している。尚、6行目の</cmd>でコマンドの終了を示している。 The first line is a header, which indicates that it is described in XML format. The cmd on the second line means the start of the command. The namespace is specified by xmlns, and the definition of command interpretation is specified. The end of the command is indicated by </ cmd> on the 6th line.
3行目は、以後に内容を記載する宣言であり、5行目でその終了を示している。 The third line is a declaration that describes the contents thereafter, and the fifth line indicates the end.
4行目には要求する命令が記載されており、<operation>と</operation>との間に実際の命令文言が存在する。命令文言であるGetInformationは、外部デバイスであるプリンタの情報を取得する命令である。例えば、プリンタが対応している用紙種類、サイズ、縁なし印刷機能の有無、および印刷品位等のケーパビリティ情報を提供するよう要求する。 The required instruction is described on the fourth line, and the actual instruction wording exists between <operation> and </ operation>. The command wording, Get Information, is a command for acquiring information on a printer, which is an external device. For example, it is required to provide capability information such as the paper type, size, borderless printing function, and print quality supported by the printer.
尚、プリンタ情報取得コマンドの生成は、例えば、ROM101に予め記憶した固定のテキストを読み込んでもよい。また、XML等のテキスト形式に限らず、バイナリ形式で記述し、それに沿ったプロトコルで通信してもよい。生成したプリンタ情報取得コマンドは、HTTP等のプリンタが対応している通信プロトコルに従った形式で、外部デバイス通信部221を介してプリンタ112へ送信される。
To generate the printer information acquisition command, for example, a fixed text stored in advance in the
また、通信方法はこれに限定されるものではない。Wi−Fi Direct(登録商標)、Bluetooth(登録商標)、赤外線通信、電話回線、有線LAN、またはUSBを用いた接続でもよく、その方法に沿ったプロトコルで通信を行えば同様の効果を得ることができる。 Moreover, the communication method is not limited to this. Wi-Fi Direct (registered trademark), Bluetooth (registered trademark), infrared communication, telephone line, wired LAN, or connection using USB may be used, and the same effect can be obtained by communicating using a protocol according to the method. Can be done.
尚、図5の例では、ネイティブ層218で、コマンドを生成する構成としているが、スクリプト層217で、コマンドを生成する構成でも、同様の効果が得られる。その場合、スクリプト層217で、例えば、上記のXML形式の命令文を含むコマンドを生成し、ネイティブ層218へ渡す。それを受けて、ネイティブ層218は、通信プロトコルに従った形式でプリンタ112へそのコマンドを送信すればよい。
In the example of FIG. 5, the
プリンタ112は、情報処理装置115からコマンドを受信すると、S506で、デバイス情報であるプリンタ情報をXML形式で通信プロトコルに沿って、情報処理装置115へ送信する。以下に、プリンタの情報の一例を示す。
----------------------------------------------
[[プリンタ情報の例]]
01: <?xml version="1.0" encoding="utf-8" ?>
02: <cmd xmlns:trans="http://www.xxxx/yyyyy/">
03: <contents>
04: <device id=”Printer001” />
05: <memory receive= 7680000 />
06: <mode = 1>
07: <media>GlossyPaper</media>
08: <size>A4</size>
09: <quality>1</quality>
10: <border>no</border>
11: <pixels>
12: <width>4000</width>
13: <height>6000</height>
14: </pixels>
15: </mode>
16: <mode = 2>
〜中略〜
</mode>
<mode = 3>
〜中略〜
</mode>
〜中略〜
</contents>
</cmd>
----------------------------------------------
When the
----------------------------------------------
[[Example of printer information]]
01: <? Xml version = "1.0" encoding = "utf-8"?>
02: <cmd xmlns: trans = "http: //www.xxxx/yyyyy/">
03: <contents>
04: <device id = ”Printer001” />
05: <memory receive = 7680000 />
06: <mode = 1>
07: <media> Glossy Paper </ media>
08: <size> A4 </ size>
09: <quality> 1 </ quality>
10: <border> no </ border>
11: <pixels>
12: <width> 4000 </ width>
13: <height> 6000 </ height>
14: </ pixels>
15: </ mode>
16: <mode = 2>
~ Omitted ~
</ Mode>
<Mode = 3>
~ Omitted ~
</ Mode>
~ Omitted ~
</ Contents>
</ cmd>
----------------------------------------------
1行目はヘッダであり、XML形式で記述していることを表している。2行目のcmdは、コマンドの開始を意味する。xmlnsで名前空間を指定し、コマンドの解釈の定義を指定している。尚、最下行の</cmd>でコマンドの終了を示している。 The first line is a header, which indicates that it is described in XML format. The cmd on the second line means the start of the command. The namespace is specified by xmlns, and the definition of command interpretation is specified. The bottom line </ cmd> indicates the end of the command.
3行目は、以後に内容を記載する宣言であり、下の</contents>までその内容は継続する。4行目は、デバイスIDを示している。ここでは、プリンタ112の機種名が「Printer001」であることを表している。6行目以降は、プリンタ112が有する各モードについての記述である。<mode>から</mode>までで、1つのモードにおける情報が記述されている。6行目では、モードの番号が1である。以降の<media>は印刷用紙の種類、<size>は用紙サイズ、<quality>は印刷品位、<border>は縁あり/なしの情報をそれぞれ記述している。11行目の<pixels>は、印刷に必要な入力画像のサイズを表しており、印刷時には横方向が4000[px]、縦方向が6000[px]の画像が必要であることを示している。
The third line is a declaration that describes the content after that, and the content continues until </ contents> below. The fourth line shows the device ID. Here, it means that the model name of the
15行目以降は、他のモードであるモード2についての情報が記述されている。このように、プリンタ112の機種名と、そのプリンタが対応している全てのモードとが、XMLに記述されている。尚、プリンタ情報の記述方法はこれに限定されることはなく、タグ形式でないテキスト、または、バイナリ形式等の他の形式であってもよい。
From the 15th line onward, information about the other mode,
また、プリンタ情報の例としては、上記の示すものに限られない。例えば、プリンタが処理可能な画像処理および解析処理、静かに印刷するモードの有無、メモリカードの利用有無、ならびにインク残量などのステータスの情報を受け渡ししてもよい。画像処理の例としては、モノクロ、セピア、もしくは彩度強調などの色変換、複数画像のレイアウト、ホワイトバランス補正、ノイズ除去、または、その他自動で写真を好ましい色もしくは輝度に補正する処理などが挙げられる。 Further, the example of the printer information is not limited to the one shown above. For example, status information such as image processing and analysis processing that can be processed by the printer, the presence / absence of a quiet printing mode, the presence / absence of a memory card, and the remaining amount of ink may be passed. Examples of image processing include color conversion such as monochrome, sepia, or saturation enhancement, multiple image layout, white balance correction, noise removal, or other processing that automatically corrects a photo to a preferred color or brightness. Be done.
S507でネイティブ層218は、プリンタ112からプリンタ情報を取得する。即ち、ネイティブ層218は、受信したプリンタ情報から、例えば、プリンタ112が有する全てのモードにおける印刷用紙の種類、サイズ、印刷品位、縁あり/なしの項目、および項目数等を取得する。
In S507, the
S508でネイティブ層218は、受信したプリンタ情報をスクリプト層217が解釈可能な形式に変換して、スクリプト層217へ送信する。具体的には、ネイティブ関数を設けておき、バインディング機能を用いる。あるいは、受け取ったXML形式のプリンタ情報で送信したり、タグなしのテキスト形式に変えて送信したりする等の方法を用いてもよい。スクリプト層217から特定のネイティブ関数を呼び出す毎に、その戻り値として情報を提供してもよい。ネイティブ関数に取得するモードなどの引数を渡し、その戻り値として情報を提供してもよい。上述のJSON文字列を用いた受け渡しをしてもよいし、データ変換部207、203を用いてBase64等の文字列で受け渡しを行ってもよい。
In S508, the
本実施形態ではJSON(JavaScript Object Notation)形式としてスクリプト層へ送信することとする。例えば、下記のような情報となる。
----------------------------------------------
[[JSON形式の例]]
PrinterInfo = {
“deviceID”: “Printer001”,
“memoryRecieve”: “7680000”,
“mode”: [ {
“media”: “光沢紙”,
“size”: “A4”,
“quality”: 1,
“border”: “no”,
“pixels”: {
“width”:4000,
“height”:6000
}
},
//モードの数だけ配列にする
]
}
----------------------------------------------
In this embodiment, it is transmitted to the script layer as JSON (Javascript Object Notation) format. For example, the information is as follows.
----------------------------------------------
[[Example of JSON format]]
PrinterInfo = {
“DeviceID”: “Printer001”,
“MemoryRecieve”: “7680000”,
“Mode”: [{
“Media”: “Glossy paper”,
“Size”: “A4”,
“Quality”: 1,
“Border”: “no”,
“Pixels”: {
“Width”: 4000,
“Height”: 6000
}
},
// Array as many as the number of modes
]
}
----------------------------------------------
S509で、スクリプト層217は、ネイティブ層218から受信したプリンタ情報に基づいて、用紙サイズを選択する設定画面を表示する。図6は、用紙サイズを選択する設定画面の例を示す図である。本実施形態では一番初めに見つかったプリンタから情報を取得し表示することとする。当然、接続可能なプリンタが複数ある場合はプリンタ名を表示し、ユーザーに印刷するプリンタを選択させるという処理を行ってもよい。尚、プリンタの選択は、上記に限らず、より機能が多いプリンタ、または、印刷ジョブが混雑していないプリンタを選択する、等の方法も考えられる。
In S509, the
図6のような用紙サイズ設定画面の形成方法としては、HTMLのラジオボタン機能を用いればよい。ラジオボタンを用いることで複数の選択候補602の中から一つだけチェック601を入れることが可能なUIを簡単に構築できる。
As a method of forming the paper size setting screen as shown in FIG. 6, the radio button function of HTML may be used. By using a radio button, it is possible to easily construct a UI in which only one
図6の「L版」、「A4」などの文言および表現は、プリンタから送られてきた情報と結び付けてネイティブ層218が決定する。例えば、プリンタから送られてきた情報より取り出した用紙サイズの値が「L」であった場合、表示するテキストは「L版」と決定する。決定の方法として、ネイティブ層218は、これらの対応表を予め保持しておき、その対応表に沿ってテキストを決定すればよい。この対応表を切り替えることで、多言語の対応が可能となる。
Words and expressions such as "L version" and "A4" in FIG. 6 are determined by the
尚、上記では、用紙サイズのみ設定を行っているが、用紙種類、印刷品位、縁あり/なし、両面/片面、カラー/モノクロ、または、画像補正のオン/オフ等の他の設定が行われてもよい。また、前述のように印刷機能のみではなく、プリンタが処理可能な画像処理もしくは解析処理、静かに印刷するモードの有無、メモリカードの利用有無、またはインク残量などのステータスの情報を表示してもよい。 In the above, only the paper size is set, but other settings such as paper type, print quality, bordered / non-rimmed, double-sided / single-sided, color / monochrome, or image correction on / off are made. You may. In addition to the printing function as described above, status information such as image processing or analysis processing that can be processed by the printer, the presence / absence of a quiet printing mode, the presence / absence of a memory card, or the remaining amount of ink is displayed. May be good.
S510で、スクリプト層217は、表示されているラジオボタンを介してユーザーから用紙サイズの選択を受け付ける。即ち、ユーザーは、複数の選択候補602の中からラジオボタンにチェック601を入れ、決定ボタン603を押下する。
In S510, the
S511では、ユーザーによる選択に従って用紙サイズが決定され、処理を終了する。決定ボタン603が押下された場合、印刷アプリ200は、決定した用紙サイズと紐づいている入力画像サイズを、レンダリングのサイズとして決定する。以上が図5の説明である。次に、図3に戻り説明を続ける。
In S511, the paper size is determined according to the selection by the user, and the process ends. When the
S305において、ユーザーは、印刷ボタン406を押下して印刷指示を入力する。印刷指示を受けて、印刷アプリ200は、印刷処理を開始する。印刷処理が開始されると、生成したSVGコンテンツの画像化から印刷までの処理(S305_1〜S305_7)が順番に実行される。
In S305, the user presses the
S305_1において印刷アプリ200は、SVGサイズを修正する。即ち、コンテンツ操作部210は、UI用に生成されていたSVGのサイズを、印刷用のサイズに変換する。印刷用のサイズは、用紙サイズ設定画面で決定した情報に基づいて決定される。本実施形態では、上述したように、A4サイズが選択され、レンダリングで生成される画像の最終出力サイズは、横幅4000px、縦幅6000pxとなる。レンダリングとは、SVGコンテンツから印刷に用いる画像データを生成することを意味している。本実施形態では、特に区別しない場合、レンダリングと描画とは同等の意味で用いる。以下で説明するように、本実施形態では、描画が完了した画像をスクリーンショットして得られた画像データを用いて印刷が行われることになる。
In S305_1, the
尚、本実施形態では、SVGコンテンツに、描画判定用のマーカーを付す。マーカーは、SVGコンテンツの描画完了前の時点でスクリーンショットして得られた画像が印刷用の画像として用いられることがないように、SVGコンテンツに付与される。即ち、マーカーの有無で描画完了の判定が行われる。本明細書において描画(レンダリング)は、解析したSVGコンテンツを画像データとして出力できる状態を示しており、ディスプレイへの表示、非表示は問わない。 In this embodiment, a marker for drawing determination is attached to the SVG content. Markers are added to the SVG content so that the image obtained by screenshot before the completion of drawing the SVG content is not used as an image for printing. That is, the completion of drawing is determined by the presence or absence of the marker. In the present specification, drawing (rendering) indicates a state in which the analyzed SVG content can be output as image data, and it does not matter whether it is displayed or hidden on the display.
スクリプト層217からネイティブ層218に送信するSVGコンテンツは、マーカーを含めた4005px×6000pxのSVGとなる。ここでマーカーを付加したSVGは、下記のようになる。
----------------------------------------------
[[SVG記述例5]]
<svg width=4005 height=6000 viewBox=”0 0 4005 6000”>
<svg width=4000 height=6000 viewBox=”0 0 400 600”>
<image width=400 height=600 xlink:href=”画像データ”></image>
<image x=300 y=550 width=100 height=50 xlink:href=”画像データ”></image>
</svg>
<rect x=4000 y=0 width=5 height=6000 fill=”red”></rect>
</svg>
----------------------------------------------
The SVG content transmitted from the
----------------------------------------------
[[SVG description example 5]]
<svg width = 4005 height = 6000 viewBox = ”0 0 4005 6000”>
<svg width = 4000 height = 6000 viewBox = ”0 0 400 600”>
<image width = 400 height = 600 xlink: href = "image data"></image>
<image x = 300 y = 550 width = 100 height = 50 xlink: href = "image data"></image>
</svg>
<rect x = 4000 y = 0 width = 5 height = 6000 fill = ”red”></rect>
</svg>
----------------------------------------------
図7は、描画される画像の例を示す図である。図7(a)は、スクリーンショットで最終的に取得したい画像の一例を示している。上記のSVGでは、図7(a)に示すように、印刷サイズより横幅をさらに5px分広く設定し、その領域の色を全て赤色にするコンテンツとしている。この拡張した領域が、マーカーに相当する。 FIG. 7 is a diagram showing an example of an image to be drawn. FIG. 7A shows an example of an image that is finally desired to be acquired as a screenshot. In the above SVG, as shown in FIG. 7A, the width is set to be 5 px wider than the print size, and the color of the area is all red. This expanded area corresponds to a marker.
S305_2で印刷アプリ200は、SVGコンテンツを修正する。即ち、コンテンツ操作部210は、SVGコンテンツの非同期処理が行われないように、SVGコンテンツを修正する。非同期処理とは、ウェブエンジン224で描画が行われる際に、SVGコンテンツの各要素が随時解析され、画像データとして反映できる状態になった要素から非同期的に描画されて出力される処理である。非同期処理が行われると、印刷画像に不要な画像も随時生成されるため、無駄な負荷が発生する。本実施形態では、非同期処理を制御するために、SVGコンテンツを修正する。例えば、本実施形態では、ウェブエンジン224にデータの同期描画(同時描画)を行わせるために、ウェブエンジン22への設定項目である表示ON・OFFを制御する記述をSVGコンテンツに埋め込む。ウェブエンジン224は、ウェブページを表示する機能を有するものであり、ウェブページを表示する際に、上述したように、描画処理を行って画像化を行うものである。本実施形態では、表示をさせない命令をSVGコンテンツに追加することで、ウェブエンジン224において、直ちに描画処理を行わせないように、即ち、非同期処理を行わせないように制御する。上述したSVG記述例5に、このような修正を適用したSVGは、下記のようになる。
----------------------------------------------
[[SVG記述例6]]
<svg width=4005 height=6000 viewBox=”0 0 4005 6000” style=”display:none;”onload=”(function(){ this.style.display='block';}.bind(this))();”>
<svg width=4000 height=6000 viewBox=”0 0 400 600”>
<image width=400 height=600 xlink:href=”画像データ”></image>
<image x=300 y=550 width=100 height=50 xlink:href=”画像データ”></image>
</svg>
<rect x=4000 y=0 width=5 height=6000 fill=”red”></rect>
</svg>
----------------------------------------------
In S305_2, the
----------------------------------------------
[[SVG description example 6]]
<svg width = 4005 height = 6000 viewBox = ”0 0 4005 6000” style = ”display: none ;” onload = ”(function () {this.style.display ='block' ;} .bind (this)) ( ) ; ”>
<svg width = 4000 height = 6000 viewBox = ”0 0 400 600”>
<image width = 400 height = 600 xlink: href = "image data"></image>
<image x = 300 y = 550 width = 100 height = 50 xlink: href = "image data"></image>
</svg>
<rect x = 4000 y = 0 width = 5 height = 6000 fill = ”red”></rect>
</svg>
----------------------------------------------
上記SVGでは、「display:none」の命令を追加することにより画面上に表示をさせない設定を追加している。後述するように、本実施形態では、オフスクリーンにおいて表示された画像のスクリーンショットで得られた画像データが、印刷用のデータとして扱われる。要素ごとの描画が非同期で行われるウェブエンジン224では、要素の解析が終了次第、要素ごとに画像が描画される。一方、ウェブエンジン224では、全ての要素の配置関係が特定できる状態で描画する場合、配置関係を考慮して描画処理が行われる。このため、ウェブエンジン224に非同期処理を行わせないように制御することで、無駄な描画処理がなされず、情報処理装置115の処理負荷を低減させることができる。
In the above SVG, a setting that does not display on the screen is added by adding a command of "display: none". As will be described later, in the present embodiment, the image data obtained by the screenshot of the image displayed on the off-screen is treated as the data for printing. In the web engine 224 in which drawing for each element is performed asynchronously, an image is drawn for each element as soon as the analysis of the element is completed. On the other hand, in the web engine 224, when drawing in a state where the arrangement relationship of all the elements can be specified, the drawing process is performed in consideration of the arrangement relationship. Therefore, by controlling the web engine 224 so as not to perform asynchronous processing, unnecessary drawing processing is not performed, and the processing load of the
上記のSVGのように「display:none」を追加すると、ウェブエンジン224では、描画自体が行われない。つまり、ウェブエンジン224では、画像を取得した時に「display:none」が記述された要素は、存在しない状態になる。この非表示命令は、より詳細には、インタプリタ214で解釈され、ウェブエンジン224で実現される。
If "display: none" is added as in the above SVG, the drawing itself is not performed in the web engine 224. That is, in the web engine 224, the element in which "display: one" is described does not exist when the image is acquired. This hidden instruction is, in more detail, interpreted by the
また、上記SVGでは、「onload」(読み込み完了)を検知したタイミングで、非表示設定を取り消すスクリプトを埋め込んでいる。即ち、「display:block」に変更する命令を埋め込んでいる。尚、display:blockとは、要素を表示することを意味する。SVGには、JavaScriptと連携する機能が備わっている。onloadは、その要素におけるDOMの解析およびリソース取得が終了し、要素に対するJavaScript操作および描画の準備が整ったタイミングで、ウェブブラウザ(ウェブエンジン224)から発行される。つまり、onloadは、ウェブブラウザ(ウェブエンジン224)から発行されるロード完了通知である。上記の例のように、onloadにスクリプトを紐づけておくことによって、onload発行のタイミングで任意のスクリプトを実行させることが可能である。 Further, in the above SVG, a script for canceling the non-display setting is embedded at the timing when "onload" (reading is completed) is detected. That is, an instruction to change to "display: block" is embedded. Note that display: block means to display an element. SVG has a function to cooperate with Javascript. The onload is issued from the web browser (web engine 224) when the DOM analysis and resource acquisition of the element are completed and the Javascript operation and drawing for the element are ready. That is, onload is a load completion notification issued from a web browser (web engine 224). By associating a script with onload as in the above example, it is possible to execute an arbitrary script at the timing of issuing onload.
尚、onloadは、子要素(image要素2つとも)のロードが完了した場合にそれぞれ発行されるが、親要素のonloadの場合、子要素のonloadが全て終了してから発行される。本例では、親要素のonloadの場合の処理を規定している。このため、子要素のonloadが全て終了してから発行される親要素のonloadは、印刷用の描画の準備が整った状態であることを意味する。つまり、本実施形態では、onload発行を、描画の同期処理の準備が完了したトリガーとして扱う。 Note that onload is issued when the loading of child elements (both image elements) is completed, but in the case of parent element onload, it is issued after all child element onloads are completed. In this example, the processing in the case of onload of the parent element is specified. Therefore, the onload of the parent element, which is issued after all the onloads of the child elements are completed, means that the drawing for printing is ready. That is, in the present embodiment, onload issuance is treated as a trigger in which preparation for drawing synchronization processing is completed.
通常、ウェブエンジン224は、ユーザビリティの観点からコンテンツの要素を非同期的に描画するように構成されている。もし、ウェブエンジン224が、解析を完了した要素から非同期的に描画する場合、不要な描画処理が何度も実行されることになり、パフォーマンスに影響を与える。例えば、図7(a)の画像を取得したいにも関わらず、図7(b)のようにロゴが反映されていない、いわば生成途中の画像の生成を経由したのち、図7(a)の画像が生成されることになる。図7(b)は、写真の画像のみが反映された生成途中の画像の例を示している。ここで、図7(b)のロゴの領域には、所望とする画像領域ではなく、別の画像領域(つまり、図7(a)ではロゴによって上書きされることで、本来は不要な画像領域)が描画されている。この場合、再度ロゴの画像領域を上書きする必要がある。これは無駄な描画を行っている以外の何ものでもなく、避けるべき状態である。 Normally, the web engine 224 is configured to asynchronously draw the elements of the content from the viewpoint of usability. If the web engine 224 draws asynchronously from the element that has completed the analysis, unnecessary drawing processing will be executed many times, which affects the performance. For example, although it is desired to acquire the image of FIG. 7 (a), the logo is not reflected as shown in FIG. 7 (b), so to speak, after passing through the generation of an image in the process of being generated, in FIG. 7 (a). An image will be generated. FIG. 7B shows an example of an image in the process of being generated in which only the image of the photograph is reflected. Here, the logo area of FIG. 7B is not a desired image area, but another image area (that is, an image area that is originally unnecessary by being overwritten by the logo in FIG. 7A). ) Is drawn. In this case, it is necessary to overwrite the image area of the logo again. This is nothing more than a useless drawing and is a condition to avoid.
このような状態を避けるためには、画像として取得したい要素を描画させるタイミングの同期処理を図ることが好ましい。本実施形態では、まず、印刷に必要な要素を非表示にし、画像として取得したい要素のロード完了を検知してから表示設定に切り替える制御を組み込んでいる。先述のとおり、親要素に非表示を指示すれば子要素にも非表示が適応されるため、親要素であるSVG要素に対してスクリプトおよび非表示設定を追加している。尚、子要素にそれぞれ非表示設定を追加して制御する形態を採用してもよい。 In order to avoid such a state, it is preferable to synchronize the timing of drawing the element to be acquired as an image. In the present embodiment, first, the elements necessary for printing are hidden, and control is incorporated to switch to the display setting after detecting the completion of loading of the elements to be acquired as an image. As described above, if the parent element is instructed to be hidden, the child element is also hidden. Therefore, a script and a hide setting are added to the SVG element which is the parent element. It should be noted that a mode may be adopted in which a hidden setting is added to each child element for control.
このように、リソースの読み込みおよびDOMツリーの構築が全て完了したタイミングで表示設定に変更することで、通常の非同期的な描画から、要素の同期的な描画処理が可能となる。これにより、ウェブエンジン224が、描画可能な要素から描画するという描画処理の繰り返しを実行することを抑制することができる。この結果、スマートフォンなどの情報処理装置115の無駄な負荷を避けることができる。
In this way, by changing the display setting at the timing when the resource reading and the DOM tree construction are all completed, it is possible to perform the synchronous drawing process of the element from the normal asynchronous drawing. As a result, it is possible to prevent the web engine 224 from executing the repetition of the drawing process of drawing from the drawable element. As a result, it is possible to avoid unnecessary load on the
尚、表示設定の変更は、先述のdisplay:blockだけとは限らない。他にもvisivility:hiddenのような属性を用いて非表示にし、visivility:visibleで表示するようにしてもよい。別の方法としては、始めにSVGコンテンツのx座標およびy座標を表示領域外に指定する。そして、onloadが検知できたタイミングで表示領域内に戻すという方法でもよい。つまり、ウェブブラウザが、要素をディスプレイへ表示しない状態へ変更し、その後で、要素をディスプレイに表示する状態へ変更するといった挙動をウェブブラウザに行わせるような命令が含まれていれば何でもよい。この場合でも、非同期的な描画を抑制することができる。 It should be noted that the change of the display setting is not limited to the above-mentioned display: block. Alternatively, it may be hidden by using an attribute such as visibility: hidden and displayed by visibility: visible. As another method, first, the x-coordinate and the y-coordinate of the SVG content are specified outside the display area. Then, it may be returned to the display area at the timing when onload can be detected. In other words, any command may be included as long as the web browser includes a command that causes the web browser to perform a behavior such as changing the element to the state of not displaying it on the display and then changing the element to the state of displaying it on the display. Even in this case, asynchronous drawing can be suppressed.
S305_3において、スクリプト層217は、修正後のSVGコンテンツをネイティブ層218に送信し、ネイティブ層218においてオフスクリーンの生成が行われる。尚、印刷アプリ200でSVGコンテンツを操作する場合は、前述したように、DOMの形態をとっているため、そのままではネイティブ層218に送信できない。そのため一旦XMLの文字列形式に変換する。DOMを文字列に変換する機能にはJavaScriptに用意されているため、それを用いればよい。例えばDOMの「innerHTML」、または、XMLSerializerのserializeToString機能などを用いれば、DOMからSVGの文字列(即ち、SVGコンテンツ)としてデータを取得することができる。この変換を行ったのち、スクリプト層217は、文字列化したSVGコンテンツを、バインディング機能を用いてネイティブ層218に送信する。
In S305_3, the
尚、本実施形態はスクリプト層217でSVGコンテンツの修正を行う例を説明したが、ネイティブ層218でSVGの修正を行ってもよい。ネイティブ層では、文字列のSVGを受け取るが、XMLを解析してネイティブで操作することは既存の技術でありオープンソースなども存在する。したがって、DOMおよびSVGコンテンツの編集は、スクリプト層217に限定されるわけでなく、必要に応じてネイティブ層218とで処理を分散させてもよい。
In this embodiment, an example of modifying the SVG content in the
引き続き、S305_3でネイティブ層218は、レンダリング用のWebViewを用意する。WebViewとは、ウェブ言語で記述されたコンテンツを描画するための領域である。本来ウェブブラウザは、WWW(World Wide Web)を利用するためのツールであり、ウェブ言語で記述されたコンテンツを表示するために用いられる。それだけでなく、ウェブブラウザには、サイトを検索するための機能、ページの戻るボタン、または更新ボタンなども通常は用意されている。それに対してWebViewは、あくまでウェブ言語で記述されたコンテンツを描画する領域であり、戻るボタンなどのブラウジングにおける補助的な機能までは含まない。つまりWebViewは、ウェブエンジン224の機能を利用し、ウェブ言語における結果を描画するだけの領域である。そのため、例えば透過度を指定することにより、ユーザーからは見えない(表示はしない)が、画像データは取得できるというオフスクリーンWebViewを実現できる。本実施形態では、ネイティブ層218においてウェブコンテンツをスクリーンショットするために利用するViewを、WebViewとする。
Subsequently, in S305_3, the
本例においてネイティブ層218は、スクリプト層217から送信されてきたSVGと同じサイズのWebViewを用意する。つまり、マーカーのサイズも含む4005px×6000pxのWebViewを用意する。WebViewのサイズがSVGのサイズより小さい場合、描画されるコンテンツがはみ出して描画されない領域が発生してしまうのを抑制するためである。尚、小さいWebViewとその領域に合わせた分割SVGとを用いて、小領域ずつ処理を行ってもよい。小領域ずつ処理を行うと、利用するRAMが少なくなるためメモリ負荷が小さくなるという利点もある。本実施形態では、簡単のため、WebViewのサイズとSVGとは同じサイズで処理を行う。また、WebViewは、表示されない位置に配置する、もしくは、透過設定をするなど、ユーザーに見えない所謂オフスクリーンにしておきユーザーに見えないように処理を進める。
In this example, the
WebViewの用意が完了したら、ネイティブ層218は、スクリプト層217から送信されてきたSVGコンテンツを、用意したWebViewに読み込ませ、S305_4へ進む。
When the preparation of WebView is completed, the
S305_4で、ネイティブ層218は、OSのスクリーンショット機能を用いて画像データを取得する。スクリーンショット機能とは、WebViewから画像データを取得する機能のことである。各OSには、用意したViewから画像データを取得する機能が備わっている。Viewとは、ディスプレイ104に何かしらのデータを表示するための領域のことであり、OSによって呼び方は違うが、ImageViewまたはWebViewなどが存在する。例えばImageViewは、読み込んだ標準フォーマットの画像(JPEG画像、PNG画像)を表示する領域であり、WebViewは、ウェブ言語で記述されたコンテンツを表示する領域である。このように読み込ませるデータは様々だが、何かしらのデータを読み込ませディスプレイ104に表示させるための領域を規定するものがViewである。
In S305_4, the
S305_5でネイティブ層218は、取得した画像データから印刷画像として用いる画像を決定する。本例では、S305_2でSVGコンテンツを同期描画させる修正とマーカーの付与とが行われている。このため、WebViewから取得した画像データにマーカーが存在すれば、描画終了として判定できる。ただし、マーカー自体は印刷に不要なデータである。よって、マーカーの存在が確認したことを条件に、ネイティブ層218は、印刷に必要な領域4000px×6000pxのみをトリミングし、これを画像データとして決定する。このようにS305_5の画像データ決定とは、取得した画像データに必要な情報が揃っているかを確認し、所定の後処理が必要であれば後処理を行う工程である。もし、取得した画像がRGBAデータの配列であり、最終的に欲しい画像がJPEGフォーマットであれば、JPEGフォーマットへ変換する処理が行われてもよい。尚、先述のトリミングする領域は、予め右端5pxは不要領域にするなど規定しておけばよい。それ以外にも、必要な領域をスクリプト層217から引数として送信してもよい。他にも、修正したSVGコンテンツの一番目の子要素の領域だけを必要領域として扱うなどの方法を用いてもよい。
In S305_5, the
ここで、S305_5でマーカーの存在が検知できなかった場合は、再度S305_4の操作から繰り返す。この繰り返しは、マーカーの存在が確認できなかったらすぐにやり直してもよいし、一定時間後にやり直してもよい。また、S305_5の画像データ取得のタイミングは、どの時点から開始してもよく、任意のタイミングから始めて一定時間おきに確認してもよい。 Here, if the presence of the marker cannot be detected in S305_5, the operation of S305_4 is repeated again. This repetition may be repeated immediately if the presence of the marker cannot be confirmed, or may be repeated after a certain period of time. Further, the timing of acquiring the image data of S305_5 may be started from any time point, or may be started from an arbitrary timing and confirmed at regular intervals.
また、本実施形態ではマーカーの存在を画像データの決定に用いているが、他の方法を用いてもよい。例えばSVGを読み込ませる前に画像データを取得しておき、SVGを読み込ませた後の画像変化を検知したタイミングで、画像データとして決定してもよい。また、実施形態中のコンテンツ修正は、SVGの中にonloadを検知して表示設定を行うスクリプトを埋め込んでいるが、SVGコンテンツの表示制御は、この例に限られない。例えばネイティブ層218からWebViewに対してSVGコンテンツを操作する指示を出してもよい。それは下記のようなJavaScriptを用意することで実現できる。
----------------------------------------------
[[JavaScriptの記述例]]
function(){
var svg = document.querySelector(“svg”); // svgの取得
svg.style.display = “none”; // svgを非表示設定
setTimeout(function(){
svg.style.display = “block”; // 1秒後にsvgを表示設定
callNativeMethod(); // ネイティブ層に表示設定をしたことを通知する
}, 1000);
}
----------------------------------------------
Further, although the presence of the marker is used for determining the image data in the present embodiment, other methods may be used. For example, the image data may be acquired before the SVG is read, and the image data may be determined at the timing when the image change after the SVG is read is detected. Further, the content modification in the embodiment embeds a script that detects onload and sets the display in the SVG, but the display control of the SVG content is not limited to this example. For example, the
----------------------------------------------
[[Example of Javascript description]]
function () {
var svg = document. querySelector (“svg”) ; // Get svg
svg. style. display = “none” ; // Set to hide svg
setTimeout (function () {
svg. style. display = “block”; // Set to display svg after 1 second
callNativeMethod (); // Notify the native layer that the display settings have been made.
}, 1000);
}
----------------------------------------------
このように、表示・非表示設定の方法は、SVG中にスクリプトを埋め込むことに限らない。画像化に必要な要素の表示・非表示が制御できればどのような方法でもよい。 As described above, the display / non-display setting method is not limited to embedding the script in SVG. Any method can be used as long as the display / non-display of the elements required for imaging can be controlled.
S305_6でネイティブ層218は、印刷コマンドの生成を行う。印刷コマンドの生成とは、画像データを印刷する指示と画像データに関する情報とを含めたデータを生成することである。以下にその一例を示す。
----------------------------------------------
[[印刷コマンドの例]]
01: <?xml version="1.0" encoding="utf-8" ?>
02: <cmd xmlns:trans="http://www.xxxx/yyyyy/">
03: <contents>
04: <operation>Print</operation>
05: <size>A4</size>
06: <quality>high</quality>
07: <file>
08: <format>JPEG</format>
09: <data>画像データ本体…
</data>
… </file>
</contents>
</cmd>
----------------------------------------------
In S305_6, the
----------------------------------------------
[[Example of print command]]
01: <? Xml version = "1.0" encoding = "utf-8"?>
02: <cmd xmlns: trans = "http: //www.xxxx/yyyyy/">
03: <contents>
04: <operation> Print </ operation>
05: <size> A4 </ size>
06: <quality> high </ quality>
07: <file>
08: <format> JPEG </ format>
09: <data> Image data body ...
</ Data>
… </ File>
</ Contents>
</ cmd>
----------------------------------------------
4行目のPrintは、プリンタに対し印刷を実行せよという命令である。5行目は、A4サイズであること、6行目は、印刷品位であり高品位モードで印刷することを命令している。7行目から10行目が画像データに関する情報である。8行目は、画像がJPEGフォーマットであることを表している。9行目以降に画像データ本体が格納されている。 Print on the fourth line is an instruction to print to the printer. The fifth line indicates that the size is A4, and the sixth line indicates that the print quality is high and that printing is performed in the high quality mode. The 7th to 10th lines are information related to the image data. The eighth line shows that the image is in JPEG format. The image data body is stored in the 9th and subsequent lines.
S305_7でネイティブ層218は、生成した印刷コマンドをプリンタ112へ送信する。プリンタ112は、これを受けてプリンタ112は与えられた情報に基づいて印刷を実行する。
In S305_7, the
以上説明したように、本実施形態によれば、ハイブリッドアプリを用いて印刷を行う場合に、不必要な処理負荷が生じてしまうことを抑制することができる。 As described above, according to the present embodiment, it is possible to prevent an unnecessary processing load from being generated when printing is performed using the hybrid application.
尚、本実施形態では、写真とロゴのみの単純なSVGコンテンツを想定したが、当然要素は3つ以上でもよい。本実施形態では全要素に対して表示設定の切り替えを記載しているが、要素の一部にのみ適応させてもよい。即ち、SVGコンテンツの要素が2つ以上で構成されている場合において、少なくとも2つの要素における表示設定の切り替えを行う処理としてよい。このような場合であっても、不要な描画命令が削減されるため、パフォーマンスの改善につながる。また、写真にロゴが重畳するSVGコンテンツを例に説明したが、各要素が重畳しないようなコンテンツであってもよい。 In this embodiment, a simple SVG content containing only a photo and a logo is assumed, but of course, three or more elements may be used. In the present embodiment, the switching of the display setting is described for all the elements, but it may be applied to only a part of the elements. That is, when the elements of the SVG content are composed of two or more elements, the process of switching the display settings in at least two elements may be performed. Even in such a case, unnecessary drawing instructions are reduced, which leads to an improvement in performance. Further, although the SVG content in which the logo is superimposed on the photograph has been described as an example, the content may be such that the elements are not superimposed.
なお、印刷する画像の大きさの指定方法は、図6に示した方法に限らない。例えば、印刷により得たい画像の実サイズとして、「〇〇mm×△△mm」等の数値をユーザーが画面上で入力するための画面を印刷アプリが表示してもよい。このような画面で入力されたサイズが、スクリプト層217からネイティブ層218に通知される。そしてネイティブ層218の画像処理部208は、そのサイズに合うように、画像の変倍およびトリミングを行う。そして、このように変倍およびトリミングが実行された画像がプリンタ通信部213を介してプリンタ112に送信され、印刷される。そのため、ユーザーが上記の画面で指定したサイズの画像が印刷される。
The method of specifying the size of the image to be printed is not limited to the method shown in FIG. For example, the print application may display a screen for the user to input a numerical value such as "○○ mm × △△ mm" on the screen as the actual size of the image to be obtained by printing. The size input on such a screen is notified from the
この変倍およびトリミングは、S305_1において、SVGコンテンツに対して実行されてもよいし、S305_4において取得された画像データに対して実行されてもよい。また、上述の例では印刷アプリがハイブリッドアプリの場合について説明したが、これに限らず、印刷アプリがネイティブアプリの場合であってもよい。 This scaling and trimming may be performed on the SVG content in S305_1 or on the image data acquired in S305_1. Further, in the above example, the case where the print application is a hybrid application has been described, but the present invention is not limited to this, and the print application may be a native application.
<<その他の実施形態>>
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
<< Other Embodiments >>
The present invention supplies a program that realizes one or more functions of the above-described embodiment to a system or device via a network or storage medium, and one or more processors in the computer of the system or device reads and executes the program. It can also be realized by the processing to be performed. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.
Claims (16)
前記プロセッサを、
複数の要素を含む印刷対象のコンテンツを生成する第一生成手段と、
コンテンツに含まれる要素を非同期で描画する描画手段に対して、前記印刷対象のコンテンツに含まれる複数の要素のうち少なくとも2つ以上の要素がロードされた後に当該少なくとも2つ以上の要素を前記描画手段が描画するように、前記第一生成手段で生成された前記印刷対象のコンテンツの描画を依頼する依頼手段と、
前記依頼手段による依頼に基づいて前記描画手段によって描画された画像を取得して印刷用のデータを生成する第二生成手段と、
として機能させるためのプログラム。 The first layer consists of a set of script instructions that are translated and executed by the processor when the application is executed, and the second layer that is pre-compiled by a unit different from the processor as an instruction set that can be executed by the processor. A program having a layer and executing the application in cooperation with the first layer and the second layer.
The processor
The first generation means to generate printable content containing multiple elements,
The drawing means for asynchronously drawing the elements included in the content, the drawing means for drawing the at least two or more elements after at least two or more elements among the plurality of elements included in the content to be printed are loaded. A requesting means for requesting drawing of the content to be printed generated by the first generation means so that the means draws, and a requesting means for requesting drawing.
A second generation means that acquires an image drawn by the drawing means based on a request by the request means and generates data for printing.
A program to function as.
前記表示制御手段により表示された画面において入力された数値に応じて、前記印刷対象のコンテンツまたは前記描画手段により描画された画像を変倍する変倍手段と、
として前記プロセッサをさらに機能させるための請求項1から12のいずれか1項に記載のプログラム。 A display control means that causes the display means to display a screen for the user to input a numerical value of the size of the image to be printed.
A scaling means for scaling the content to be printed or an image drawn by the drawing means according to a numerical value input on the screen displayed by the display control means.
The program according to any one of claims 1 to 12 for further functioning the processor.
アプリケーションの実行の際に、前記プロセッサによって翻訳されて実行されるスクリプト命令セットで構成された第一層と、前記プロセッサが実行可能な命令セットとして前記プロセッサとは異なるユニットにより予めコンパイルされている第二層と、を有し、前記第一層と前記第二層との連携によって前記アプリケーションを実行するためのプログラムを記憶する記憶媒体と、
を備えた情報処理装置であって、
前記プロセッサが前記記憶媒体に記憶されている前記プログラムを実行することで前記プロセッサが、
複数の要素を含む印刷対象のコンテンツを生成する第一生成手段と、
コンテンツに含まれる要素を非同期で描画する描画手段に対して、前記印刷対象のコンテンツに含まれる複数の要素のうち少なくとも2つ以上の要素がロードされた後に当該少なくとも2つ以上の要素を前記描画手段が描画するように、前記第一生成手段で生成された前記印刷対象のコンテンツの描画を依頼する依頼手段と、
前記依頼手段による依頼に基づいて前記描画手段によって描画された画像を取得して印刷用のデータを生成する第二生成手段と、
として機能することを特徴とする情報処理装置。 With the processor
A first layer composed of a script instruction set translated and executed by the processor when the application is executed, and a first layer pre-compiled by a unit different from the processor as an instruction set that can be executed by the processor. A storage medium having two layers and storing a program for executing the application in cooperation with the first layer and the second layer.
It is an information processing device equipped with
When the processor executes the program stored in the storage medium, the processor can be
The first generation means to generate printable content containing multiple elements,
The drawing means for asynchronously drawing the elements included in the content, the drawing means for drawing the at least two or more elements after at least two or more elements among the plurality of elements included in the content to be printed are loaded. A requesting means for requesting drawing of the content to be printed generated by the first generation means and a requesting means for drawing the content to be printed so that the means draws.
A second generation means that acquires an image drawn by the drawing means based on a request by the request means and generates data for printing.
An information processing device characterized by functioning as.
複数の要素を含む印刷対象のコンテンツを生成する第一生成ステップと、
コンテンツに含まれる要素を非同期で描画する描画手段に対して、前記印刷対象のコンテンツに含まれる複数の要素のうち少なくとも2つ以上の要素がロードされた後に当該少なくとも2つ以上の要素を前記描画手段が描画するように、前記第一生成ステップで生成された前記印刷対象のコンテンツの描画を依頼する依頼ステップと、
前記依頼ステップによる依頼に基づいて前記描画手段によって描画された画像を取得して印刷用のデータを生成する第二生成ステップと、
を有することを特徴とする情報処理方法。 The first layer consists of a set of script instructions that are translated and executed by the processor when the application is executed, and the second layer that is pre-compiled by a unit different from the processor as an instruction set that can be executed by the processor. It is an information processing method performed by executing the application in cooperation with the layer.
The first generation step to generate printable content containing multiple elements,
The drawing means for asynchronously drawing the elements included in the content, the drawing means for drawing the at least two or more elements after at least two or more elements among the plurality of elements included in the content to be printed are loaded. A request step for requesting drawing of the content to be printed generated in the first generation step so that the means draws, and a request step.
A second generation step of acquiring an image drawn by the drawing means based on a request by the request step and generating data for printing, and a second generation step.
An information processing method characterized by having.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019215203A JP7395334B2 (en) | 2019-11-28 | 2019-11-28 | Information processing device, information processing method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019215203A JP7395334B2 (en) | 2019-11-28 | 2019-11-28 | Information processing device, information processing method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021086414A true JP2021086414A (en) | 2021-06-03 |
JP7395334B2 JP7395334B2 (en) | 2023-12-11 |
Family
ID=76087853
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019215203A Active JP7395334B2 (en) | 2019-11-28 | 2019-11-28 | Information processing device, information processing method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7395334B2 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015064904A (en) * | 2014-12-22 | 2015-04-09 | セイコーエプソン株式会社 | Control method of network system, control method of script for print control, and script for print control |
JP2018005575A (en) * | 2016-07-01 | 2018-01-11 | キヤノン株式会社 | Information processing device, information processing method, and program |
JP2018055184A (en) * | 2016-09-26 | 2018-04-05 | 富士ゼロックス株式会社 | Image forming apparatus and program |
-
2019
- 2019-11-28 JP JP2019215203A patent/JP7395334B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015064904A (en) * | 2014-12-22 | 2015-04-09 | セイコーエプソン株式会社 | Control method of network system, control method of script for print control, and script for print control |
JP2018005575A (en) * | 2016-07-01 | 2018-01-11 | キヤノン株式会社 | Information processing device, information processing method, and program |
JP2018055184A (en) * | 2016-09-26 | 2018-04-05 | 富士ゼロックス株式会社 | Image forming apparatus and program |
Also Published As
Publication number | Publication date |
---|---|
JP7395334B2 (en) | 2023-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10296267B2 (en) | Information processing apparatus, information processing method, and storage medium | |
US9436413B2 (en) | Information processing apparatus, information processing method, and storage medium storing program | |
US10318213B2 (en) | Information processing apparatus, information processing method, and storage medium storing program | |
JP6478487B2 (en) | Information processing apparatus, information processing method, and program | |
JP6381319B2 (en) | Information processing apparatus, processing method, and program | |
JP6138088B2 (en) | Information processing apparatus, control method, and software program | |
US10075620B2 (en) | Information processing apparatus, control method for information processing apparatus, and non-transitory computer-readable storage medium | |
US10620892B2 (en) | Information processing apparatus that displays a print setting screen based on information of a printing apparatus in a format interpretable in a first program layer and processing method thereof | |
JP6799396B2 (en) | Information processing equipment, information processing methods and programs | |
US9575702B2 (en) | Information processing apparatus, information processing method, and storage medium storing program having a layered structure | |
US10228890B2 (en) | Apparatus, method, and non-transitory computer-readable storage medium | |
JP6786342B2 (en) | Information processing equipment, information processing methods and programs | |
JP6649832B2 (en) | Information processing apparatus, control method therefor, and program | |
JP7395334B2 (en) | Information processing device, information processing method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20221117 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230712 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20230718 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230914 |
|
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: 20231031 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20231129 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 7395334 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |