replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Unwished colour change, doing plots
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 

Unwished colour change, doing plots

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Felin



Joined: 29 Jul 2009
Posts: 7
Location: Erlangen, Germany

PostPosted: Wed Jul 29, 2009 1:47 pm    Post subject: Unwished colour change, doing plots Reply with quote

To do plots, I can choose 6 parameters in a second window which are plotted against the time. It works like this: pressing the Plot-Button to get from the main window to the second window. Then pressing there the "Y-Values"-Button I can choose up to 6 parameters for the y-axis. Pressing Exit, I come again to the Plot-window. Then pressing "Plot" I get the graphs and everything is perfect. But again choosing some different (or the same) "Y-Values", and pressing "Plot" again, the colours of the plots get strange: very dark most of the time almost black and no differences between the graphs can be seen can be seen.

The colours are defined like this:
Code:
     
      CALL USE_APPROXIMATE_COLOURS@(0)
      COLOUR(0)=RGB@(0,0,0)
      COLOUR(1)=RGB@(255,0,0)
      COLOUR(2)=RGB@(100,255,0)
      COLOUR(3)=RGB@(0,0,255)
      COLOUR(4)=RGB@(255,0,255)
      COLOUR(5)=RGB@(255,150,0)
      COLOUR(6)=RGB@(0,255,255)


Then the line is made like this (NGRAPHS can be from 1 to 6, depending on how many parameters have been chosen):
Code:
         
         DO 30000 J=1,NGRAPHS
         ...
         CALL CHANGE_PEN@(HDC,PS_SOLID,1,COLOUR(J))
         CALL MOVETOEX(HDC,IX1,IY1,0)
         CALL LINETO(HDC,IX2,IY2)
C         CALL DRAW_LINE(HDC,IX1,IY1,IX2,IY2,COLOUR(J))


Calling the self defined subroutine "DRAW_LINE" which contains the same commands produces a run-time error (but I've got an older, simpler version of the program where everything works just like that).
Calling "DRAW_LINE@" makes all the lines in the wrong window, sometimes at the wrong place as well and in random colours.

It would be great if someone could help me with this problem:)

Thanks,

Flo.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 29, 2009 1:55 pm    Post subject: Reply with quote

I would need more details but note that at some point in time, DRAW_LINE@ became DRAW_LINE_BETWEEN@ so this may be the source of your problem.
Back to top
View user's profile Send private message AIM Address
Felin



Joined: 29 Jul 2009
Posts: 7
Location: Erlangen, Germany

PostPosted: Wed Jul 29, 2009 2:07 pm    Post subject: Reply with quote

DRAW_LINE_BETWEEN@ also makes all the graphs in the wrong window.

The plot-window is basically created like that:
Code:

      XRES=GETSYSTEMMETRICS(SM_CXSCREEN)*0.7
      YRES=GETSYSTEMMETRICS(SM_CYSCREEN)*0.7
      HDC=GET_BITMAP_DC@(XRES,YRES)
      A=WINIO@('%CA[NLOOP PLOT PROGRAM]&')
      A=WINIO@('%MN[&FILE[E&XIT]]&','EXIT')
      A=WINIO@('%MN[&HELP[&ABOUT CLEARWIN+ PLOT]]&',ABOUT_FUNCTION)
      A=WINIO@('%NL%NL%RJ%10^BT[Y-ACHSE]&',MYFUNC)
      A=WINIO@('%TA%10ST&',YVALU1)
      A=WINIO@('%NL%RJ%10ST&',YVALU2)
      A=WINIO@('%NL%RJ%10ST&',YVALU3)
      A=WINIO@('%NL%RJ%10ST&',YVALU4)
      A=WINIO@('%NL%RJ%10ST&',YVALU5)
      A=WINIO@('%NL%RJ%10ST&',YVALU6)
      A=WINIO@('%NL%NL%RJXMIN%TA%RF&',XMIN)
      A=WINIO@('%NL%RJXMAX%TA%RF&',XMAX)
      A=WINIO@('%NL%NL%RJYMIN%TA%RF&',YMIN)
      A=WINIO@('%NL%RJYMAX%TA%RF&',YMAX)
      A=WINIO@('%NL%NL%NL%NL%RJ%10`^BT[&PLOT]&',PLOT_FUNCTION)
      A=WINIO@('%NL%NL%RJ%10^BT[E&XIT]&','EXIT')
      A=WINIO@('%NL%NL%RJ%10^BT[P&RINT]&',PRINTD)
      A=WINIO@('%AP%OB%DW%CB&',0L,0L,HDC)
      A=WINIO@('%WW[MAXIMIZE]%FF')
        CALL WINDOW_UPDATE@(XVALU)
        CALL WINDOW_UPDATE@(YVALU1)
        CALL WINDOW_UPDATE@(YVALU2)
        CALL WINDOW_UPDATE@(YVALU3)
        CALL WINDOW_UPDATE@(YVALU4)
        CALL WINDOW_UPDATE@(YVALU5)
        CALL WINDOW_UPDATE@(YVALU6)
      END


