<?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[How to draw a gradient rect]]></title><description><![CDATA[<p dir="auto">How to draw a gradient rect?</p>
<p dir="auto">Gui.drawGradientRect is <em>'protected'</em></p>
]]></description><link>https://forum.liquidbounce.net/topic/3844/how-to-draw-a-gradient-rect</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Mar 2026 20:39:01 GMT</lastBuildDate><atom:link href="https://forum.liquidbounce.net/topic/3844.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Apr 2022 19:03:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to draw a gradient rect on Thu, 14 Apr 2022 18:02:12 GMT]]></title><description><![CDATA[<p dir="auto">A better way of not using reflection would be:</p>
<pre><code>/**
 * @param color1 color in hex.
 * @param color2 color in hex.
 */
 function drawSimpleVerticalGradientRect(x, y, x2, y2, color1, color2) {
    GL11.glBegin(GL11.GL_QUADS);
    glColor(color1);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    glColor(color2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glEnd();
}

/**
 * @param color A color in hex.
 */
function glColor(color) {
    var a = (color &gt;&gt; 24) &amp; 0xFF;
    var r = (color &gt;&gt; 16) &amp; 0xFF;
    var g = (color &gt;&gt; 8) &amp; 0xFF;
    var b = (color) &amp; 0xFF;
    GL11.glColor4f(r / 255, g / 255, b / 255, a / 255);
}
</code></pre>
<p dir="auto">I would like to explain this, but i don't know if i could do it well</p>
<p dir="auto">Example Usage:</p>
<pre><code>GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Tells GL to transition between colors
GlStateManager.shadeModel(GL11.GL_SMOOTH);
drawSimpleVerticalGradientRect(10, 10, 390, 390, 0xffffffff, 0x00ffffff);
// Tells GL to use the ONLY' last color
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
</code></pre>
]]></description><link>https://forum.liquidbounce.net/post/29835</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29835</guid><dc:creator><![CDATA[ThrowAway39234]]></dc:creator><pubDate>Thu, 14 Apr 2022 18:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 12:13:26 GMT]]></title><description><![CDATA[<p dir="auto">Solved, handwritten</p>
]]></description><link>https://forum.liquidbounce.net/post/29746</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29746</guid><dc:creator><![CDATA[test test2]]></dc:creator><pubDate>Wed, 13 Apr 2022 12:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 11:48:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/test-test2">@<bdi>test-test2</bdi></a> You might have to do some more open gl stuff which I have no idea about.</p>
]]></description><link>https://forum.liquidbounce.net/post/29744</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29744</guid><dc:creator><![CDATA[CzechHek]]></dc:creator><pubDate>Wed, 13 Apr 2022 11:48:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 11:33:48 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1649849517073-6ed25847-0834-41a0-8d26-37086477c011-image.png" alt="6ed25847-0834-41a0-8d26-37086477c011-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1649849525353-68088ebc-3425-4c3a-839c-d4e9600681cd-image.png" alt="68088ebc-3425-4c3a-839c-d4e9600681cd-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1649849575159-00b5f95f-3034-4f24-b861-2acac9540993-image.png" alt="00b5f95f-3034-4f24-b861-2acac9540993-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1649849576757-fa95c5f2-bc17-4150-ad14-9fc19ce5016d-image.png" alt="fa95c5f2-bc17-4150-ad14-9fc19ce5016d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">render2d:<br />
<img src="/assets/uploads/files/1649849598005-7bed28e2-6388-4476-9403-21ecca44d180-image.png" alt="7bed28e2-6388-4476-9403-21ecca44d180-image.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1649849626701-ee626b1d-4312-489c-a8cb-3a545abdc5cc-image.png" alt="ee626b1d-4312-489c-a8cb-3a545abdc5cc-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.liquidbounce.net/post/29743</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29743</guid><dc:creator><![CDATA[test test2]]></dc:creator><pubDate>Wed, 13 Apr 2022 11:33:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 11:23:46 GMT]]></title><description><![CDATA[<p dir="auto">oh, how to include Core library?</p>
]]></description><link>https://forum.liquidbounce.net/post/29741</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29741</guid><dc:creator><![CDATA[test test2]]></dc:creator><pubDate>Wed, 13 Apr 2022 11:23:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 11:08:05 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1649848057415-43839bce-eb6a-4978-ba3b-8a9abf949356-image.png" alt="43839bce-eb6a-4978-ba3b-8a9abf949356-image.png" class=" img-fluid img-markdown" /><br />
onRender:<br />
<img src="/assets/uploads/files/1649848059908-9f359c9f-e142-49cd-88cb-1606eb8f5543-image.png" alt="9f359c9f-e142-49cd-88cb-1606eb8f5543-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Result:<br />
<img src="/assets/uploads/files/1649848083664-f1f8288a-0e63-4439-90a4-f281a3241e1a-image.png" alt="f1f8288a-0e63-4439-90a4-f281a3241e1a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.liquidbounce.net/post/29740</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29740</guid><dc:creator><![CDATA[test test2]]></dc:creator><pubDate>Wed, 13 Apr 2022 11:08:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 09:56:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/test-test2">@<bdi>test-test2</bdi></a> you invoke on instance and you have to put all args into an java array</p>
<p dir="auto">the easiest way would be to use Core's Reflector</p>
<pre><code>RGui = new Reflector(Gui) 

onrender:

RGui.drawGradientRect(10, 10, 10 + 50, 10 + 50, Color.RED.getRGB(), Color.BLUE.getRGB())
</code></pre>
<p dir="auto">also what about looking into logs or <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html</a></p>
]]></description><link>https://forum.liquidbounce.net/post/29738</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29738</guid><dc:creator><![CDATA[CzechHek]]></dc:creator><pubDate>Wed, 13 Apr 2022 09:56:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 09:25:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/test-test2">@<bdi>test-test2</bdi></a> Does it work</p>
]]></description><link>https://forum.liquidbounce.net/post/29737</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29737</guid><dc:creator><![CDATA[Ali00035]]></dc:creator><pubDate>Wed, 13 Apr 2022 09:25:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Wed, 13 Apr 2022 07:32:16 GMT]]></title><description><![CDATA[<pre><code>                    try {
                        var method = Gui.class.getDeclaredMethod("drawGradientRect");
                        method.setAccessible(true);
                        method.invoke(Gui.class, 10, 10, 10 + 50, 10 + 50, Color.RED.getRGB(), Color.BLUE.getRGB());
                    } catch (ex) {
                        ex.printStackTrace();
                    }
</code></pre>
<p dir="auto">What's wrong here?</p>
]]></description><link>https://forum.liquidbounce.net/post/29735</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29735</guid><dc:creator><![CDATA[test test2]]></dc:creator><pubDate>Wed, 13 Apr 2022 07:32:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to draw a gradient rect on Tue, 12 Apr 2022 20:35:12 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">its protected i cant access it</p>
</blockquote>
<p dir="auto"><a href="https://stackoverflow.com/questions/1196192/how-to-read-the-value-of-a-private-field-from-a-different-class-in-java" target="_blank" rel="noopener noreferrer nofollow ugc">reflection</a></p>
]]></description><link>https://forum.liquidbounce.net/post/29722</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/29722</guid><dc:creator><![CDATA[freerobuxgen2022]]></dc:creator><pubDate>Tue, 12 Apr 2022 20:35:12 GMT</pubDate></item></channel></rss>