Render native XeTeX PNG, JPEG and BMP graphics
This commit is contained in:
1 parent
794c2f9b2c
commit
2bd6e19519
22 files changed
+821
-120
No files matched your search
@@ -40,6 +40,8 @@ pub struct NativeShipout {
|
||||
pub(super) pdf_color_steps: Vec<Option<Arc<PdfColorProgram>>>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub(super) pdf_graphics_steps: Vec<Option<PdfGraphics>>,
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub(super) pdf_special_images: BTreeMap<usize, (Arc<crate::pdf_image::PdfImageUse>, TokenOrigin)>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub specials: Vec<ShipoutSpecial>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -91,7 +93,7 @@ impl NativeShipout {
|
||||
.map(DisplayItem::PdfColor),
|
||||
);
|
||||
let mut color_steps = self.pdf_color_steps.iter();
|
||||
let mut graphics_steps = self.pdf_graphics_steps.iter();
|
||||
let mut graphics_steps = self.pdf_graphics_steps.iter().enumerate();
|
||||
let mut invalid_geometry = false;
|
||||
let mut missing_color_step = false;
|
||||
let mut missing_graphics_step = false;
|
||||
@@ -128,12 +130,28 @@ impl NativeShipout {
|
||||
}
|
||||
boxes::GeometryItem::PdfGraphics { x, y } => {
|
||||
match graphics_steps.next() {
|
||||
Some(Some(operation)) => page.items.push(DisplayItem::PdfGraphics {
|
||||
Some((_, Some(operation))) => page.items.push(DisplayItem::PdfGraphics {
|
||||
x: self.device.horizontal_origin + x,
|
||||
y: self.device.vertical_origin + self.box_node.height + y,
|
||||
operation: operation.clone(),
|
||||
}),
|
||||
Some(None) => {}
|
||||
Some((step, None)) => {
|
||||
if let Some((image, origin)) = self.pdf_special_images.get(&step) {
|
||||
let [left, bottom] = image.xdv.as_ref().unwrap().layout_offset;
|
||||
page.sources.insert(
|
||||
page.items.len(),
|
||||
crate::provenance::PaintSource::token(*origin),
|
||||
);
|
||||
page.items.push(DisplayItem::PdfImage {
|
||||
x: self.device.horizontal_origin + x + left,
|
||||
y: self.device.vertical_origin + self.box_node.height + y
|
||||
- image.height - bottom,
|
||||
width: image.width,
|
||||
height: image.height,
|
||||
image: image.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
None => missing_graphics_step = true,
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user