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 

How to create a png file from array data?
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
johannes



Joined: 21 Jan 2011
Posts: 65
Location: Leimen, Germany

PostPosted: Fri Aug 29, 2014 8:02 am    Post subject: png settings? Reply with quote

Additional question:
Can we somehow set parameters to modify the .png output, like setting an alpha value (Transparency) or b/w vs. color output?
BR
Johannes
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Aug 29, 2014 2:35 pm    Post subject: Reply with quote

No. ClearWin+ does not have a facility to adjust the png output.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Aug 29, 2014 10:16 pm    Post subject: Reply with quote

By the way, when you read the graphics file into DIB block say like this

call get_dib_block@(BitmapFile, A, imdim,imdim,0,0,hres,vres,0,0,ier)

how original RGB of the BitmapFile are coded inside the array A(3,imdim,imdim) ?

Is it RGB_inside_A = Real_RGB - 128 or something like that?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Aug 30, 2014 6:29 am    Post subject: Reply with quote

There is sample program in ftn95.chm under

Win32 Platform->ClearWin+->Graphics->Drawing Device Independent Bitmaps
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat Aug 30, 2014 8:48 am    Post subject: Reply with quote

I think the FTN95 help is still missing that detail. Or I miss it as usually.
After DIB is loaded into array A(3,ixsize,iysize) all the values in A are "distorted" and lie not in 0 to 255 range but in -127 to +127 one (why? It's the same 1 byte size...). If you look into array with the debugger it is full of -1 numbers. I did conversion to normal 256 range before but forgot details and couldn't quickly find anything. So DIB pushes me to switch on my rusty brain to get shadowy reasoning behind all that kitchen. By common sense one of variants is that the actual normal human RGB value "RGB_256" in the scale 0-255 and loaded RGB_127 which is in -127 -- +127 range
RGB_256 = RGB_127 if number is positive and
RGB_256 = 255 - RGB_127 if RGB_127 is negative ...or 256-RGB_127...
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sat Aug 30, 2014 9:50 am    Post subject: Reply with quote

Dan,

The valid range of colour values is 0 to 255, where 255 is equivalent to -1 in an integer*1 variable. While it is easy to store 255 in an integer*1 variable, it is more difficult to go the opposite way, such as:
I_4 = ib_1 ; if ( I_4 < 0) I_4 = I_4 + 256

It would be good to use a variable type BYTE, which is an unsigned integer, although it gets difficult when testing the difference between two byte variables, such as byte subtraction ib_1 - jb_1 ; where jb_1 is greater than ib_1.

The FTN95 address space documentation refers to an unsigned 32 bit integer, which would be equivalent to a byte*4 variable type.

The DIB array could be conveniently be declared as:
BYTE*1, dimension(:,:,:), allocatable :: image
or
BYTE*3, dimension(:,:), allocatable :: image

The use of CHARACTER offers some simplification for BYTE functionality, by requiring CHAR and ICHAR transformation.

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



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat Aug 30, 2014 10:21 pm    Post subject: Reply with quote

Thanks, John, I took Integer*1 for DIB storage as above and when compared its content with the color from "more human" 0-255 world I transformed latter into into +/- 127 one this way

iRrgb127 = iRrgb256
if(iRrgb127.gt.128) iRrgb127 = iRrgb256-256

Hopefully no errors here since it works on few examples
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sun Aug 31, 2014 1:46 pm    Post subject: Reply with quote

Dan,

I like the use of a character array and using ICHAR and CHAR to transfer data, without the problem of INTEGER*1 overflow.

John
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