View previous topic :: View next topic |
Author |
Message |
johannes
Joined: 21 Jan 2011 Posts: 65 Location: Leimen, Germany
|
Posted: Fri Aug 29, 2014 8:02 am Post subject: png settings? |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7933 Location: Salford, UK
|
Posted: Fri Aug 29, 2014 2:35 pm Post subject: |
|
|
No. ClearWin+ does not have a facility to adjust the png output. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Fri Aug 29, 2014 10:16 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7933 Location: Salford, UK
|
Posted: Sat Aug 30, 2014 6:29 am Post subject: |
|
|
There is sample program in ftn95.chm under
Win32 Platform->ClearWin+->Graphics->Drawing Device Independent Bitmaps |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Sat Aug 30, 2014 8:48 am Post subject: |
|
|
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 |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Sat Aug 30, 2014 9:50 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Sat Aug 30, 2014 10:21 pm Post subject: |
|
|
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 |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Sun Aug 31, 2014 1:46 pm Post subject: |
|
|
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 |
|
|
|