@@ -45,11 +45,11 @@ use crate::text::LocalName;
4545/// ```
4646#[ elem( scope, Show , LocalName , Figurable ) ]
4747pub struct ImageElem {
48- /// A [path]($syntax/#paths) to an image file or raw bytes making up an
49- /// image in one of the supported [formats ]($image.format).
48+ /// 画像ファイルへの [path]($syntax/#paths)、
49+ /// またはサポートされている[format ]($image.format)の画像データの生バイト。
5050 ///
51- /// Bytes can be used to specify raw pixel data in a row-major,
52- /// left-to-right, top-to-bottom format.
51+ /// バイト列を使う場合は、生のピクセルデータを左から右へ、上から下へと並べた
52+ /// 行優先(row-major)形式で指定します。
5353 ///
5454 /// ```example
5555 /// #let original = read("diagram.svg")
@@ -71,26 +71,26 @@ pub struct ImageElem {
7171
7272 /// 画像のフォーマット。
7373 ///
74- /// By default, the format is detected automatically. Typically, you thus
75- /// only need to specify this when providing raw bytes as the
76- /// [`source`]($image.source) (even then, Typst will try to figure out the
77- /// format automatically, but that's not always possible).
74+ /// デフォルトでは、フォーマットは自動的に検出されます。
75+ /// そのため、通常は生のバイト列を[`source`]($image.source)として提供する場合にのみこの指定が必要です
76+ /// (それでもTypstは自動でフォーマットを判別しようとしますが、
77+ /// 必ずしも成功するとは限りません)。
7878 ///
7979 /// 生のピクセルデータと同様にサポートされている拡張子は`{"png"}`、`{"jpg"}`、`{"gif"}`、`{"svg"}`です。
8080 /// [PDFの画像はまだサポートされていません。](https://github.com/typst/typst/issues/145)
8181 ///
82- /// When providing raw pixel data as the `source`, you must specify a
83- /// dictionary with the following keys as the `format`:
84- /// - `encoding` ([str]): The encoding of the pixel data. One of:
85- /// - `{"rgb8"}` (three 8-bit channels: red, green, blue)
86- /// - `{"rgba8"}` (four 8-bit channels: red, green, blue, alpha)
87- /// - `{"luma8"}` (one 8-bit channel)
88- /// - `{"lumaa8"}` (two 8-bit channels: luma and alpha)
89- /// - `width` ([int]): The pixel width of the image.
90- /// - `height` ([int]): The pixel height of the image.
82+ /// 生のピクセルデータを `source`として提供する場合、
83+ /// `format`には次のキーを持つ辞書を指定する必要があります。
84+ /// - `encoding` ([str]): ピクセルデータのエンコーディング。以下のいずれかを指定します。
85+ /// - `{"rgb8"}` (3つの8ビットチャンネル: 赤( red)、緑( green)、青( blue))
86+ /// - `{"rgba8"}` (4つの8ビットチャンネル: 赤( red)、緑( green)、青( blue)、透明度( alpha))
87+ /// - `{"luma8"}` (1つの8ビットチャンネル)
88+ /// - `{"lumaa8"}` (2つの8ビットチャンネル: 輝度( luma)と透明度( alpha))
89+ /// - `width` ([int]): 画像の幅のピクセル数。
90+ /// - `height` ([int]): 画像の高さのピクセル数。
9191 ///
92- /// The pixel width multiplied by the height multiplied by the channel count
93- /// for the specified encoding must then match the `source` data.
92+ /// 幅のピクセル数、高さのピクセル数、指定したエンコーディングにおけるチャンネル数をかけ合わせたものが
93+ /// `source`のデータと一致しなければなりません。
9494 ///
9595 /// ```example
9696 /// #image(
@@ -136,19 +136,19 @@ pub struct ImageElem {
136136 #[ default( ImageFit :: Cover ) ]
137137 pub fit : ImageFit ,
138138
139- /// A hint to viewers how they should scale the image.
139+ /// ビューアーに対して、画像をどのように拡大縮小すべきかを示すヒント。
140140 ///
141- /// When set to `{auto}`, the default is left up to the viewer. For PNG
142- /// export, Typst will default to smooth scaling, like most PDF and SVG
143- /// viewers.
141+ /// `{auto}`に設定した場合、デフォルトの動作はビューアーに委ねられます。
142+ /// PNGエクスポートの場合、TypstはほとんどのPDFビューアーやSVGビューアーと同様に、
143+ /// スムーズな拡大縮小をデフォルトとして設定します。
144144 ///
145- /// _Note :_ The exact look may differ across PDF viewers.
145+ /// _注意 :_ PDFビューアーによっては正確な見た目が異なる場合があります。
146146 pub scaling : Smart < ImageScaling > ,
147147
148- /// An ICC profile for the image.
148+ /// 画像用のICCプロファイル。
149149 ///
150- /// ICC profiles define how to interpret the colors in an image. When set
151- /// to `{auto}`, Typst will try to extract an ICC profile from the image.
150+ /// ICCプロファイルは、画像の色をどのように解釈するかを定義するものです。
151+ /// `{auto}`に設定した場合、Typstは画像からICCプロファイルを抽出しようとします。
152152 #[ parse( match args. named:: <Spanned <Smart <DataSource >>>( "icc" ) ? {
153153 Some ( Spanned { v: Smart :: Custom ( source) , span } ) => Some ( Smart :: Custom ( {
154154 let data = Spanned :: new( & source, span) . load( engine. world) ?;
@@ -164,9 +164,9 @@ pub struct ImageElem {
164164#[ scope]
165165#[ allow( clippy:: too_many_arguments) ]
166166impl ImageElem {
167- /// Decode a raster or vector graphic from bytes or a string.
167+ /// バイト列または文字列からラスター画像またはベクター画像をデコードする。
168168 #[ func( title = "Decode Image" ) ]
169- #[ deprecated = "`image.decode` is deprecated, directly pass bytes to `image` instead " ]
169+ #[ deprecated = "`image.decode`は非推奨です。代わりにバイト列を直接 `image`に渡してください。 " ]
170170 pub fn decode (
171171 span : Span ,
172172 /// 画像としてデコードするデータ。SVGの場合は文字列です。
@@ -186,7 +186,7 @@ impl ImageElem {
186186 /// 与えられた領域に対して、画像をどのように調整するか。
187187 #[ named]
188188 fit : Option < ImageFit > ,
189- /// A hint to viewers how they should scale the image.
189+ /// ビューアーがどのように拡大縮小すべきかを示すヒント。
190190 #[ named]
191191 scaling : Option < Smart < ImageScaling > > ,
192192 ) -> StrResult < Content > {
@@ -451,9 +451,9 @@ cast! {
451451/// The image scaling algorithm a viewer should use.
452452#[ derive( Debug , Copy , Clone , Eq , PartialEq , Hash , Cast ) ]
453453pub enum ImageScaling {
454- /// Scale with a smoothing algorithm such as bilinear interpolation.
454+ /// バイリニア補間などの平滑化アルゴリズムを用いて拡大縮小します。
455455 Smooth ,
456- /// Scale with nearest neighbor or a similar algorithm to preserve the
457- /// pixelated look of the image.
456+ /// 最近傍補間などのアルゴリズムで拡大縮小し、
457+ /// ピクセルで構成された画像の見た目を保ちます。
458458 Pixelated ,
459459}
0 commit comments