<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Accessing image buffer in Appgraphics]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=797&amp;type=atom" />
	<updated>2021-01-25T12:49:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=797</id>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3679#p3679" />
			<content type="html"><![CDATA[<p>Roland,</p><p>Our GTK+ packages are only 32-bit at this time.&nbsp; When these packages were originally assembled, that was the only &quot;stable&quot; version of GTK+ for Windows.&nbsp; I can revisit this, though.&nbsp; With 32-bit on Windows, you would be limited to about 1.5GB of memory allocation, which is still substantial.</p><p>Changing the memory model is only useful for increasing the amount of statically allocated memory the program can use.&nbsp; By statically allocated, I am referring mostly to arrays who&#039;s sizes are pre-determined.&nbsp; If you use Fortran&#039;s <em>ALLOCATE</em> statement, though, you can vastly exceed the limits imposed by a different memory model.&nbsp; </p><p>Just as a reference, using the <em>medium</em> memory model, even with a 64-bit program, will still limit you to 2GB of statically declared memory.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-01-25T12:49:51Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3679#p3679</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3678#p3678" />
			<content type="html"><![CDATA[<p>High Jeff,<br />thanks for your effort! I played a lot with GTK-Fortran library and it works rather good.<br />there are, however, two concerns:<br />1. Its only possible to use GTK+32bit in the compiler options.<br />2. Only small memory model is possible. With the examples I am playing with, this is probably no problem. But I would like to add Fourier transforms to the image; this might lead to memory problems I fear.<br />Regards, Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-01-25T08:03:15Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3678#p3678</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3677#p3677" />
			<content type="html"><![CDATA[<p>Roland,</p><p>GTK would certainly provide the buffers you&#039;re looking to work with.&nbsp; AppGraphics is just limited in order to keep things simple.&nbsp; I&#039;ve been looking a bit more into how you could actually read and write numeric values to an AppGraphics bitmap, but I haven&#039;t come up with a simple solution.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-01-19T15:20:34Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3677#p3677</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3676#p3676" />
			<content type="html"><![CDATA[<p>Just to complete this discussion: Playing with GTK-Fortran examples I realized that within the frame of GTK+ bitmaps can be handeled by buffers. One of the examples is the mandelbrot-pixbuf.f90 and demonstrates exactly the solution to my question.<br />Regards, Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-01-14T22:41:25Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3676#p3676</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3675#p3675" />
			<content type="html"><![CDATA[<p>Hello Jeff and Carlos<br />Having read your answeres and scanned through the Forum I tried DISLIN. Little search reveiles that DISLIN comes with a good example for Mandelbrot set calculation, including a simple GUI with zoom-functions, progress bar etc. Keeping in mind that the goal is to do fast calculation of large bitmaps (&gt;2000 * 2000 pixels) and display the bitmaps, I increased the mandelbrot matrix from 600 * 600 pixels to 2000 * 2000 pixels. The progress bar shows that calculation of the mandelbrot set indeed is very fast. However, the display of the image takes considerable time. So I think that DISLIN stores an intermediate image file on disk and then loads the image file for display.<br />I did a lot of programming with Borland Delphi and Lazarus / Freepascal on Windows, also using BGI. As drawing of bitmaps within BGI is possible, I have difficulties to understand why this should not be possible within the AppGraphix framework. See e.g. the definition of &quot;putimage&quot; in BGI:<br /> void putimage (int left, int top, void *bitmap, int op);<br />I have no experience with GTK+ / Cairo and presently can&#039;t figure out how to deal with that. From the link Carlos provided I don&#039;t&nbsp; understand how to do this.<br />What about using openGL or Cimg (Cimg.eu)? Any hints or proposals?<br />Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-01-13T08:31:17Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3675#p3675</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3674#p3674" />
			<content type="html"><![CDATA[<p>Just vague idea: create your image using Cairo library, directly from Simply Fortran (see topic below: <a href="https://forums.approximatrix.com/viewtopic.php?id=781)">https://forums.approximatrix.com/viewtopic.php?id=781)</a>, and then display it in AppGraphics window.<br />Unfortunately, AppGraphics does not support direct import of png files...</p>]]></content>
			<author>
				<name><![CDATA[Carlos Herrera]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=407</uri>
			</author>
			<updated>2021-01-12T15:13:54Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3674#p3674</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3673#p3673" />
			<content type="html"><![CDATA[<p>Roland,</p><p>AppGraphics does not support accessing the image buffer.&nbsp; The Fortran <em>imagetype</em> derived type contains a member of <em>type(c_ptr)</em> that is actually a Windows <em>HBITMAP</em> handle.&nbsp; While you could possibly access the bytes of an <em>HBITMAP</em> by converting it to a device-independent bitmap and using some additional Windows API calls to access the <em>DIBSECTION</em>, I wouldn&#039;t recommend it.&nbsp; Additionally, accessing the bitmap handle isn&#039;t part of the AppGraphics API, so there&#039;s always the chance it would be broken in a future release.</p><p>You can get some mild speed improvement by moving to double-buffering, but it wouldn&#039;t be an order of magnitude faster.&nbsp; It might only improve things by a factor of 2.&nbsp; The <em>putpixel</em> call is expensive because it first looks up the current window and drawing context from arrays before actually drawing the single pixel.&nbsp; After the pixel is drawn, it triggers a Windows invalidation for a rectangle around that single pixel.&nbsp; I don&#039;t believe the bottleneck is the Windows GDI in this case.</p><p>A better image drawing routine or a more efficient pixel operation would be preferable, but they don&#039;t exist in AppGraphics right now.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-01-12T12:34:32Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3673#p3673</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Accessing image buffer in Appgraphics]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3672#p3672" />
			<content type="html"><![CDATA[<p>Hello</p><p>I would like to produce fast calculations of bitmap graphics, e.g. high resolution mandelbrot set (2500 x 2000 pixels).<br />I manage to do this by calling putpixel(px,py,creatergb(ih,ih,ih)) for each point. However, this is very slow bcause every putpixel is essentially a call to the windows GDI system.</p><p>Logically there must be a way to define an image buffer<br />type(imagetype):: iarr<br />...<br />call allocateimage(iarr, 2500, 2000)<br />....<br />manipulate, access iarr(x,y)<br />....<br />then <br />call pasteimage(1,1,iarr)</p><p>and finally </p><p>call freeimage(iarr)</p><p>How does one access the image buffer?</p><p>Regards,<br />Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-01-11T16:14:42Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3672#p3672</id>
		</entry>
</feed>
