Skip to content

Commit

Permalink
renaming for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
orph3usLyre committed Oct 4, 2024
1 parent 4b90652 commit 2a5da89
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chartr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn image_to_kap(image_file: &Path, output_name: &Path) -> Result<()> {
for (x, y, p) in img.pixels() {
if let Some(index) = rgbs.iter().position(|rgb| rgb.eq(&(p[0], p[1], p[2]))) {
// BSB indexes start from 1
bitmap.set_pixel(x as u16, y as u16, (index + 1) as u8)
bitmap.set_pixel_index(x as u16, y as u16, (index + 1) as u8)
} else {
eprintln!("Unable to find pos for pixel");
}
Expand Down
2 changes: 1 addition & 1 deletion libbsb/examples/png_to_kap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() -> anyhow::Result<()> {
debug_assert!(i <= 127);

// BSB indexes start from 1
bitmap.set_pixel(x as u16, y as u16, i + 1)
bitmap.set_pixel_index(x as u16, y as u16, i + 1)
}

let header = ImageHeader::builder()
Expand Down
2 changes: 1 addition & 1 deletion libbsb/src/image/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl BitMap {
}

/// set the value of a specific pixel
pub fn set_pixel(&mut self, x: u16, y: u16, value: u8) {
pub fn set_pixel_index(&mut self, x: u16, y: u16, value: u8) {
if x < self.width && y < self.height {
self.pixels[usize::from(y) * usize::from(self.width) + usize::from(x)] = value;
}
Expand Down
4 changes: 2 additions & 2 deletions libbsb/tests/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn create_bsb_from_converted_png() -> anyhow::Result<()> {
for (x, y, p) in img.pixels() {
if let Some(index) = rgbs.iter().position(|rgb| rgb.eq(&(p[0], p[1], p[2]))) {
// BSB indexes start from 1
bitmap.set_pixel(x as u16, y as u16, (index + 1) as u8)
bitmap.set_pixel_index(x as u16, y as u16, (index + 1) as u8)
} else {
eprintln!("Unable to find pos for pixel");
}
Expand Down Expand Up @@ -107,7 +107,7 @@ fn recreate_png_from_converted_png() -> anyhow::Result<()> {
for (x, y, p) in img.pixels() {
if let Some(index) = rgbs.iter().position(|rgb| rgb.eq(&(p[0], p[1], p[2]))) {
// BSB indexes start from 1
bitmap.set_pixel(x as u16, y as u16, (index + 1) as u8)
bitmap.set_pixel_index(x as u16, y as u16, (index + 1) as u8)
} else {
eprintln!("Unable to find pos for pixel");
}
Expand Down

0 comments on commit 2a5da89

Please sign in to comment.