fabricerin (version 0.1.1)

fabric_image: Insert external images inside canvas element

Description

Insert external images inside canvas element

Usage

fabric_image(
  cid,
  cwidth = 800,
  cheight = 600,
  cfill = "#FFFFFF",
  imgId,
  imgsrc,
  imgwidth = 500,
  imgheight = 500,
  left = 100,
  top = 100,
  angle = 0,
  opacity = 1,
  strokecolor = "darkblue",
  strokewidth = 1,
  selectable = TRUE,
  isDrawingMode = FALSE
)

Arguments

cid

the id of the canvas element

cwidth

the width of the canvas element. Defaults to 800

cheight

the height of the canvas element. Defaults to 600

cfill

the color of the canvas element

imgId

the id of the image

imgsrc

the URL source of the image

imgwidth

the width of the image. Defaults to 500

imgheight

the height of the image. Defaults to 500

left

the image's position from the left relative to the canvas element. Defaults to 100

top

the image's position from the top relative to the canvas element. Defaults to 100

angle

the angle of rotation of the image. Defaults to 0 (no rotation)

opacity

the opacity of the image (from 0 to 1). Defaults to 1

strokecolor

the stroke color of the image. Defaults to 'darkblue'

strokewidth

the stroke width of the image. Defaults to 1

selectable

logical. If TRUE, the user can modify interactively the image's size, position and rotation. Defaults to TRUE

isDrawingMode

logical. If TRUE, the user can draw inside the canvas element.

Value

an image inside a canvas element

Examples

Run this code
# NOT RUN {

if (interactive()) {

img <- "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/724px-R_logo.svg.png"

ui <- fluidPage(

use_fabric(),

fabric_image(cid = "cimage",
             cfill = "lightblue",
             imgId = "Rimg",
             imgsrc = img)

             )

server <- function(input, output) {}


shinyApp(ui = ui, server = server)

}

# }

Run the code above in your browser using DataLab