<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Trasparent text in AppGraphics]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=921&amp;type=atom" />
	<updated>2023-11-13T12:52:29Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=921</id>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4256#p4256" />
			<content type="html"><![CDATA[<p>Please send screenshots.&nbsp; But also be aware that the AppGraphics functions are trying to emulate Borland&#039;s BGI interface, not the Windows API.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2023-11-13T12:52:29Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4256#p4256</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4238#p4238" />
			<content type="html"><![CDATA[<p>I had thought that <strong>settextjustify</strong> is the right function. But I received so astonishing results that I prepared some simple tests. It seems an aligment and a justification are two different beasts.</p><p>The first example is a about horizontal aligment/justification. In SF the code is:</p><div class="codebox"><pre><code>    .....
    CALL settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 18)

    CALL settextjustify(LEFT_TEXT, BOTTOM_TEXT)
    CALL outtextxy(50, 50, &#039;Abcd-l&#039;)
    CALL settextjustify(CENTER_TEXT, BOTTOM_TEXT)
    CALL outtextxy(50, 70, &#039;Abcd-c&#039;)
    CALL settextjustify(RIGHT_TEXT, BOTTOM_TEXT)
    CALL outtextxy(50, 90, &#039;Abcd-r&#039;)
    CALL line(50, 0, 50, 299)
    .....</code></pre></div><p>In Delphi Pascal I call Windows API for aligning:</p><div class="codebox"><pre><code>procedure TForm1.FormPaint(Sender: TObject);
var
  h : THandle;

begin
  h:=Form1.Canvas.Handle;

  SetTextAlign(h, TA_LEFT);
  TextOut(h, 50, 50, &#039;Abcd-l&#039;, 6);
  SetTextAlign(h, TA_CENTER);
  TextOut(h, 50, 70, &#039;Abcd-c&#039;, 6);
  SetTextAlign(h, TA_RIGHT);
  TextOut(h, 50, 90, &#039;Abcd-r&#039;, 6);
  MoveToEx(h, 50, 1, NIL);
  LineTo(h, 50, 299)
end;</code></pre></div><p>The vertical line is for better orientation.</p><p>The second example is about a vertical aligment/justification.</p><p>SF code is as follows:</p><div class="codebox"><pre><code>    .....
    CALL settextjustify(LEFT_TEXT, BOTTOM_TEXT)
    CALL outtextxy(50, 50, &#039;Abcd-b&#039;)
    CALL settextjustify(LEFT_TEXT, CENTER_TEXT)
    CALL outtextxy(150, 50, &#039;Abcd-c&#039;)
    CALL settextjustify(LEFT_TEXT, TOP_TEXT)
    CALL outtextxy(250, 50, &#039;Abcd-t&#039;)
    CALL line(0, 65, 399, 65)
    .....</code></pre></div><p>Delphi code is:</p><div class="codebox"><pre><code>procedure TForm1.FormPaint(Sender: TObject);
var
  h : THandle;

begin
  h:=Form1.Canvas.Handle;

  SetTextAlign(h, TA_BOTTOM);
  TextOut(h, 50, 50, &#039;Abcd-b&#039;, 6);
  SetTextAlign(h, TA_BASELINE);
  TextOut(h, 150, 50, &#039;Abcd-c&#039;, 6);
  SetTextAlign(h, TA_TOP);
  TextOut(h, 250, 50, &#039;Abcd-t&#039;, 6);
  MoveToEx(h, 1, 65, NIL);
  LineTo(h, 399, 65)
end;</code></pre></div><p>The horizontal line is for better orientation.</p><p>If you can&#039;t run the above examples I will send you screenshots or will try to drop here.</p><p>As you can see the results are quite different. My suggerstion concerns &quot;aligment&quot; when I can draw a text that the middle point matches the required one. For example the centre of a labal fits the center of the line.</p>]]></content>
			<author>
				<name><![CDATA[GrzegorzW]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=4153</uri>
			</author>
			<updated>2023-10-31T12:17:24Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4238#p4238</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4235#p4235" />
			<content type="html"><![CDATA[<p>In what particular case are you attempting to justify text?&nbsp; <strong>settextjustify</strong> works with the <strong>outtext</strong>/<strong>outtextxy</strong> subroutines.&nbsp; Are you trying to justify text within a control?</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2023-10-29T21:40:00Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4235#p4235</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4234#p4234" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>jeff wrote:</cite><blockquote><p>...<br />Text can be aligned with <strong>settextjustify</strong> already.<br />...</p></blockquote></div><p>May I disagree? <strong>settextjustify</strong> doesn&#039;t perform an alignment.</p>]]></content>
			<author>
				<name><![CDATA[GrzegorzW]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=4153</uri>
			</author>
			<updated>2023-10-29T16:42:06Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4234#p4234</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4232#p4232" />
			<content type="html"><![CDATA[<p>AppGraphics&#039; graphical functions are actually a superset of the Borland Graphics Interface rather than a thin Windows GDI wrapper.&nbsp; I can see the need for SetBkMode when drawing dashed lines and hashes, but I&#039;d have to see about the best way to implement it.&nbsp; I actually think it should default to transparent, which makes the whole argument unnecessary.</p><p>Text can be aligned with <a href="https://simplyfortran.com/docs/appgraphics/text.html">settextjustify</a> already.</p><p>To clear a window (or region), I normally use either the combo <em>setbkcolor</em>/<em>clearviewport</em> or simply <em>bar</em>.&nbsp; <em>floodfill</em> uses a more complicated procedure because of its capabilities, of course.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2023-10-22T14:18:56Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4232#p4232</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4230#p4230" />
			<content type="html"><![CDATA[<p>As far as I understand AppGraphics is a wrapper of Windows API. May I ask to add to AppGraphics:</p><p>- SetBKMode / GetBkMode<br />- SetTextAlign / GetTextAlign<br />- FillRect</p><p>The last one I would like to use creating the window with other then default black background. FloodFill, because the algorithm, is rather unaesthetic method.</p>]]></content>
			<author>
				<name><![CDATA[GrzegorzW]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=4153</uri>
			</author>
			<updated>2023-10-21T16:55:38Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4230#p4230</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4227#p4227" />
			<content type="html"><![CDATA[<p>Adding transparent text output to AppGraphics should be possible.&nbsp; I&#039;ll look at the best way to add it in a future release.</p><p>To add an image, you can use <a href="https://forums.approximatrix.com/help.php?section=bbcode">img tags</a>, but you would need to provide a URL to an image.&nbsp; We do not host any images here ourselves.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2023-10-21T16:33:16Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4227#p4227</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Trasparent text in AppGraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4224#p4224" />
			<content type="html"><![CDATA[<p>I run a simple program utilizing AppGraphic:</p><div class="codebox"><pre><code>program main
use appgraphics
implicit none

    integer::myscreen
    
    myscreen = initwindow(400, 300, closeflag=.TRUE.)
    
    !CALL setwritemode(COPY_PUT)
    CALL setwritemode(XOR_PUT)
    CALL line(100, 200, 300, 200)
    CALL outtextxy(200, 200, &#039;Abcd&#039;)
    
    call loop()
    
    call closewindow(myscreen)

end program main</code></pre></div><p>The result is that the text removes a part of the line and there is a gap. I played with <em>setwritemode</em> without desired results. Is there any way to display a text transparently? If not could you please add the subroutine to toggle opaque/transparent mode?</p><p>PS. I can&#039;t catch how to add the image to the topic.</p>]]></content>
			<author>
				<name><![CDATA[GrzegorzW]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=4153</uri>
			</author>
			<updated>2023-10-16T16:25:19Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4224#p4224</id>
		</entry>
</feed>
