txture 0.1.1

A simple lib to generate cool textures
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 0 items with examples
  • Size
  • Source code size: 15.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.94 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ferdinandkeller

Ever wanted to simply generate tileable noise textures in rust ? You are at the right place ! This crate allows you to generate perlin noise texture and many more with ease.

Installing

Simply add the lib to your Cargo.toml to start playing :

[dependencies]
txture = "*"

To learn more about this library, go check on crates.io or on github !

How to use

Please note that some use cases of this lib can be seen in the test folder !

A simple perlin noise texture

Start by importing the crate where you need it :

use txture::PerlinNoise;

Then create a new PerlinNoise instance, precising :

  1. The size of the picture as u32
  2. The number of gradient points you want as u8 (check pictures for a better understanding)
  3. whether the picture should be tilable or not as bool

The output is of type Result<PerlinNoise, txture::Error>, so you have to unwrap it. You cant try for exemple :

let perlin_noise = PerlinNoise::new(400, 5, true).unwrap();

Then, to access any pixel in the picture, all you have to do is write :

let gray: u8 = perlin_noise.get_pixel_value(i, j);

Author

  • Ferdinand Keller - feel free to explore my github repos

License

This project is under the MIT license (see the LICENSE.md for more details)