package org.verapdf.model.impl.pb.operator.xobject;

import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.impl.pb.pd.images.PBoxPDXForm;
import org.verapdf.model.impl.pb.pd.images.PBoxPDXImage;
import org.verapdf.model.impl.pb.pd.images.PBoxPDXObject;
import org.verapdf.model.operator.Op_Do;
import org.verapdf.model.pdlayer.PDXObject;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Operator which paints the specified XObject
 *
 * @author Timur Kamalov
 */
public class PBOp_Do extends PBOperator implements Op_Do {

	/** Type name for {@code PBOp_Do} */
    public static final String OP_DO_TYPE = "Op_Do";

	/** Name of link to the XObject */
    public static final String X_OBJECT = "xObject";

    private org.apache.pdfbox.pdmodel.graphics.PDXObject pbXObject;

    public PBOp_Do(List<COSBase> arguments,
            org.apache.pdfbox.pdmodel.graphics.PDXObject pbXObject) {
        super(arguments, OP_DO_TYPE);
        this.pbXObject = pbXObject;
    }

    @Override
    public List<? extends Object> getLinkedObjects(String link) {
        if (X_OBJECT.equals(link)) {
            return this.getXObject();
        }
        return super.getLinkedObjects(link);
    }

	private List<PDXObject> getXObject() {
		PDXObject typedPDXObject = PBoxPDXObject.getTypedPDXObject(this.pbXObject);
		if (typedPDXObject != null) {
			List<PDXObject> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
			list.add(typedPDXObject);
			return Collections.unmodifiableList(list);
		}
		return Collections.emptyList();
	}

}

@@ -122,16 +122,62 @@
 OSName;%0A
+import org.apache.pdfbox.pdmodel.PDResources;%0A
 import o
@@ -1072,16 +1072,22 @@
 private 
+final 
 org.apac
@@ -1133,16 +1133,54 @@
 XObject;
+%0A%09private final PDResources resources;
 %0A%0A    pu
@@ -1283,16 +1283,42 @@
 bXObject
+,%0A%09%09%09PDResources resources
 ) %7B%0A    
@@ -1387,16 +1387,46 @@
 Object;%0A
+%09%09this.resources = resources;%0A
     %7D%0A%0A 
@@ -1742,16 +1742,21 @@
 XObject(
+%0A%09%09%09%09
 this.pbX
@@ -1757,24 +1757,40 @@
 is.pbXObject
+, this.resources
 );%0A%09%09if (typ

Fix in Do operator