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 

.pcx support
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Tue Sep 21, 2010 1:40 am    Post subject: Reply with quote

Paul,

I looked in Wikipedia at .gif. It claims that the .gif file uses 256 colours in an indexed table.
It appears to me that the colour table used in .gif files created in clearwin+ is fixed and not based on the colour pallete in use on the screen. What I would like is that the .gif writer could choose a better colour palette. My reference, "Wikipedia" does not indicate that the colour table is fixed, although if I write a .gif file in Microsoft Paint, it doesn't appear to select a most suitable palette either.
I have written a routine, which finds all possible colours on the screen and the pixel count for each colour. I start the colour index by giving my pre-defined 120 colours then add new ones as I go. I would need to modify this to limit the number of active colours to 256 then provide an index number (0-255) for each active colour, by choosing the closest colour for those above colour 255. My recomendation is to use the 256 colours with the highest pixel count.
Is it possible to include in the .gif writer the ability to select the colour palette based on the colours that most often appear on the screen.
This could be as an option, say Set_GIF_Colour_Palette (ncol, RGB_LIST).
The code I have written is almost there

Code:
       subroutine report_region_colours
!
!   Routine to report the number of active colours for the current window
!
    include <clearwin.ins>
    include 'crtcom.ins'
!
      integer*4 width, height, hor, ver
      integer*4 ncol, i, values(1024), count(1024), value, white
      integer*1 vv(4)
      equivalence (value, vv)
!
      call GET_GRAPHICAL_RESOLUTION@ ( WIDTH, HEIGHT )
!
!  tone_map(1:200), max_tone,
      ncol = max_tone
      if (ncol>0) values(1:max_tone) = tone_map(1:max_tone)
      count = 0
      white = values(1)
!
      do hor = 0,width-1
         do ver = 0,height-1
!
            call GET_RGB_VALUE@ ( HOR, VER, VALUE )
!
            do i = 1,ncol
               if (value /= values(i)) cycle
               count(i) = count(i) + 1
               exit
            end do
            if (i > ncol .and. ncol < 1024) then
               ncol = i
               values(i) = value
               count(i)  = 1
            end if
            if (i <= max_tone) call draw_point@ ( HOR, VER, white )
!
         end do
      end do
!
      write (98,9001) width, height, max_tone+1, ncol
9001  format (/' Statistics of Screen Dump Colours'/  &
               ' Horizontal resolution  ',i6/         &
               ' Vertical resolution    ',i6/         &
               ' Number of defined colours',i4/       &
               ' Number of active colours',i5/        &
               '  Id Colour  Count')
      do i = 1,ncol
         value = values(i)
         write (98,9002) i, vv(1:3), count(i)
      end do
9002  format (i4,3o5,2i7)
!
      end

I could also change this to limit the number of colours on the screen to 255, if .gif writer then used a dynamic palette.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Sep 22, 2010 12:43 am    Post subject: Reply with quote

Paul,

I have now written a pre-dump scanner of the active graphics region that limits the number of active colours to less than 256. There are lots of pixels around text which use a colour only for a few pixels on the screen. Presumably this is some kind of colour merging to better shape the text. The program above helps identify the location of these pixels.
I'm not asking for any change to this as it is easy to group and re-colour these to a near active colour, reducing the number of colours to < 256. The image and text does not appear to change noticeably.
All that is now needed is for the clearwin+ .gif dump utility "write_graphics_to_gif@" to use a colour palette based on the active colours, rather than a pre-defined palette. Is that change a possibility ?

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, 3
Page 3 of 3

 
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