forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IMPORT_BMP@ - equivalents for JPG, GIF, PNG ?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Thu Sep 19, 2013 2:05 pm    Post subject: Reply with quote

John - Not sure if I'm the Steve you're referring to, but I have no need for .emf - what I need to use mainly is jpg, png, and gif. I also use svg - but this is a simple ASCII format dealt with by standard Fortran read/write and quite separate from all the others.

What you say about returning to this from time to time and forgetting the solutions you found before. I have been doing just the same! I agree there's a need for a consistent set of programmer documentation that deals with all the graphics together, and would be happy to do what I can to help with this.

- Steve
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri Sep 20, 2013 8:09 am    Post subject: Reply with quote

My mistake Steve, someone was using .emf formats.

Also, someone did produce a user guide for clearwin+ about a year ago, although I never did locate a copy.
Perhaps we should review this and see how we go.

John
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Apr 02, 2014 9:52 pm    Post subject: Reply with quote

what's this 'User guide for Clearwin+' referred to above? I assume it was some sort of 'independant enthusiasts' notes (which are often better in some instances than official user manuals ! Smile) ?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Apr 04, 2014 3:21 pm    Post subject: Reply with quote

It's downloadable from the documentation section http://www.silverfrost.com/23/ftn95/support/documentation.aspx

Some time ago it became obvious that Silverfrost didn't have access to all the documentation from Salford when they took over the compiler, and some of the manuals actually came from the user community. In particular, the early documentation for Clearwin+ (although you should read the ENH file installed in your system when you installed the compiler for later updates) and also the subroutine libraries for FTN77 still work, and are documented in the same place.

Eddie
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sat Apr 05, 2014 2:35 am    Post subject: Reply with quote

Thanks Eddie, however I only see the FTN95, FtN77 User manuals (the former being Silverfrost and the latter being Salford in Origin) and a short note on MK/MK32 which although not containing a logo appears to be part of an official doc. None of these would appear to be 'User generated' as such, as was implied in the previous comment. Maybe I'm missing somthing obvious or were you just referring to the Salford FTN77 Manual?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Apr 05, 2014 8:45 am    Post subject: Reply with quote

No, I meant http://www.silverfrost.com/manuals/clearwin.pdf

I had a go some time ago at writing a tutorial book, but long before I got finished I was distracted onto something else. Anyway, you already passed its level.

Eddie
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Wed Jun 21, 2017 9:16 pm    Post subject: Reply with quote

I'm returning to this for another requirement now. I need to READ image files (JPG, BMP and other formats) and extract RGB data pixel by pixel.

The best I can get is by using get_dib_block@ with BMP files. I can also use the same get_dib_block@ with JPG files - and in both cases I get the individual pixel R G B values out of PARRAY without a problem.

HOWEVER, this works only for small images (test image I have is 50 x 50 pixels) and a fixed array size. If I want images of unknown size - with size NX,NY determined by get_dib_size@ and then used to determine an allocatable array size PARRAY (3,NX,NY) it blows up- "Reference through NULL Fortran POINTER". I have checked and re-checked the code and can find nothing illegal. (22/6/17 - found workaround - see below - by not using /CHECK)

I wanted also to import other formats, PNG in particular. I have tried other routes to get the pixel-by-pixel data but none have worked. came to a dead end with import_image@ and import_bmp@ - it seems that the get_dib_block@ route is the only one that lets me get the data into an array, from which I cn extract individual pixels.

Any suggestions ?

Would be good to see a single general solution which handles multiple image formats and stores data in an array that is mapped to a drawing surface. What is currently available seems very inconsistent and chaotic!

Although I found a workaround by removing the /CHECK, is there something wrong with my dynamic allocation?

character(len=1),allocatable:: parray(:,:,:)
...
call get_dib_size@ (filename,nx,ny,nbbp,ierr)
...
allocate (parray(3,nx,ny),stat=istat)
...
if (allocated(parray)) deallocate (parray)

If I test istat after the allocate command, I get istat= 1 when I am expecting it to be zero - the Fortran user guide has a list of iostat values: 1 is "floating point arithmetic overflow" which is clearly not the problem here! Can't find a list of error codes for array allocation but presumably for some reason it's failing to set up the dynamic array, so maybe nothing to do with the image import.

------------------
Update 22/6/17. I noticed in ftn95.enh some mentions of problems with ALLOCATE when using /CHECK. So I removed the /CHECK and it works. But I thought those problems were supposed to have been fixed. I am using FTN95 v8.0
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Jun 22, 2017 5:24 pm    Post subject: Reply with quote

The amount of memory available with 32 bit /CHECK is more limited than in other configurations. There are no plans the "fix" this.

The failure message "Reference through NULL Fortran POINTER" could be more explicit. If you could supply a short sample program to illustrate the failure then it should be possible to sort this out.
Back to top
View user's profile Send private message AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Thu Jun 22, 2017 6:23 pm    Post subject: Reply with quote

Thanks Paul - Explanation is fine - it works OK without the /CHECK. I am sure that error message was a side effect of the ALLOCATE problem, because it's gone away now.

I have also found how to handle some other graphic formats, with a call to use_gdiplus_image_files@ - gives me TIFF and PNG and some others.

So far, so good. I just wait now until my customer tells me his graphic image file isn't in one of the GDI+ formats !
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Jul 05, 2017 10:05 pm    Post subject: Reply with quote

Silicondale, your comment and useful tip raises the question, where is the full documentation for use of "USE_GDIPLUS_IMAGE_FILES@" ?

A search on the website brings up a blank.

Item 359 in the .enh file gives a very brief description, but searching (via google) reveals several forum posts related which mention the need to include, for example:

c_external USE_GDIPLUS_IMAGE_FILES@ '__use_gdiPlusForImageFiles' (VAL):integer*4

which I can't find mention of elsewhere but forum posts.

Maybe I'm overlooking some location where the full capabilities (I've seen other mention in the .enh file) of gdiplus within FTN95 are all gathered ?
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Wed Jul 05, 2017 11:35 pm    Post subject: Reply with quote

Hi John - it's in the cwplus.enh file in item 359 (FTN95 v7.10). Works like a dream, and the beauty is you don't have to change any other coding, just put the call to this before your GET_DIB_BLOCK@ etc. The Microsoft website (google Microsoft GDI+ graphics to find the page) gives details of the other graophics files that are supported for read or write
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu Jul 06, 2017 12:46 am    Post subject: Reply with quote

it sounds very useful - now just needs all putting in the main documentation (all together all gdiplus stuff in one place) so it's formally all in one place neat and tidy like.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group