<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://blog.nedondev.com</link><generator>RSS for Node</generator><lastBuildDate>Tue, 05 May 2026 17:24:09 GMT</lastBuildDate><atom:link href="https://blog.nedondev.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Try to contribute to opensource #1 librsvg]]></title><description><![CDATA[I have noticed that someone wants newbie help for some open source from a local community member.
I follow the link to Mustodon's post.

found out that it was a librsvg issue on the gnome GitLab repository that has hashtag for rust newbies. It will b...]]></description><link>https://blog.nedondev.com/try-to-contribute-to-opensource-1-librsvg</link><guid isPermaLink="true">https://blog.nedondev.com/try-to-contribute-to-opensource-1-librsvg</guid><category><![CDATA[Open Source]]></category><category><![CDATA[Rust]]></category><category><![CDATA[SVG]]></category><category><![CDATA[PNG]]></category><dc:creator><![CDATA[nedondev]]></dc:creator><pubDate>Thu, 29 Jun 2023 15:00:39 GMT</pubDate><content:encoded><![CDATA[<p>I have noticed that someone wants newbie help for some open source from a local community member.</p>
<p>I follow the link to Mustodon's <a target="_blank" href="https://mstdn.mx/@mrkz/110579468250285868">post</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688048693711/5948c58e-28af-44d2-aff3-98c142db2cbc.png" alt class="image--center mx-auto" /></p>
<p>found out that it was a librsvg issue on the gnome GitLab repository that has hashtag for <code>rust newbies</code>. It will be good for me since I was new to the project.</p>
<h2 id="heading-read-the-docs">Read the docs</h2>
<p>I was surprised by the <a target="_blank" href="https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/index.html">document pages</a> that were so informative.</p>
<h2 id="heading-use-on-mac">Use on mac</h2>
<h3 id="heading-local-machine">Local machine</h3>
<p>I start out by using <code>git clone</code> to a Mac m1 since the architecture was different from the <a target="_blank" href="https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/devel_environment.html#build">GETTING STARTED AS A CONTRIBUTOR - Setting up your development environment</a> that using x86_64 and openSUSE Tumbleweed, I was curious that could it be buildable on the local machine.</p>
<p>I couldn't build on the local machine due to the version of dependency for the setup development environment. As I'm writing this the development environment requires <code>cairo</code> as a system library with version 1.17 or above but the machine has <code>cairo</code> with version 1.16.0 via brew installed via brew.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049634682/64306e15-bf1b-41f4-af34-20471c111e14.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-plaintext">$ cargo test
  --- stderr
  `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "cairo" "cairo &gt;= 1.17"` did not exit successfully: exit status: 1
  error: could not find system library 'cairo' required by the 'librsvg' crate

  --- stderr
  Requested 'cairo &gt;= 1.17' but version of cairo is 1.16.0

warning: build failed, waiting for other jobs to finish...

librsvg &gt; brew install cairo@1.17.2
Warning: No available formula with the name "cairo@1.17.2". Did you mean cairomm@1.14?
==&gt; Searching for similarly named formulae and casks...
</code></pre>
<p>I don't want to mess with the local machine packages so I try to use <code>podman</code> as development.</p>
<h3 id="heading-podman">Podman</h3>
<p>Start with installing <code>podman</code> with brew.</p>
<pre><code class="lang-bash">$ brew install podman
==&gt; Fetching podman
...
==&gt; Pouring podman--4.5.1.arm64_monterey.bottle.tar.gz
</code></pre>
<p>Setup initial machine on <code>podman</code>.</p>
<pre><code class="lang-bash">$ podman machine init
Downloading VM image: fedora-coreos-38.20230609.2.1-qemu.aarch64.qcow2.xz: <span class="hljs-keyword">done</span>
Extracting compressed file
Image resized.
Machine init complete
</code></pre>
<pre><code class="lang-bash">$ podman machine start
</code></pre>
<p>Pull machine for <code>librsvg</code> development.</p>
<pre><code class="lang-bash">$ sh ci/pull-container-image.sh
full_tag=<span class="hljs-string">"x86_64-1.68.2-2023-05-03.0-main"</span>
pulling image registry.gitlab.gnome.org/gnome/librsvg/opensuse/tumbleweed:x86_64-1.68.2-2023-05-03.0-main
...
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
...
You can now run this:
  podman run --rm -ti --cap-add=SYS_PTRACE -v $(<span class="hljs-built_in">pwd</span>):/srv/project -w /srv/project registry.gitlab.gnome.org/gnome/librsvg/opensuse/tumbleweed:x86_64-1.68.2-2023-05-03.0-main

