<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Bgi graphics]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=433&amp;type=atom" />
	<updated>2015-02-09T16:18:58Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=433</id>
		<entry>
			<title type="html"><![CDATA[Re: Bgi graphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=1892#p1892" />
			<content type="html"><![CDATA[<p>Frank,</p><p>The problems I mentioned in the last post are fixed in AppGraphics 1.2, which will be released with&nbsp; Simply Fortran 2.21.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-02-09T16:18:58Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=1892#p1892</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bgi graphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=1876#p1876" />
			<content type="html"><![CDATA[<p>Frank,</p><p>The following code should work fine:</p><div class="codebox"><pre><code>program bgi_example
use appgraphics
implicit none

    integer, parameter::scr_width = 800
    integer, parameter::scr_height = 600
    integer::midx, midy, i, ignore
    integer::w
    character(len=40)::drivername
    integer, dimension(4,2)::pp
    type(imagetype)::img
    
    w = initwindow(scr_width, scr_height, title=&quot;WinBGI Fortran Example&quot;)
    i = graphresult()
    if(i &lt; 0) then
        Print *, &quot;An error occurred: &quot;, i
        stop
    else
        Print *, &quot;Graphics ok!&quot;
    end if

    midx = getmaxx() / 2;
    midy = getmaxy() / 2;
    ! Added for fun
    call arc(midx, midy, 0, 180, 150)

    pp = 0
    pp(1,:) = (/ 5, 100 /)
    pp(2,:) = (/ 55, 100 /)
    pp(3,:) = (/ 55, 130 /)
    pp(4,:) = (/ 5, 130 /)

    call drawpoly(4, pp)
    
    call allocateimage(img, 100, 100)
    do i = EMPTY_FILL, USER_FILL-1
        ! set the fill style
        call setfillstyle(i, creatergb(255, 0, 0))
        
        ! draw the 3-d bar
        call bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1)
        
        ignore = getch()
        Print *, &quot;Key Pressed: &quot;, ignore
        
        call copyimage(midx-50, midy-50, img)
        
        call pasteimage(MOD((i-EMPTY_FILL)*100, scr_width), &amp;
                        scr_height-100, img, COPY_PUT)
    end do

    call freeimage(img)
    
    call closewindow(ALL_WINDOWS)
    Print *, &quot;Window Closed&quot;

end program bgi_example</code></pre></div><p>This simple example, however, revealed a couple of problems:</p><ul><li><p>The named colors appear to be wrong</p></li><li><p>The <em>copyimage</em> and <em>pasteimage</em> functions might not be working</p></li></ul><p>I&#039;ll have to look into those minor issues.</p><p>Generally, AppGraphics shares much of its drawing code with WinBGI, but it eliminates legacy oddities like the &quot;16-color&quot; limits and the concept of a graphics driver.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-02-02T20:33:51Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=1876#p1876</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bgi graphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=1870#p1870" />
			<content type="html"><![CDATA[<p>Hi Jeff,</p><p>I have some questions regarding your Bgi graphics library.</p><p>How can the following Bgi code be implemented in SF&#039;s Appgraphics?</p><p>What are the equivalent commands and format?</p><p>What is the difference between the Bgi and Appgraphics libraries?</p><p>program bgi_example<br />use bgi<br />use bgi_types, only: imagetype<br />implicit none<br />integer, parameter::scr_width = 800<br />integer, parameter::scr_height = 600<br />integer::midx, midy, i, ignore<br />integer::w<br />character(len=40)::drivername<br />integer, dimension(4,2)::pp<br />type(imagetype)::img<br />! Initgraph will use the default driver at 640x480<br />! gdriver = DETECT<br />! call initgraph(gdriver, gmode, &quot;&quot;)<br />! Instead, we&#039;ll use the more modern initwindow call<br />w = initwindow(scr_width, scr_height, title=&quot;WinBGI Fortran Example&quot;)<br />i = graphresult()<br />if(i &lt; 0) then<br />Print *, &quot;An error occurred: &quot;, i<br />stop<br />else<br />Print *, &quot;Graphics ok!&quot;<br />end if<br />call getdrivername(drivername)<br />Print *, &quot;My driver is called &quot;//trim(drivername)<br />midx = getmaxx() / 2;<br />midy = getmaxy() / 2;<br />! Added for fun<br />call arc(midx, midy, 0, 180, 150)<br />pp = 0<br />pp(1,:) = (/ 5, 100 /)<br />pp(2,:) = (/ 55, 100 /)<br />pp(3,:) = (/ 55, 130 /)<br />pp(4,:) = (/ 5, 130 /)<br />call drawpoly(4, pp)<br />call allocateimage(img, 100, 100)<br />do i = EMPTY_FILL, USER_FILL-1<br />! set the fill style<br />call setfillstyle(i, RED);<br />! draw the 3-d bar<br />call bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1)<br />ignore = getch()<br />Print *, &quot;Key Pressed: &quot;, ignore<br />call copyimage(midx-50, midy-50, img)<br />call pasteimage(MOD((i-EMPTY_FILL)*100, scr_width), &amp;<br />scr_height-100, img, COPY_PUT)<br />end do<br />call freeimage(img)<br />! clean up<br />call closegraph(ALL_WINDOWS)<br />Print *, &quot;Window Closed&quot;</p><p>Thanks again for your time and effort in developing these libraries.</p><p>Frank</p>]]></content>
			<author>
				<name><![CDATA[drfrank]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=223</uri>
			</author>
			<updated>2015-02-01T18:44:37Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=1870#p1870</id>
		</entry>
</feed>
