<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Edmond-keaton</title>
    <description>The latest articles on DEV Community by Edmond-keaton (@edmondkeaton).</description>
    <link>https://dev.to/edmondkeaton</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3547433%2F93f8068e-7674-4108-9cfd-625457414df8.png</url>
      <title>DEV Community: Edmond-keaton</title>
      <link>https://dev.to/edmondkeaton</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edmondkeaton"/>
    <language>en</language>
    <item>
      <title>How to draw province borders</title>
      <dc:creator>Edmond-keaton</dc:creator>
      <pubDate>Sun, 05 Oct 2025 22:09:13 +0000</pubDate>
      <link>https://dev.to/edmondkeaton/how-to-draw-province-borders-3ao7</link>
      <guid>https://dev.to/edmondkeaton/how-to-draw-province-borders-3ao7</guid>
      <description>&lt;p&gt;I'm making an AoH2-like strategy game. I have a provinces.bmp image where each province has a unique color. The border coordinates are currently extracted by looping through pixels and checking neighbors. How can I draw the borders and fill the provinces with color? Also, is there a better way to extract border coords?&lt;br&gt;
fn draw_borders(mut commands: Commands) {&lt;br&gt;
    let img =&lt;br&gt;
        image::open("assets/maps/testmap/provinces.bmp").expect("Failed to open provinces.bmp");&lt;br&gt;
    let (width, height) = img.dimensions();&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let mut pixels: Vec&amp;lt;(u8, u8, u8)&amp;gt; = Vec::with_capacity((width * height) as usize);
for (_, _, pixel) in img.pixels() {
    pixels.push((pixel[0], pixel[1], pixel[2]))
}

let mut border_coords = Vec::new();
for y in 0..height {
    for x in 0..width {
        let current = pixels[(y * width + y) as usize];

        let neighbors = [
            (x.saturating_sub(1), y),
            ((x + 1).min(width - 1), y),
            (x, y.saturating_sub(1)),
            (x, (y + 1).min(height - 1)),
        ];

        for &amp;amp;(nx, ny) in neighbors.iter() {
            if pixels[(ny * width + nx) as usize] != current {
                border_coords.push((x, y));
                break;
            }
        }
    }
}

let border_coords: HashSet&amp;lt;_&amp;gt; = border_coords.into_iter().collect(); // remove duplicates
// render borders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
      <category>rust</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>How to draw the province borders</title>
      <dc:creator>Edmond-keaton</dc:creator>
      <pubDate>Sun, 05 Oct 2025 21:51:45 +0000</pubDate>
      <link>https://dev.to/edmondkeaton/how-to-draw-the-province-borders-1d26</link>
      <guid>https://dev.to/edmondkeaton/how-to-draw-the-province-borders-1d26</guid>
      <description>&lt;p&gt;I'm making an AoH2-like strategy game. I have a provinces.bmp image where each province has a unique color. The border coordinates are currently extracted by looping through pixels and checking neighbors. How can I draw the borders and fill the provinces with color? Also, is there a better way to extract border coords?&lt;br&gt;
fn draw_borders(mut commands: Commands) {&lt;br&gt;
    let img =&lt;br&gt;
        image::open("assets/maps/testmap/provinces.bmp").expect("Failed to open provinces.bmp");&lt;br&gt;
    let (width, height) = img.dimensions();&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let mut pixels: Vec&amp;lt;(u8, u8, u8)&amp;gt; = Vec::with_capacity((width * height) as usize);
for (_, _, pixel) in img.pixels() {
    pixels.push((pixel[0], pixel[1], pixel[2]))
}

let mut border_coords = Vec::new();
for y in 0..height {
    for x in 0..width {
        let current = pixels[(y * width + y) as usize];

        let neighbors = [
            (x.saturating_sub(1), y),
            ((x + 1).min(width - 1), y),
            (x, y.saturating_sub(1)),
            (x, (y + 1).min(height - 1)),
        ];

        for &amp;amp;(nx, ny) in neighbors.iter() {
            if pixels[(ny * width + nx) as usize] != current {
                border_coords.push((x, y));
                break;
            }
        }
    }
}

let border_coords: HashSet&amp;lt;_&amp;gt; = border_coords.into_iter().collect(); // remove duplicates
// render borders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
      <category>rust</category>
      <category>gamedev</category>
    </item>
  </channel>
</rss>
