pub fn draw_text_with_border(
    photon_img: &mut PhotonImage,
    text: &str,
    x: u32,
    y: u32
)
Expand description

Add bordered-text to an image. The only font available as of now is Roboto. Note: A graphic design/text-drawing library is currently being developed, so stay tuned.

Arguments

  • photon_image - A PhotonImage.
  • text - Text string to be drawn to the image.
  • x - x-coordinate of where first letter’s 1st pixel should be drawn.
  • y - y-coordinate of where first letter’s 1st pixel should be drawn.

Example

// For example to draw the string "Welcome to Photon!" at 10, 10:
use photon_rs::native::open_image;
use photon_rs::text::draw_text_with_border;

// Open the image. A PhotonImage is returned.
let mut img = open_image("img.jpg").expect("File should open");
draw_text_with_border(&mut img, "Welcome to Photon!", 10_u32, 10_u32);