---
title: "Stickers"
description: 'Hexbin stickers'
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Stickers}
  %\VignetteEncoding{UTF-8}
  %\VignetteEngine{knitr::rmarkdown}
editor_options: 
  chunk_output_type: console
---

```{r setup, include = FALSE}
source("https://raw.githubusercontent.com/Flavjack/inti/master/pkgdown/favicon/docs.r")
```

Details and examples of more stickers you can find in the following link: <http://hexb.in/>

# Sticker design

You can design your sticker by layers. You can add each element individually in the design.

> You can find more fonts in <https://fonts.google.com/>

```{r echo = TRUE}
library(huito)

font <- "Permanent Marker"

huito_fonts(font)

label <- label_layout(size = c(5.08, 5.08)
                      , border_width = 0
                      ) %>% 
  include_image(value = "https://flavjack.github.io/huito/img/shipibo.png"
                , size = c(7, 7)
                , position = c(2.55, 2.52)
                , opts = "image_scale(600)"
                ) %>%
  include_text(value = "H", size = 45 , position = c(1.15, 2.7), color = "#00a85a", font) %>%
  include_text(value = "u", size = 45 , position = c(2.07, 2.7), color = "#f58735", font) %>%
  include_text(value = "i", size = 45 , position = c(2.73, 2.7), color = "#4774b8", font) %>%
  include_image(value = "https://flavjack.github.io/huito/img/huito_fruit.png"
                , size = c(1.3, 1.3) 
                , position = c(4.06, 2.6)
                ) %>%
  include_text(value = "t", size = 45 , position = c(3.33, 2.7), color = "#a9518b", font) %>%
  include_shape(size = 5.08
                , border_width = 3
                , border_color = "black"
                , position = c(2.54, 2.54)
                , panel_color = "blue"
                ) %>%
  include_text(value = "inkaverse.com"
               , size = 6
               , position = c(3.6, 0.75)
               , angle = 30
               , color = "white"
               , font
               ) 
```

> Select different panel color for your sticker (i.e. `include_shape(panel_color = "color")`). 

## Preview mode

```{r, echo = TRUE}
label %>% 
  label_print(mode = "preview")
```

## Complete mode

The final file is exported in `pdf` format.

```{r, echo = TRUE}
sticker <- label %>% 
  label_print(filename = "huito"
              , margin = 0
              , paper = c(5.5, 5.5)
              , mode = "complete"
              )
```

<embed src="huito.pdf" height="500" width="100%" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">

# Transparent logo

Import the image in pdf and cut the border and make the `panel_color` transparent.

```{r, echo = TRUE}
sticker %>% 
  image_read_pdf()  %>% 
  image_transparent("blue") %>% 
  image_crop(geometry = "600x600+40") %>%
  image_crop(geometry = "560x600-40") %>%
  
  image_write("huito.png")
```

## Final sticker result

```{r out.width = "35%"}
include_graphics("huito.png")
```

