<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — gdk_pixbuf_rotate]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=805&amp;type=atom" />
	<updated>2021-03-18T10:35:37Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=805</id>
		<entry>
			<title type="html"><![CDATA[Re: gdk_pixbuf_rotate]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3707#p3707" />
			<content type="html"><![CDATA[<p>Jeff,<br />Thanks. Yes, I renamed the c-function and changed the interface slightly because it was not clear how to translate gboolean to fortran.<br />Removing the property &quot;static&quot; essentially solved the problem.<br />Unfortunately the c-function didn&#039;t work properly and I implemented the function in fortran.<br />Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-03-18T10:35:37Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3707#p3707</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: gdk_pixbuf_rotate]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3705#p3705" />
			<content type="html"><![CDATA[<p>Roland,</p><p>The compiler is complaining that it can&#039;t find a function named <em>rotate</em>.&nbsp; The link you provided showed a function named <em>gdk_pixbuf_rotate</em>.&nbsp; Did you change the name?</p><p>Additionally, the link also defines the function as <strong>static</strong>, meaning it will not be available outside that particular C file.&nbsp; You&#039;ll need to remove the <strong>static</strong> keyword to make sure it is visible.</p><p>Your interface to it is also slightly wrong.&nbsp; The interface signature should be:</p><div class="codebox"><pre><code>! GdkPixbuf *gdk_pixbuf_rotate(GdkPixbuf *src,double radian,gboolean full_size)
interface
    function rotate(src, radian, full_size) bind(c, name=&quot;gdk_pixbuf_rotate&quot;)
    use iso_c_binding
    implicit none
    type(c_ptr), value::src
    real(kind=c_double), value::radian
    logical(kind=c_bool), value::full_size
    type(c_ptr)::rotate
    end function rotate
end interface</code></pre></div><p>You&#039;ll note that I used <em>c_double</em> for the radian argument.&nbsp; You also don&#039;t need the <em>ret</em> argument in the interface as it isn&#039;t defined as part of the function signature.</p><p>Let me know if the above helps.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2021-03-16T12:03:39Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3705#p3705</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[gdk_pixbuf_rotate]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3703#p3703" />
			<content type="html"><![CDATA[<p>Hello</p><p>With cairo /gtk / gdk /pixbuf one has only gdk_pixbuf_rotate_simple which allows for pixbuf rotations with a multiple of 90 degrees.<br />I indeed have the need to ratate at any arbitrary angle. Searching for a solution I found a c function that does this:<br />stackoverflow.com/questions/37520296/can-a-gdk-pixbuf-be-rotated-by-something-less-than-90-degrees<br />Consequently a wrote a f-c-interface that to my opinion should work.<br />the fortran and c-files compile correctly, however the build process exits with error:<br />==============================================================================<br />Generating Makefile... Okay<br />==============================================================================<br />Compiling .\gdk_pixbuf_rotate.c<br />Processing default resource<br />Generating hl_viewer_devel.exe<br />build\hl_viewer.o:hl_viewer.f90:(.text+0x248f): undefined reference to `rotate&#039;<br />collect2.exe: error: ld returned 1 exit status<br />Error: Last command making (hl_viewer_devel.exe) returned a bad status<br />Error: Make execution terminated</p><p>* Failed *</p><p>Fortran source:<br />module gdk_pixbuf_rotate<br />&nbsp; use iso_c_binding</p><p>&nbsp; implicit none</p><p>&nbsp; interface<br />&nbsp; &nbsp; &nbsp; ! GdkPixbuf *rotate(GdkPixbuf *src,double radian,int full_size)<br />&nbsp; &nbsp; &nbsp; function&nbsp; rotate(src,radian,full_size) bind (c)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; use iso_c_binding<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type(c_ptr),value :: src<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type(c_ptr):: ret<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; real(c_float),value:: radian<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; integer(c_int),value :: full_size<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type(c_ptr):: rotate<br />&nbsp; &nbsp; &nbsp; &nbsp; end function rotate<br />&nbsp; &nbsp;end interface<br />end module gdk_pixbuf_rotate</p><br /><br /><p>module v_handlers<br />&nbsp; use iso_c_binding</p><p>&nbsp; use gdk_events<br />&nbsp; use gdk_pixbuf_hl<br />&nbsp; use gtk_draw_hl<br />&nbsp; use gtk_sup<br />&nbsp; use gtk_hl<br />&nbsp; use gdk_pixbuf_rotate</p><p>&nbsp; !********************************<br />&nbsp; ! Gtk modules for hl_cairo_viewer.f90<br />&nbsp; use cairo, only: cairo_status, cairo_status_to_string<br />&nbsp; use gdk_pixbuf, only: gdk_pixbuf_get_height, gdk_pixbuf_get_width, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp; gdk_pixbuf_scale_simple, gdk_pixbuf_get_pixels, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp; gdk_pixbuf_add_alpha, gdk_pixbuf_rotate_simple<br />&nbsp; use gdk_pixbuf_hl<br />&nbsp; use gtk, only: gtk_combo_box_get_active, gtk_combo_box_set_active, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; gtk_container_add, gtk_main, gtk_main_quit, gtk_widget_set_sensitive, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; gtk_widget_show_all, gtk_init, TRUE, FALSE</p><p>&nbsp; implicit none</p><br /><br /><p>&nbsp; character(len=256), dimension(:), allocatable :: file_list<br />&nbsp; integer(kind=c_int) :: current_file<br />&nbsp; integer :: width = 800, height=1100;<br />&nbsp; type(c_ptr) :: tl_window, view, prev1000, prev500, prev100, prev50, prev10, prev5, prev1, next1, next5, next10, &amp;<br />&nbsp; &amp; next50, next100, next500, next1000, select<br />&nbsp; real, dimension (:,:), allocatable :: img_gray<br />&nbsp; real img_max, img_min</p><br /><br /> <br /><p>contains</p><br /><p> subroutine delete_v (widget, gdata)&nbsp; bind(c)<br />&nbsp; &nbsp; type(c_ptr), value :: widget, gdata<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; call gtk_main_quit</p><p>&nbsp; end subroutine delete_v</p><p>&nbsp; recursive subroutine show_image(widget, gdata)&nbsp; bind(c)<br />&nbsp; &nbsp; type(c_ptr), value :: widget, gdata<br />&nbsp; &nbsp; character(kind=c_char), dimension(:,:,:), pointer :: pixel</p><p>&nbsp; &nbsp; integer(kind=c_int), pointer :: istep<br />&nbsp; &nbsp; integer(kind=c_int) :: nx, ny, nxe, nye, nch, i,j,fu, nrs<br />&nbsp; &nbsp; type(c_ptr) :: pixbuf, pixbuf_scaled<br />&nbsp; &nbsp; character(len=120) :: errm=&#039;&#039;<br />&nbsp; &nbsp; real(kind=8) :: rx, ry, r;<br />&nbsp; &nbsp; integer(kind=1):: red, green, blue</p><p>&nbsp; &nbsp; if (.not. c_associated(view)) return</p><p>&nbsp; &nbsp; if (c_associated(gdata)) then<br />&nbsp; &nbsp; &nbsp; &nbsp;call c_f_pointer(gdata, istep)<br />&nbsp; &nbsp; &nbsp; &nbsp;current_file = current_file + istep<br />&nbsp; &nbsp; &nbsp; &nbsp;call gtk_combo_box_set_active(select, current_file)<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp;current_file = gtk_combo_box_get_active(widget)<br />&nbsp; &nbsp; &nbsp; &nbsp;if (current_file &lt; 0) return<br />&nbsp; &nbsp; end if</p><p>&nbsp; &nbsp; call gtk_widget_set_sensitive(prev1, f_c_logical(current_file &gt; 0))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev5, f_c_logical(current_file &gt; 4))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev10, f_c_logical(current_file &gt; 9))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev50, f_c_logical(current_file &gt; 49))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev100, f_c_logical(current_file &gt; 99))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev500, f_c_logical(current_file &gt; 499))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(prev1000, f_c_logical(current_file &gt; 999))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next1, f_c_logical(current_file &lt; size(file_list)-1))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next5, f_c_logical(current_file &lt; size(file_list)-5))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next10, f_c_logical(current_file &lt; size(file_list)-10))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next50, f_c_logical(current_file &lt; size(file_list)-50))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next100, f_c_logical(current_file &lt; size(file_list)-100))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next500, f_c_logical(current_file &lt; size(file_list)-500))<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(next1000, f_c_logical(current_file &lt; size(file_list)-1000))</p><p>&nbsp; &nbsp; errm = &#039;&#039;<br />&nbsp; &nbsp; pixbuf = hl_gdk_pixbuf_new(trim(file_list(current_file+1))//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; error=errm)<br />&nbsp; &nbsp; nch = gdk_pixbuf_get_n_channels(pixbuf)<br />&nbsp; &nbsp; nx = gdk_pixbuf_get_width(pixbuf)<br />&nbsp; &nbsp; ny = gdk_pixbuf_get_height(pixbuf)<br />&nbsp; &nbsp; nrs = gdk_pixbuf_get_rowstride(pixbuf)<br />&nbsp; &nbsp; if(nch.eq.3) then<br />&nbsp; &nbsp; &nbsp; &nbsp; pixbuf =&nbsp; gdk_pixbuf_add_alpha(pixbuf,FALSE,red,green,blue)<br />&nbsp; &nbsp; &nbsp; &nbsp; nch = gdk_pixbuf_get_n_channels(pixbuf)<br />&nbsp; &nbsp; endif<br />!&nbsp; &nbsp; open(newunit=fu,action=&#039;write&#039;,file=&#039;test.txt&#039;, status=&#039;replace&#039;)<br />!&nbsp; &nbsp; write(fu,*) &#039;nx:&#039;,nx<br />!&nbsp; &nbsp; write(fu,*) &#039;ny:&#039;,ny<br />!&nbsp; &nbsp; write(fu,*) &#039;#&nbsp; channels:&#039;,nch<br />!&nbsp; &nbsp; write(fu,*) &#039;rowstride:&#039;,nrs<br />!&nbsp; &nbsp; close(fU)<br />!&nbsp; &nbsp; <br />&nbsp; &nbsp; !call execute_command_line(&#039;notepad test.txt&#039;)</p><p>&nbsp; &nbsp; allocate ( img_gray(nx,ny) )&nbsp; <br />&nbsp; &nbsp; call c_f_pointer(gdk_pixbuf_get_pixels(pixbuf), pixel, int((/nch, nx, ny/)))<br />&nbsp; &nbsp; img_min = 10e10; img_max = -10e10;<br />&nbsp; &nbsp; do i=1,nx<br />&nbsp; &nbsp; &nbsp; do j=1,ny<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;img_gray(i,j) = 0.3d0*ichar(pixel(1,i,j)) + 0.59d0*ichar(pixel(2,i,j)) + &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; 0.11d0 * ichar(pixel(3,i,j))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(img_gray(i,j) &lt; img_min) img_min = img_gray(i,j)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(img_gray(i,j) &gt; img_max) img_max = img_gray(i,j)<br />&nbsp; &nbsp; &nbsp; end do<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; do i=1,nx<br />&nbsp; &nbsp; &nbsp; do j=1,ny<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixel(1,i,j) = char(int(img_gray(i,j),kind=1)); <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixel(2,i,j) = char(int(img_gray(i,j),kind=1)); <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixel(3,i,j) = char(int(img_gray(i,j),kind=1)); <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixel(4,i,j) = char(255);<br />&nbsp; &nbsp; &nbsp; end do<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; deallocate(img_gray)<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; pixbuf =&nbsp; rotate(pixbuf,0.1,1) <br />&nbsp; &nbsp; !pixbuf =&nbsp; gdk_pixbuf_rotate_simple(pixbuf,90) </p><p>&nbsp; &nbsp; nch = gdk_pixbuf_get_n_channels(pixbuf)<br />&nbsp; &nbsp; nx = gdk_pixbuf_get_width(pixbuf)<br />&nbsp; &nbsp; ny = gdk_pixbuf_get_height(pixbuf)<br />&nbsp; &nbsp; nrs = gdk_pixbuf_get_rowstride(pixbuf)<br />&nbsp; &nbsp; if(nch.eq.3) then<br />&nbsp; &nbsp; &nbsp; &nbsp; pixbuf =&nbsp; gdk_pixbuf_add_alpha(pixbuf,FALSE,red,green,blue)<br />&nbsp; &nbsp; &nbsp; &nbsp; nch = gdk_pixbuf_get_n_channels(pixbuf)<br />&nbsp; &nbsp; endif<br />&nbsp; &nbsp; </p><p>&nbsp; &nbsp; if (errm /= &quot;&quot;) then<br />&nbsp; &nbsp; &nbsp; &nbsp;write(error_unit, &quot;(2A)&quot;) &quot;Failed to open: &quot;, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp; trim(file_list(current_file+1))<br />&nbsp; &nbsp; &nbsp; &nbsp;write(error_unit, &quot;(2A)&quot;) &quot;&nbsp; &nbsp; &nbsp; &nbsp; &quot;, trim(errm)<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp;rx = real(nx)/real(width); ry = real(ny)/real(height);<br />&nbsp; &nbsp; &nbsp; &nbsp;r = rx;<br />&nbsp; &nbsp; &nbsp; &nbsp;nxe = nx; nye = ny;<br />&nbsp; &nbsp; &nbsp; &nbsp;if (ry &gt; 1.d0 .or. rx &gt;1.d0) then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ry .gt. rx) then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = ry<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; endif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nxe = int(real(nx)/r)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nye = int(real(ny)/r)<br />&nbsp; &nbsp; &nbsp; &nbsp;endif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp;pixbuf_scaled = gdk_pixbuf_scale_simple(pixbuf,nxe,nye,1)</p><p>&nbsp; &nbsp; &nbsp; &nbsp;!call hl_gtk_drawing_area_resize(view, [nxe, nye])<br />&nbsp; &nbsp; &nbsp; &nbsp;call hl_gtk_drawing_area_draw_pixbuf(view, pixbuf_scaled)<br />&nbsp; &nbsp; end if<br />&nbsp; end subroutine show_image</p><p>&nbsp; subroutine add_files(widget, gdata)&nbsp; bind(c)<br />&nbsp; &nbsp; type(c_ptr), value :: widget, gdata</p><p>&nbsp; &nbsp; character(len=256), dimension(:), allocatable :: new_files, tmp<br />&nbsp; &nbsp; logical, pointer :: idelete<br />&nbsp; &nbsp; integer(kind=c_int) :: ipick, i</p><p>&nbsp; &nbsp; ipick = hl_gtk_file_chooser_show(new_files, create=FALSE, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; initial_dir = &quot;D:\Dropbox\Fourier_precompensation\FFT_2D_Landolt\Fortran&quot;, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; initial_file= &quot;D:\Dropbox\Fourier_precompensation\FFT_2D_Landolt\Fortran\Email_Screenshot_160621-----de-blurred.tif&quot;,&nbsp; &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; multiple=TRUE, all=TRUE)</p><p>&nbsp; &nbsp; if (.not. c_f_logical(ipick)) return</p><p>&nbsp; &nbsp; call c_f_pointer(gdata, idelete)</p><p>&nbsp; &nbsp; if (idelete) then<br />&nbsp; &nbsp; &nbsp; &nbsp;if (allocated(file_list)) deallocate(file_list)<br />&nbsp; &nbsp; &nbsp; &nbsp;allocate(file_list(size(new_files)))<br />&nbsp; &nbsp; &nbsp; &nbsp;file_list(:) = new_files(:)<br />&nbsp; &nbsp; &nbsp; &nbsp;call hl_gtk_combo_box_delete(select)</p><p>&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp;allocate(tmp(size(file_list)))<br />&nbsp; &nbsp; &nbsp; &nbsp;tmp(:) = file_list(:)<br />&nbsp; &nbsp; &nbsp; &nbsp;if (allocated(file_list)) deallocate(file_list)<br />&nbsp; &nbsp; &nbsp; &nbsp;allocate(file_list(size(tmp)+size(new_files)))<br />&nbsp; &nbsp; &nbsp; &nbsp;file_list(:size(tmp)) = tmp(:)<br />&nbsp; &nbsp; &nbsp; &nbsp;file_list(size(tmp)+1:) = new_files(:)<br />&nbsp; &nbsp; &nbsp; &nbsp;if (current_file &lt; 0) current_file = 0<br />&nbsp; &nbsp; end if</p><p>&nbsp; &nbsp; do i = 1, size(new_files)<br />&nbsp; &nbsp; &nbsp; &nbsp;call hl_gtk_combo_box_add_text(select, trim(new_files(i))//c_null_char)<br />&nbsp; &nbsp; end do</p><p>&nbsp; &nbsp; if (current_file &lt; 0 .and. size(file_list) &gt; 0) current_file = 0<br />&nbsp; &nbsp; call gtk_combo_box_set_active(select, current_file)<br />&nbsp; &nbsp; call gtk_widget_set_sensitive(select, f_c_logical(size(file_list)&gt;0))<br />&nbsp; end subroutine add_files</p><p>&nbsp; subroutine red_channel(widget, gdata)&nbsp; bind(c)<br />&nbsp; &nbsp; type(c_ptr), value :: widget, gdata</p><p>&nbsp; &nbsp; character(len=256), dimension(:), allocatable :: new_files, tmp<br />&nbsp; &nbsp; logical, pointer :: idelete<br />&nbsp; &nbsp; integer(kind=c_int) :: ipick, i</p><p>&nbsp; end subroutine red_channel<br />end module v_handlers</p><br /><p>program hl_cairo_viewer<br />&nbsp; ! A very simple image viewer<br />&nbsp; use gdk_pixbuf_rotate<br />&nbsp; use v_handlers<br />&nbsp; use iso_c_binding</p><p>&nbsp; implicit none<br />&nbsp; integer(kind=c_int) :: nfiles, i, istat<br />&nbsp; integer(kind=c_int), dimension(14), target :: direction = [-1000,-500,-100,-50,-10,-5,-1, 1, 5, 10, 50, 100, 500, 1000]<br />&nbsp; logical, dimension(2), target :: iremove = [.false., .true.]</p><p>&nbsp; type(c_ptr) :: scroll, base, jb,jb0, junk, cmsg<br />&nbsp; character(len=120) :: err_msg</p><br /><p>&nbsp; call chdir(&quot;D:\Dropbox\Fourier_precompensation\FFT_2D_Landolt\Fortran&quot;)<br />&nbsp; <br />&nbsp; call gtk_init()</p><p>&nbsp; nfiles = command_argument_count()<br />&nbsp; if (nfiles &gt; 0) then<br />&nbsp; &nbsp; &nbsp;allocate(file_list(nfiles))<br />&nbsp; &nbsp; &nbsp;do i = 1, nfiles<br />&nbsp; &nbsp; &nbsp; &nbsp; call get_command_argument(i, value=file_list(i))<br />&nbsp; &nbsp; &nbsp;end do<br />&nbsp; &nbsp; &nbsp;current_file = 0<br />&nbsp; else <br />&nbsp; &nbsp; &nbsp;current_file = -1<br />&nbsp; end if</p><p>&nbsp; tl_window = hl_gtk_window_new(&quot;Simple Image Viewer modified by REJ&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; destroy=c_funloc(delete_v), resizable=TRUE)</p><p>&nbsp; base = hl_gtk_box_new()<br />&nbsp; call gtk_container_add(tl_window, base)</p><p>&nbsp; view = hl_gtk_drawing_area_new(scroll=scroll, ssize=[width, height], &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; has_alpha=TRUE, cairo_status=istat)<br />&nbsp; if (istat /= 0) then<br />&nbsp; &nbsp; &nbsp;cmsg = cairo_status_to_string(istat)<br />&nbsp; &nbsp; &nbsp;call c_f_string(cmsg, err_msg)<br />&nbsp; &nbsp; &nbsp;write(error_unit, &quot;(2a)&quot;) &quot;hl_cairo_viewer: &quot;, trim(err_msg)<br />&nbsp; &nbsp; &nbsp;stop<br />&nbsp; end if</p><p>&nbsp; call hl_gtk_box_pack(base, scroll)</p><p>&nbsp; jb = hl_gtk_box_new(horizontal=TRUE)<br />&nbsp; jb0 = hl_gtk_box_new(horizontal=TRUE)<br />&nbsp; call hl_gtk_box_pack(base, jb0)<br />&nbsp; call hl_gtk_box_pack(base, jb)</p><p>&nbsp; prev1000 = hl_gtk_button_new(&quot;&lt;-1000&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(1)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev1000, expand=FALSE)<br />&nbsp; prev500 = hl_gtk_button_new(&quot;&lt;-500&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(2)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev500, expand=FALSE)<br />&nbsp; prev100 = hl_gtk_button_new(&quot;&lt;-100&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(3)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev100, expand=FALSE)<br />&nbsp; prev50 = hl_gtk_button_new(&quot;&lt;-50&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(4)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev50, expand=FALSE)<br />&nbsp; prev10 = hl_gtk_button_new(&quot;&lt;-10&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(5)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev10, expand=FALSE)<br />&nbsp; prev5 = hl_gtk_button_new(&quot;&lt;-5&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(6)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, prev5, expand=FALSE)<br />&nbsp; prev1 = hl_gtk_button_new(&quot;&lt;-1&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(7)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the previous image.&quot;//c_null_char,&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=false)<br />&nbsp; call hl_gtk_box_pack(jb, prev1, expand=FALSE)<br />&nbsp; !call hl_gtk_box_pack(jb0, prev1, expand=FALSE)</p><p>&nbsp; select = hl_gtk_combo_box_new(changed=c_funloc(show_image), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0), tooltip=&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; &quot;Select an image to show&quot;//c_null_char)<br />&nbsp; !call hl_gtk_box_pack(jb, select, expand=TRUE)<br />&nbsp; call hl_gtk_box_pack(jb0, select, expand=TRUE)</p><p>&nbsp; next1 = hl_gtk_button_new(&quot;1-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(8)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, next1, expand=FALSE)</p><p>&nbsp; next5 = hl_gtk_button_new(&quot;5-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(9)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt;=5))<br />&nbsp; call hl_gtk_box_pack(jb, next5, expand=FALSE)</p><p>&nbsp; next10 = hl_gtk_button_new(&quot;10-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(10)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt;= 10))<br />&nbsp; call hl_gtk_box_pack(jb, next10, expand=FALSE)</p><p>&nbsp; next50 = hl_gtk_button_new(&quot;50-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(11)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt;=50))<br />&nbsp; call hl_gtk_box_pack(jb, next50, expand=FALSE)</p><p>&nbsp; next100 = hl_gtk_button_new(&quot;100-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(12)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt;= 100))<br />&nbsp; call hl_gtk_box_pack(jb, next100, expand=FALSE)</p><p>&nbsp; next500 = hl_gtk_button_new(&quot;500-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(13)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt;=500))<br />&nbsp; call hl_gtk_box_pack(jb, next500, expand=FALSE)</p><p>&nbsp; next1000 = hl_gtk_button_new(&quot;1000-&gt;&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(show_image), data=c_loc(direction(14)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Go to the next image.&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; sensitive=f_c_logical(nfiles &gt; 0))<br />&nbsp; call hl_gtk_box_pack(jb, next1000, expand=FALSE)</p><p>&nbsp; if (nfiles &gt; 0) then <br />&nbsp; &nbsp; &nbsp;do i = 1, nfiles<br />&nbsp; &nbsp; &nbsp; &nbsp; call hl_gtk_combo_box_add_text(select, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; trim(file_list(i))//c_null_char)<br />&nbsp; &nbsp; &nbsp;end do<br />&nbsp; end if</p><p>&nbsp; junk = hl_gtk_button_new(&quot;red channel&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(red_channel), data=c_loc(iremove(1)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Show red channel only.&quot;//c_null_char)<br />&nbsp; call hl_gtk_box_pack(jb0, junk, expand=FALSE)</p><p>&nbsp; junk = hl_gtk_button_new(&quot;Add files&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(add_files), data=c_loc(iremove(1)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Pick files to add to the list.&quot;//c_null_char)<br />&nbsp; call hl_gtk_box_pack(jb0, junk, expand=FALSE)</p><p>&nbsp; junk = hl_gtk_button_new(&quot;Replace files&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(add_files), data=c_loc(iremove(2)), &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; tooltip=&quot;Pick files to replace the list.&quot;//c_null_char)<br />!&nbsp; call hl_gtk_box_pack(jb0, junk)<br />&nbsp; call hl_gtk_box_pack(jb0, junk, expand=FALSE)</p><p>&nbsp; junk=hl_gtk_button_new(&quot;Quit&quot;//c_null_char, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; clicked=c_funloc(delete_v), tooltip=&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&amp; &quot;Quit the viewer.&quot;//c_null_char)<br />&nbsp; call hl_gtk_box_pack(jb0, junk, expand=FALSE)</p><p>&nbsp; call gtk_widget_show_all(tl_window)<br />&nbsp; if (nfiles == 0) call add_files(c_null_ptr, c_loc(iremove(2)))<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; if (current_file &gt;= 0) call gtk_combo_box_set_active(select, current_file)<br />&nbsp; call gtk_main()</p><p>end program hl_cairo_viewer</p><p>c-source:<br />#include &lt;gtk/gtk.h&gt;<br />#include &lt;math.h&gt;</p><p>/* There are two reasonable sizes for a rotated image-- Either the minimum */<br />/*&nbsp; bounding box which contains all rotated pixels (and a bunch of white space)*/<br />/*&nbsp; or the maximum rectangle where all pixels come from the source image (but */<br />/*&nbsp; where we lose some of the corners) */<br />/* The first is easy to calculate: The minimum bounding box will have the corners */<br />/*&nbsp; of the rotated image on its edges, this leaves us with four triangles in */<br />/*&nbsp; the corners of the bb. Two triangles have edges width*sin(theta), width*cos(theta) */<br />/*&nbsp; and two have edges height*sin(theta), height*cos(theta) */<br />/*&nbsp; so the new width height will be the sum of two adjacent triangle edges: */<br />/*&nbsp; &nbsp;width&quot; = width*cos + height*sin */<br />/*&nbsp; &nbsp;height&quot;= width*sin + height*cos */<br />/* Now for the maximum inscribed rectangle we draw a similar picture (except */<br />/*&nbsp; the unknown rectangle is internal now) and get similar triangles. Here the*/<br />/*&nbsp; equations are: */<br />/*&nbsp; &nbsp;width = width&#039;*cos + height&#039;*sin */<br />/*&nbsp; &nbsp;height= width&#039;*sin + height&#039;*cos */<br />/*&nbsp; solving for height&#039;... */<br />/*&nbsp; &nbsp;height&#039; = (width-width&#039;*cos)/sin */<br />/*&nbsp; &nbsp;height&#039; = (height-width&#039;*sin)/cos */<br />/*&nbsp; &nbsp;(width-width&#039;*cos)/sin = (height-width&#039;*sin)/cos */<br />/*&nbsp; &nbsp;width*cos - width&#039;*cos^2 = height*sin - width&#039;*sin^2 */<br />/*&nbsp; &nbsp;width&#039; * (sin^2-cos^2) = height*sin-width*cos */<br />/*&nbsp; &nbsp;width&#039; = (height*sin - width*cos)/(sin^2-cos^2) */<br />/*&nbsp; &nbsp;height&#039;= (width*sin - height*cos)/(sin^2-cos^2) */<br />/*&nbsp; Note this produces garbage (0/0) when rotated by 45 degrees (135,225,...) */<br />/*&nbsp; &nbsp;A little experimentation shows that at 45 degrees the only thing with */<br />/*&nbsp; &nbsp;an internal rectangle is a square, all other aspect ratios have a height */<br />/*&nbsp; &nbsp;of 0. A square, however, has an internal square with sides&nbsp; 1/sqrt(2) of the original */<br />/* When creating a full_size image (minimum bounding box) we should return */<br />/*&nbsp; an image with an alpha channel (whether the original had one or no). */<br />/*&nbsp; otherwise we should create an alpha channel only if the original had one */</p><p>/* A pixel at (x,y) will be rotated to: */<br />/*&nbsp; &nbsp; ((x-width/2)*cos + (y-height/2)*sin + width&#039;/2 ,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />/*&nbsp; &nbsp; =(x-width/2)*sin + (y-height/2)*cos + height&#039;/2 )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />/* A pixel at (x&#039;,y&#039;) will have come from: */<br />/*&nbsp; &nbsp; ((x&#039;-width&#039;/2)*cos - (y&#039;-height&#039;/2)*sin + width/2 ,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />/*&nbsp; &nbsp; &nbsp;(x&#039;-width&#039;/2)*sin + (y&#039;-height&#039;/2)*cos + height/2 )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</p><br /><p>static GdkPixbuf *rotate(const GdkPixbuf *src,float radian,int full_size) {&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; double s = sin(radian), c = cos(radian);<br />&nbsp; &nbsp; double as= s&lt;0 ? -s : s, ac= c&lt;0 ? -c : c;<br />&nbsp; &nbsp; int width, height, nwidth, nheight;<br />&nbsp; &nbsp; int hasalpha, nhasalpha;<br />&nbsp; &nbsp; GdkPixbuf *ret;<br />&nbsp; &nbsp; int nr,nc,r,col;<br />&nbsp; &nbsp; double nmodr, nmodc;<br />&nbsp; &nbsp; int alpha=0;<br />&nbsp; &nbsp; guchar *pixels, *npixels, *pt, *npt;<br />&nbsp; &nbsp; int rowstride, nrowstride, pixellen;<br />&nbsp; &nbsp; if ( src==NULL )<br />&nbsp; &nbsp; &nbsp; &nbsp; return( NULL );<br />&nbsp; &nbsp; width&nbsp; &nbsp; &nbsp;= gdk_pixbuf_get_width(src);<br />&nbsp; &nbsp; height&nbsp; &nbsp; = gdk_pixbuf_get_height(src);<br />&nbsp; &nbsp; hasalpha&nbsp; = gdk_pixbuf_get_has_alpha(src);<br />&nbsp; &nbsp; rowstride = gdk_pixbuf_get_rowstride(src);<br />&nbsp; &nbsp; pixels&nbsp; &nbsp; = gdk_pixbuf_get_pixels(src);<br />&nbsp; &nbsp; pixellen&nbsp; = hasalpha ? 4 : 3;<br />&nbsp; &nbsp; if ( full_size ==1) {<br />&nbsp; &nbsp; &nbsp; &nbsp; nwidth = round( ac*width + as*height );<br />&nbsp; &nbsp; &nbsp; &nbsp; nheight= round( as*width + ac*height );<br />&nbsp; &nbsp; &nbsp; &nbsp; nhasalpha = TRUE;<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; double denom = as*as - ac*ac;<br />&nbsp; &nbsp; &nbsp; &nbsp; if ( denom&lt;.1e-7 &amp;&amp; denom&gt;-1.e-7 ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( width!=height )<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return( NULL );<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nwidth = nheight = round( width/sqrt(2.0) );<br />&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nwidth = round( (height*as - width*ac)/denom );<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nheight = round( (width*as - height*ac)/denom );<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; if ( nwidth&lt;=0 || nheight&lt;=0 )<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return( NULL );<br />&nbsp; &nbsp; &nbsp; &nbsp; nhasalpha = hasalpha;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB,nhasalpha,8,nwidth,nheight);<br />&nbsp; &nbsp; if ( ret==NULL )<br />&nbsp; &nbsp; &nbsp; &nbsp; return( NULL );<br />&nbsp; &nbsp; nrowstride = gdk_pixbuf_get_rowstride(ret);<br />&nbsp; &nbsp; npixels&nbsp; &nbsp; = gdk_pixbuf_get_pixels(ret);<br />&nbsp; &nbsp; for ( nr=0; nr&lt;nheight; ++nr ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; nmodr = nr-nheight/2.0;<br />&nbsp; &nbsp; &nbsp; &nbsp; npt = npixels + nr*nrowstride;<br />&nbsp; &nbsp; &nbsp; &nbsp; for ( nc=0; nc&lt;nwidth; ++nc ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nmodc = nc-nwidth/2.0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* Where did this pixel come from? */<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r&nbsp; &nbsp;= round( height/2 - nmodc*s + nmodr*c );<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; col = round( width/2&nbsp; + nmodc*c + nmodr*s );<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( r&lt;0 || col&lt;0 || r&gt;=height || col&gt;=width ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alpha = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( r&lt;0 ) r=0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if ( r&gt;=height ) r = height-1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( col&lt;0 ) col = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if ( col&gt;=width ) col = width-1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alpha = 0xff;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pt = pixels + r*rowstride + col*pixellen;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *npt++ = *pt++;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *npt++ = *pt++;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *npt++ = *pt++;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( hasalpha &amp;&amp; alpha!=0 )<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alpha = *pt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( nhasalpha )<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *npt++ = alpha;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp;return( ret );<br />}</p><p>Project-File (make-file):<br />#<br /># Automagically generated by Approximatrix Simply Fortran 3.17<br />#<br />FC=&quot;C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin\gfortran.exe&quot;<br />CC=&quot;C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin\gcc.exe&quot;<br />AR=&quot;C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin\ar.exe&quot;<br />WRC=&quot;C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin\windres.exe&quot;<br />PRJTK=&quot;C:\Program Files (x86)\Simply Fortran 3\fwin\sfprjtk.exe&quot;<br />RM=rm -f</p><p>IDIR=-IC:/Users/rjoos/AppData/Local/sfpm/32/include </p><p>LDIR=-LC:/PROGRA~2/SIMPLY~1/MINGW-~1/lib/ -LC:/Users/rjoos/AppData/Local/sfpm/32/lib </p><br /><p>OPTFLAGS= -O3 -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -floop-parallelize-all</p><p>SPECIALFLAGS=-m32 $(IDIR)</p><p>RCFLAGS=-O coff -F pe-i386</p><p>PRJ_FFLAGS=</p><p>PRJ_CFLAGS=-mms-bitfields</p><p>PRJ_LFLAGS=-lplplotf95 -lplplotf95c -lplplot -lplplotcxx -lcsirocsa -lqsastime -lgtk-3-fortran -lgtk-3.dll -lgdk-3.dll -lgthread-2.0.dll -lgdi32 -lole32 -latk-1.0.dll -lgdk_pixbuf-2.0.dll -lpangowin32-1.0.dll -lpangoft2-1.0.dll -lpango-1.0.dll -lpangocairo-1.0.dll -lcairo.dll -lcairo-gobject.dll -lgobject-2.0.dll -lgmodule-2.0.dll -lglib-2.0.dll -lfontconfig.dll -lfreetype.dll -lpng15.dll -lz -lintl.dll -lcomdlg32</p><p>FFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_FFLAGS) -JD:/Dropbox/Fourier_precompensation/FFT_2D_Landolt/Fortran/modules </p><p>CFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_CFLAGS)</p><br /><p>&quot;build\gdk_pixbuf_rotate.o&quot;: &quot;.\gdk_pixbuf_rotate.c&quot;<br />&nbsp; &nbsp; @echo Compiling .\gdk_pixbuf_rotate.c<br />&nbsp; &nbsp; @$(CC) -c -o &quot;build\gdk_pixbuf_rotate.o&quot; $(CFLAGS) &quot;.\gdk_pixbuf_rotate.c&quot;</p><p>&quot;build\hl_viewer.o&quot;: &quot;.\hl_viewer.f90&quot;<br />&nbsp; &nbsp; @echo Compiling .\hl_viewer.f90<br />&nbsp; &nbsp; @$(FC) -c -o &quot;build\hl_viewer.o&quot; $(FFLAGS) &quot;.\hl_viewer.f90&quot;<br />&quot;modules\gdk_pixbuf_rotate.mod&quot; &quot;modules\v_handlers.mod&quot; : &quot;build\hl_viewer.o&quot; .EXISTSONLY<br />&nbsp; &nbsp; @echo Compiling .\hl_viewer.f90<br />&nbsp; &nbsp; @$(FC) -c -o &quot;build\hl_viewer.o&quot; $(FFLAGS) &quot;.\hl_viewer.f90&quot;</p><br /><p>&quot;build\sf_default_resource.res&quot;: &quot;build\sf_default_resource.rc&quot; &quot;./Mandelbrot.ICO&quot;<br />&nbsp; &nbsp; @echo Processing default resource<br />&nbsp; &nbsp; @$(WRC) build\sf_default_resource.rc $(RCFLAGS) -o build\sf_default_resource.res</p><p>clean: .SYMBOLIC<br />&nbsp; &nbsp; @echo Deleting build\gdk_pixbuf_rotate.o and related files<br />&nbsp; &nbsp; @$(RM) &quot;build\gdk_pixbuf_rotate.o&quot;<br />&nbsp; &nbsp; @echo Deleting build\hl_viewer.o and related files<br />&nbsp; &nbsp; @$(RM) &quot;build\hl_viewer.o&quot; &quot;modules\gdk_pixbuf_rotate.mod&quot; &quot;modules\gdk_pixbuf_rotate.smod&quot; &quot;modules\v_handlers.mod&quot; &quot;modules\v_handlers.smod&quot;<br />&nbsp; &nbsp; @echo Deleting build\julia_pixbuf_devel.o and related files<br />&nbsp; &nbsp; @$(RM) &quot;build\julia_pixbuf_devel.o&quot;<br />&nbsp; &nbsp; @echo Deleting build\mandelbrot_pixbuf_zoom_develop.o and related files<br />&nbsp; &nbsp; @$(RM) &quot;build\mandelbrot_pixbuf_zoom_develop.o&quot;<br />&nbsp; &nbsp; @echo Deleting build\rotate.o and related files<br />&nbsp; &nbsp; @$(RM) &quot;build\rotate.o&quot;<br />&nbsp; &nbsp; @echo Deleting default icon resource<br />&nbsp; &nbsp; @$(RM) &quot;build\sf_default_resource.res&quot;<br />&nbsp; &nbsp; @echo Deleting hl_viewer_devel.exe<br />&nbsp; &nbsp; @$(RM) &quot;hl_viewer_devel.exe&quot;</p><p>&quot;hl_viewer_devel.exe&quot;:&nbsp; &quot;build\gdk_pixbuf_rotate.o&quot; &quot;build\hl_viewer.o&quot; &quot;build\sf_default_resource.res&quot; &quot;build\Mandelbrot_develop_GTK3.prj.target&quot;<br />&nbsp; &nbsp; @echo Generating hl_viewer_devel.exe<br />&nbsp; &nbsp; @$(FC) -o &quot;hl_viewer_devel.exe&quot; -static -m32 -mwindows &quot;build\gdk_pixbuf_rotate.o&quot; &quot;build\hl_viewer.o&quot; &quot;build\sf_default_resource.res&quot; $(LDIR) $(PRJ_LFLAGS)</p><p>all: &quot;hl_viewer_devel.exe&quot; .SYMBOLIC</p><p>Sorry, has got a long post. It would be nice if code could be added seperately.</p><p>Roland</p>]]></content>
			<author>
				<name><![CDATA[rjoos]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3993</uri>
			</author>
			<updated>2021-03-15T19:32:01Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3703#p3703</id>
		</entry>
</feed>