Don<span class="hljs-string">'t forget to run this once inside the container:
  source ci/env.sh</span>
</code></pre>
<p>After I run as the command output, I got an error when using the test. It seems to be a container failed to connect a network error message.</p>
<pre><code class="lang-bash">$ podman run --rm -ti --cap-add=SYS_PTRACE -v $(<span class="hljs-built_in">pwd</span>):/srv/project -w /srv/project registry.gitlab.gnome.org/gnome/librsvg/opensuse/tumbleweed:x86_64-1.68.2-2023-05-03.0-main
:/srv/project <span class="hljs-comment"># source ci/env.sh</span>
:/srv/project <span class="hljs-comment"># cargo test</span>
    Updating crates.io index
warning: spurious network error (2 tries remaining): failed to mmap. Could not write data: Invalid argument; class=Os (2)
warning: spurious network error (1 tries remaining): failed to mmap. Could not write data: Invalid argument; class=Os (2)
error: Unable to update registry `crates-io`
</code></pre>
<p>I find this <a target="_blank" href="https://github.com/containers/podman/issues/10012">issue</a> that could fix it with specifying <code>slirp4netns:port_handler=slirp4netns</code> as the network option value.</p>
<pre><code class="lang-bash">$ podman run --rm -ti --network=slirp4netns:port_handler=slirp4netns --cap-add=SYS_PTRACE -v $(<span class="hljs-built_in">pwd</span>):/srv/project -w /srv/project registry.gitlab.gnome.org/gnome/librsvg/opensuse/tumbleweed:x86_64-1.68.2-2023-05-03.0-main
</code></pre>
<p>A build-in git seems a bit off so I use executable instead.</p>
<pre><code class="lang-bash">:/srv/project <span class="hljs-comment"># source ci/env.sh</span>
:/srv/project <span class="hljs-comment"># cargo test</span>
    Updating crates.io index
warning: spurious network error (1 tries remaining): failed to resolve address <span class="hljs-keyword">for</span> github.com: Name or service not known; class=Net (12)
</code></pre>
<p>After setup for a while, I could run a test but I got the error message after that.</p>
<pre><code class="lang-bash">:/srv/project <span class="hljs-comment"># source ci/env.sh</span>
:/srv/project <span class="hljs-comment"># CARGO_NET_GIT_FETCH_WITH_CLI=true cargo test</span>
error[E0786]: found invalid metadata files <span class="hljs-keyword">for</span> crate `itertools`
 --&gt; rsvg/src/space.rs:3:5
  |
3 | use itertools::Itertools;
  |     ^^^^^^^^^
  |
  = note: failed to mmap rmeta metadata: <span class="hljs-string">'/srv/project/target/debug/deps/libitertools-72978d5f52e1ee56.rmeta'</span>