And this is the subroutine which worked in the old version but doesn't work any more:
Code:

       SUBROUTINE DRAW_LINE(THIS_HDC,IX1,IY1,IX2,IY2,COLOUR)
C
C     *****************************************************
C     *                                                   *
C     *    DRAW A LINE OF A GIVEN COLOUR ON TO AN HDC     *
C     *    ACQUIRED VIA GET_BITMAP_DC@                    *
C     *                                                   *
C     *****************************************************
C
C      USE MSWIN
        include <windows.ins>
      INTEGER*4   IX1,IY1,IX2,IY2,COLOUR
      INTEGER*4   THIS_HDC
      INTEGER*4   K
      LOGICAL L
C      USING CHANGE_PEN@ MEANS THAT THE SYSTEM WILL TAKE CARE OF
C      DELETING THE PENS AFTER USE. 
C      CHANGE_PEN@ IS AN ASSOCIATED WINIO@ FUNCTION.
       K=CHANGE_PEN@(THIS_HDC,PS_SOLID,1,COLOUR)
C      THE FOLLOWING TWO FUNCTION CALLS ARE STANDARD WINDOWS SDK CALLS
C      MOVETO AND LINETO ARE STANDARD WINDOWS SDK CALLS
       L=MoveToEx(THIS_HDC,IX1,IY1,0)           
       L=LINETO(THIS_HDC,IX2,IY2)
C       CALL DRAW_LINE_BETWEEN@(IX1,IY1,IX2,IY2,COLOUR)
       END


and was called like that
Code:

            CALL DRAW_LINE(HDC,IX1,IY1,IX2,IY2,COLOUR(J))
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 29, 2009 3:56 pm    Post subject: Reply with quote

OK, it looks like you are using Microsoft API calls to draw the line rather than draw_line@ or draw_line_between@ both of which are FTN95 intrinsics. draw_line (without an @) is a routine defined in your code.

Now we need to see the function PLOT_FUNCTION to see how the HDC is being generated.
Back to top
View user's profile Send private message AIM Address
Felin



Joined: 29 Jul 2009
Posts: 7
Location: Erlangen, Germany

PostPosted: Thu Jul 30, 2009 7:58 am    Post subject: Reply with quote

Yes, but only because it didn't work. The programmer obviously tried to use the "Draw_line_between"-command which apparently didn't work.

It's a good question how the HDC is being generated. It is declared in the plot_function but never really mentioned there, except 1 time with CALL WINDOW_UPDATE@(HDC) at the end. I suppose it's being generated just at the beginning with "HDC=GET_BITMAP_DC@(XRES,YRES)" while
"XRES=GETSYSTEMMETRICS(SM_CXSCREEN)*0.7" and YRES analog. The PLOT_FUNCTION calls a subroutine which clears the bitmaps (CLEAR_BITMAP@(HDC)) and then does the graphs...

I hope that this helps a bit.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Jul 30, 2009 8:33 am    Post subject: Reply with quote

I don't think that I can solve this one without having all of the code.
Perhaps someone else can help.

If you want to send me all of the code, I may have to charge you if I can fix the problem.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Fri Jul 31, 2009 8:21 pm    Post subject: Reply with quote

I have a lot of sympathy for your predicament, because you have fallen into a trap that I fell into many years ago. You are using an "owner draw box" (%dw) not a %gr graphics region. %dw creates a graphics area in which many of the nice graphics functions in Clearwin don't work! (for example, DRAW_LINE_BETWEEN@). Instead, you should create a %gr AND you should use RGB colours - then suddenly all the graphics subroutines work.

The trap is that there is a big chunk of FTN95.CHM that tells you how to use %dw, together with some example code (that you seem to have re-used - e.g. the subroutine DRAW_LINE). The instructions on %gr are (at first) rather more difficult to find and to follow - but persevere and you will be amazed at how much better %gr is!

You may get advice from some other forum user to use OpenGL (%og). This is even better than %gr in terms of the effects you can achieve, but much harder to get started with.

I fell into the trap of using %dw because (for some reason I can't remember now) I thought it was compatible with the graphics system that Salford FTN77 used before it was Windows-compatible, and I wanted a quick fix. Maybe it is because the example I followed used %dw. At any rate, if you use %dw you will forever be unhappy with the result!

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



Joined: 29 Jul 2009
Posts: 7
Location: Erlangen, Germany

PostPosted: Mon Aug 03, 2009 11:42 am    Post subject: Reply with quote

Thank you a lot! Everything just works perfect with your tips (I've used %gr) now. Very Happy Some text-position and text-font had to be adjusted, but that was all.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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