What is the sufficient way of updating a pixmap dynamically?
<p><strong>Objectives</strong></p>

<ul>
<li>To make health-bar perform insanely faster while updating the bar width.</li>
<li>To maintain its quality while scaling (pixel to meter ratio).</li>
</ul>

<p>Currently I am using libgdx <code>Pixmap</code> to create an health bar, but when I change the <code>drawLine</code> parameters to new value then suddenly still there's no changes. In the bellow code is my current working code, I'm not sure if this is the sufficient way of drawing <code>Pixmap</code> dynamically.</p>

<pre><code>// This code is working when written all in update method

Pixmap frame = new Pixmap(32, 3, Pixmap.Format.RGBA8888);
frame.drawRectangle(...);
frame.drawLine(...);

Texture texture = new Texture(frame);
frame.dispose();

batch.begin();
batch.draw(texture ...);
batch.end();
</code></pre>

<p>Sample healthbar </p>

<p><a href="https://i.stack.imgur.com/tM8RN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tM8RN.png" alt="enter image description here"></a></p>