blob: ff18044c524ecc59de312c90b3d10c46e4a66223 [file] [log] [blame]
#=============================================================================#
# Copyright (c) 2018 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================#
#' Copies an R graphic from specified device to a new device.
gr.copyGraphic <- function(devNr= dev.cur(), device= pdf, ...) {
prevDevNr <- dev.cur();
on.exit(dev.set(prevDevNr));
dev.set(devNr);
din <- par("din");
dev.copy(device, width= din[1], height= din[2], ...);
dev.off();
invisible(devNr)
}