[−][src]Function photon::text::draw_text
pub fn draw_text(photon_img: &mut PhotonImage, text: &str, x: u32, y: u32)
Add 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::text::draw_text; // Open the image. A PhotonImage is returned. let img: PhotonImage = open_image("images/cats.PNG"); draw_text(&mut img, "Welcome to Photon!", 10, 10);