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 

Clearwin colors

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
jcherw



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Tue Mar 05, 2019 1:38 pm    Post subject: Clearwin colors Reply with quote

I lifted below test program out of a large code to get a handle on clearwin which was not behaving well when I compiled my code 64 bit (it basically showed a black rectangle obscuring the black text)

When I compile below test code win 32 it shows a black rectangle if I use the
the original draw_filled_rectangle statements and a green rectangle if I use the tweaked version (guessed the tweaked number).

I have 2 questions

1- Why is the original part of the code (thats works within the larger program) not working, and

2- Could someone perhaps point me to the section of the Clearwin manual that explains the coloring for draw rectangle

Thanks,

Quote:

PROGRAM main

use clrwin

implicit none

INTEGER winio@, ans

ans=winio@('%ww[no_maxminbox]&')
ans=winio@('%bg[grey]&')
ans=winio@('%sp&',0L,0L)
ans=winio@('%gr[rgb_colours]&',800,570)

call set_rgb_colours_default@(0)

call set_line_width@(2)

! Original draw filled rectangle statements
! call draw_filled_rectangle@(196,146,605,286,7)
! call draw_filled_rectangle@(191,151,600,291,15)

! Tweaked draw filled rectangle statements
call draw_filled_rectangle@(196,146,605,286,1671168)
call draw_filled_rectangle@(191,151,600,291,1671168)

call draw_rectangle@(191,151,600,291,4)
call draw_rectangle@(194,154,597,288,1)
call size_in_pixels@(21,12)
call bold_font@(1)
call draw_characters@('** Initialisation **',275,235,4)
call set_line_width@(1)

ans=winio@(' ') ! added this to draw the thing

END PROGRAM main
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 197
Location: Hamilton, Scotland.

PostPosted: Tue Mar 05, 2019 1:50 pm    Post subject: Reply with quote

I would start by replacing your 'tweeked' numbers with a call to:
Code:
RGB@(RED,GREEN,BLUE)

Where RED, GREEN, and BLUE are integers in the range 0 to 255.

eg RGB@(255,0,0) generates RED.
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Tue Mar 05, 2019 3:34 pm    Post subject: Reply with quote

Joost,

For a very long time, CW+ had the original 16 colour VGA setup as its default. Some versions ago, Paul realised that the world had moved on, and changed the default to the RGB mode where you can set all colours to have R, G and B components in the range 0..255 inclusive.

The routine SET_RGB_COLOURS_DEFAULT@ with a parameter 0 is used to select the VGA 16 colour mode, and with parameter 1 to select RGB colour mode. Then, you use a different method for VGA or RGB colour modes. The VGA mode is utter rubbish, and modern software should use RGB mode. You get the colour number with the routine RGB@.

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



Joined: 27 Sep 2018
Posts: 49
Location: Australia

PostPosted: Wed Mar 06, 2019 1:37 am    Post subject: Reply with quote

My legacy code works firn under 32 bit with the VGA 16 color schema, but does not work with 64 bit.

I tried to use SET_RGB_COLOURS_DEFAULT@ with a parameter 0 but that did not get the proper result either.

So it is probably better to goto the RGB color pallete.

As I have quite a few colors hardwired in the code.

It would be very useful to have a conversion from the clearwin VGA 16 to RGB.

I tried the corresponding RGB codes for the Microsoft Windows default 16-color palette from https://en.wikipedia.org/wiki/List_of_software_palettes but that did not work out.

Could anyone please point me to the correct conversion table.
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Wed Mar 06, 2019 11:27 am    Post subject: Reply with quote

Hi Joost,

Black is RGB@(0,0,0) and white is RGB@(255,255,255). Silver and grey have the three colours in the same anounts (less for grey, more for silver). Lime is (0,255,0), red (255,0,0) and blue (0,0,255).

Look here, not quite halfway down the page:

https://www.rapidtables.com/web/color/RGB_Color.html

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



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

PostPosted: Thu Mar 07, 2019 8:33 pm    Post subject: Reply with quote

... a table which begs the wuestion 'why is green not green, but 'lime' ?'
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Thu Mar 07, 2019 8:36 pm    Post subject: Reply with quote

Joost wrote:
Quote:
My legacy code works firn under 32 bit with the VGA 16 color schema, but does not work with 64 bit.

so if this is the case doesn't this mean the defaut isn't the same for 32bit and 64bit ? and that default for 32bit is still VGA ?
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Thu Mar 07, 2019 9:52 pm    Post subject: Reply with quote

Because the code contains:

Code:
call set_rgb_colours_default@(0)


Zero means 'False' and 1 means 'True'

Eddie
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
Page 1 of 1

 
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