error: could not compile `librsvg` due to previous error
</code></pre>
<h2 id="heading-setup-vm">Setup VM</h2>
<p>I was concerned that it might be an architecture or package on architecture problem so I switched to using VMware on the x86_64 machine.</p>
<ul>
<li><p>Download the latest <a target="_blank" href="https://get.opensuse.org/tumbleweed/">Opensesu Tumbleweed</a> with x86_64 architecture.</p>
</li>
<li><p>Open a new machine with ram 8 gb as recommended.</p>
</li>
<li><p>I used 50 GB disk space since it will expand to this cap when I use up more space.</p>
</li>
<li><p>I use Gnome as a display manager.</p>
</li>
</ul>
<p>After the machine was up I install dependency as a guide but I want to use rustup to install formatter so I install <code>rustup</code> instead of <code>rust rust-std cargo</code>. I couldn't install <code>python38-docutils</code> so I removed it.</p>
<pre><code class="lang-bash">sudo zypper install -y gcc rustup make \
automake autoconf libtool python3-gi-docgen git \
gdk-pixbuf-devel gobject-introspection-devel \
libxml2-devel cairo-devel pango-devel
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049714276/d7ddf81e-6efa-44e8-b153-42741f3c04fc.png" alt class="image--center mx-auto" /></p>
<p>Use rustup to set the default toolchain.</p>
<pre><code class="lang-bash">rustup default stable
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049744004/58ed8ea4-b2cc-421b-90f0-80df0e66600f.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-clone-to-vmware">Clone to VMware</h2>
<p>After installing packages, I clone the repository and then test. It worked!</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://gitlab.gnome.org/GNOME/librsvg
cargo <span class="hljs-built_in">test</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049780931/13d9011a-ae8a-414a-8826-3994b75895ea.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-read-the-issue">Read the issue</h2>
<p>The issue seems to involve rendering new property for SVG image tag with cairo's library.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049802000/5b851ae8-b114-4537-9a41-66b255d26a49.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-follow-contribute-guide">Follow contribute guide</h2>
<p>I set up neovim and tmux a bit in the machine and make changes following the <a target="_blank" href="https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/adding_a_property.html">contribution guide</a></p>
<h3 id="heading-follow-contribute-guide-1">Follow contribute guide</h3>
<p>There was comment line for a new property.</p>
<pre><code class="lang-rust"><span class="hljs-comment">// "image-rendering" =&gt; (PresentationAttr::Yes, unimplemented),</span>
</code></pre>
<p>After reading CSS <code>imgage-rendering</code> <a target="_blank" href="https://drafts.csswg.org/css-images/#the-image-rendering">property</a>.</p>
<p>I used the macro to create a following with an effort to follow with other property patterns.</p>
<p><code>rsvg/src/property_defs.rs</code></p>
<pre><code class="lang-rust">make_property!(
    <span class="hljs-comment">/// `image-rendering` property.</span>
    <span class="hljs-comment">///</span>
    <span class="hljs-comment">/// CSS Images Module Level 3: &lt;https://www.w3.org/TR/css-images-3/#the-image-rendering&gt;</span>
    <span class="hljs-comment">///</span>
    <span class="hljs-comment">/// Note that this property previously accepted the values optimizeSpeed and optimizeQuality.</span>
    <span class="hljs-comment">/// These are now deprecated; a user agent must accept them as valid values but must treat</span>
    <span class="hljs-comment">/// them as having the same behavior as crisp-edges and smooth respectively.</span>
    ImageRendering,
    default: Auto,
    inherits_automatically: <span class="hljs-literal">true</span>,

    identifiers:
    <span class="hljs-string">"auto"</span> =&gt; Auto,
    <span class="hljs-string">"smooth"</span> =&gt; Smooth,
    <span class="hljs-string">"optimizeQuality"</span> =&gt; OptimizeQuality,
    <span class="hljs-string">"high-quality"</span> =&gt; HighQuality,
    <span class="hljs-string">"crisp-edges"</span> =&gt; CrispEdges,
    <span class="hljs-string">"optimizeSpeed"</span> =&gt; OptimizeSpeed,
    <span class="hljs-string">"pixelated"</span> =&gt; Pixelated,
);
</code></pre>
<p>Uncomment line and use compute following the repository <a target="_blank" href="https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/architecture.html">architecture</a>.</p>
<p><code>rsvg/src/properties.rs</code></p>
<pre><code class="lang-diff"><span class="hljs-deletion">- // "image-rendering"          =&gt; (PresentationAttr::Yes, unimplemented),</span>
<span class="hljs-addition">+ "image-rendering"             =&gt; (PresentationAttr::Yes, image_rendering             : ImageRendering),</span>
...
<span class="hljs-addition">+ compute!(ImageRendering, image_rendering);</span>
</code></pre>
<h2 id="heading-tackling-issue">Tackling issue</h2>
<p>Up to this point was straightforward. Well, After reading I was imagining that an image will be converted as follows.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049836576/798f2c18-0039-4da2-b3fd-a6485bb9dfb6.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-tackling-issue-logic-with-cairo-as-suggested">Tackling issue logic with cairo as suggested</h3>
<p>I never use <code>cairo</code> library or librsvg before. After I spent time reading the codebase, I noticed that in drawing function have not passed the values that were computed.</p>
<p>I try using <code>Context.set_antialias()</code> in draw function as mentioned in the issue discussed. I have to make the draw function notice the <code>image-rendering</code> value so I modify the image layout and pass it to the image in <code>draw</code> when Implement <code>ElementTrait for Image</code> since the <code>draw_ctx.draw_layer</code> didn't get a computed value.</p>
<p>Now I got <code>image-rendering</code> add the following code before the actual draw to <code>set_antialias</code>.</p>
<pre><code class="lang-rust"><span class="hljs-keyword">match</span> image.image_rendering {
    ImageRendering::Pixelated
    | ImageRendering::CrispEdges
    | ImageRendering::OptimizeSpeed =&gt; {
        dc.cr.set_antialias(cairo::Antialias::<span class="hljs-literal">None</span>)
    }
    ImageRendering::Smooth
    | ImageRendering::OptimizeQuality
    | ImageRendering::HighQuality =&gt; {
        dc.cr.set_antialias(cairo::Antialias::Best)
    }
    ImageRendering::Auto =&gt; {
        dc.cr.set_antialias(cairo::Antialias::<span class="hljs-built_in">Default</span>)
    }
}
</code></pre>
<p>I compile and test converting an image then the image was as same as before. After I searched I find that there are issues on <a target="_blank" href="https://github.com/Kozea/CairoSVG/issues/204">Git Hub using a cairo filter</a>. I use it and it worked. I still set antialias as a way to pass ImageRendering to <code>paint_surface</code>.</p>
<pre><code class="lang-rust"><span class="hljs-keyword">if</span> cr.antialias() == cairo::Antialias::<span class="hljs-literal">None</span> {
    ptn.set_filter(cairo::Filter::Nearest);
}
</code></pre>
<p>After that, I also add support to <code>feImage</code> filter primitive, I use the same approach by trying to pass value and <code>set_filter</code> then manually this with a file that has filter property.</p>
<p>After some try and error, I stage and make a commit.</p>
<h2 id="heading-testing">Testing</h2>
<p>I could manually test, but I couldn't figure how to compare the exact png image format. I use png in svg to test. After I render image the image, I try to use the output image in svg input test file and then render it again but the result was not the same.</p>
<h2 id="heading-featuremd">Feature.md</h2>
<p>A <code>feature.md</code> file was mentioned but I didn't find the file.</p>
<h2 id="heading-push">Push</h2>
<p>After I register to Gitlab gnome and set up my ssh key and wait some time, I could fork and change the remote origin then push and open draft PR.</p>
<p>As I push, I could see that I mentioned issue in my commit was noticed in the main repository issue.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049900435/17e5973e-500c-4d6a-bcb5-6c5875304b30.png" alt class="image--center mx-auto" /></p>
<p>I wait for my fork to finish CI before I change my draft PR to actual PR.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049920516/33735dff-ffa9-430a-93f7-a353672e5be7.png" alt class="image--center mx-auto" /></p>
<p>I make some mistakes in my commit. I forgot to test after pasting cairo filter from <code>image-rendering</code> to <code>feImage</code>. I forgot to remove my test line. The CI was not passed.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049944476/4dcfbd82-bff4-4de4-87a4-c36cdbb5ac72.png" alt class="image--center mx-auto" /></p>
<p>I got back to the editor and make changes then test in my local machine with <code>cargo test</code> then using <code>git commit --amend</code> to change the commit code while I leave the message as same as the previous one with the option <code>--no-edit</code>.</p>
<p>After the CI passed I change PR draft state to ready.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688049965367/d445a921-f182-4b91-844f-5184d65116b0.png" alt class="image--center mx-auto" /></p>
<p>Well, This was my contribution journey so far.</p>
]]></content:encoded></item><item><title><![CDATA[[Note #1] How to configure SSH Github]]></title><description><![CDATA[In short just follow Generate ssh key and Add the key to Github. This note using Mac in the journey.
Generate SSH key

Open terminal.
Use command below to generate ssh key. Use an email that signup with Github.

$ ssh-keygen -t ed25519 -C "your_email...]]></description><link>https://blog.nedondev.com/how-to-configure-ssh-github</link><guid isPermaLink="true">https://blog.nedondev.com/how-to-configure-ssh-github</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><dc:creator><![CDATA[nedondev]]></dc:creator><pubDate>Sun, 31 Jul 2022 17:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1659279039092/fL6XJXQiT.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In short just follow <a target="_blank" href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">Generate ssh key</a> and <a target="_blank" href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account">Add the key to Github</a>. This note using Mac in the journey.</p>
<h1 id="heading-generate-ssh-key">Generate SSH key</h1>
<ul>
<li>Open terminal.</li>
<li>Use command below to generate ssh key. Use an email that signup with Github.</li>
</ul>
<pre><code class="lang-bash">$ ssh-keygen -t ed25519 -C <span class="hljs-string">"your_email@example.com"</span>
</code></pre>
<ul>
<li>Press enter</li>
</ul>
<pre><code class="lang-txt">&gt; Enter a file in which to save the key (/Users/you/.ssh/id_algorithm): [Press enter]
</code></pre>
<ul>
<li>Press enter until end or type a passphrase for ssh key (not your Github's password).</li>
</ul>
<pre><code class="lang-txt">&gt; Enter passphrase (empty for no passphrase): [Enter / Type a passphrase]
&gt; Enter same passphrase again: [Enter / Type passphrase again]
</code></pre>
<p>If you do until this line you have generated your ssh key for securing your communication with Github or other platform by encrypt/decrypt data using ed25519 algorithm.</p>
<h1 id="heading-adding-ssh-key-to-the-ssh-agent">Adding SSH key to the ssh-agent</h1>
<ul>
<li>Start agent process in background.</li>
</ul>
<pre><code class="lang-bash">$ <span class="hljs-built_in">eval</span> <span class="hljs-string">"<span class="hljs-subst">$(ssh-agent -s)</span>"</span>
</code></pre>
<ul>
<li>Create a ssh config file.</li>
</ul>
<pre><code class="lang-bash">$ touch ~/.ssh/config
</code></pre>
<ul>
<li>Configure OpenSSH to try using the generated key with <a target="_blank" href="https://man.openbsd.org/ssh_config#Host">every host</a> while <a target="_blank" href="https://man.openbsd.org/ssh_config">automatic add key to ssh agent</a> by edit file <code>~/.ssh/config</code>.</li>
</ul>
<p>For using passphrase.</p>
<pre><code class="lang-toml">Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519
</code></pre>
<p>Without using passphrase.</p>
<pre><code class="lang-toml">Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
</code></pre>
<p>Add your SSH private key to the ssh-agent.</p>
<pre><code class="lang-bash">$ ssh-add -K ~/.ssh/id_ed25519
</code></pre>
<h1 id="heading-adding-a-new-ssh-key-to-github">Adding a new SSH key to Github</h1>
<ul>
<li>Copy all the contain in <code>~/.ssh/id_ed25519.pub</code></li>
<li>Paste the contain in key form by navigate to Github's Profile &gt; Settings &gt; "Access" section &gt; SSH and GPG keys &gt; New SSH key</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659273175162/p3Cem67DV.png" alt="image.png" /></p>
<ul>
<li>Then click "Add SSH key" and confirm with your password.</li>
</ul>
<h1 id="heading-configure-github-to-using-ssh-even-link-was-https">Configure Github to using SSH even link was https</h1>
<pre><code class="lang-bash">$ touch ~/.gitconfig
</code></pre>
<pre><code class="lang-bash">$ open ~/.gitconfig
</code></pre>
<pre><code class="lang-toml"><span class="hljs-comment"># Enforce SSH</span>
<span class="hljs-section">[url "ssh://git@github.com/"]</span>
  <span class="hljs-attr">insteadOf</span> = https://github.com/
</code></pre>
<p>If you want to setup for other site this was an example.</p>
<pre><code class="lang-toml"><span class="hljs-comment"># Enforce SSH</span>
<span class="hljs-section">[url "ssh://git@github.com/"]</span>
  <span class="hljs-attr">insteadOf</span> = https://github.com/
<span class="hljs-section">[url "ssh://git@gitlab.com/"]</span>
  <span class="hljs-attr">insteadOf</span> = https://gitlab.com/
<span class="hljs-section">[url "ssh://git@bitbucket.org/"]</span>
  <span class="hljs-attr">insteadOf</span> = https://bitbucket.org/
</code></pre>
<h1 id="heading-reference">Reference</h1>
<p>Cover Photo by <a href="https://unsplash.com/@synkevych?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Roman Synkevych 🇺🇦</a> on <a href="https://unsplash.com/s/photos/github?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></p>
]]></content:encoded></item></channel></rss>