BCX Graphics Procedures - BCX Help Info 'Usage of the DrawHDC parameter'

Started by RMeyer, November 12, 2023, 02:38:51 PM

Previous topic - Next topic

RMeyer

Hello Mr. Wishlaw,
the conversion of the attached code example showed that the relevant information in BCX Help no longer applies.
Since BCX version 8.0.5 the evaluation of the DrawHDC parameter has been changed.
To use it, the 'hWnd' parameter must be set to NULL.

Richard

MrBcx

Hi Richard,

Supplying both arguments, as shown in example, was never the correct thing to do, despite BCX's
previous tolerance of it.  I have always understood that every BCX line drawing command that accepts
a HWND and a HDC argument would always receive one NULL pointer and one GDI pointer.

When I added BCX_PENSIZE, its implementation depended on that understanding, hence the recent
change in behavior.  I was unaware of the flaw in the example found in the BCX Help, so thank you
for reporting it.



Robert

Quote from: RMeyer on November 12, 2023, 02:38:51 PM
Hello Mr. Wishlaw,
the conversion of the attached code example showed that the relevant information in BCX Help no longer applies.
Since BCX version 8.0.5 the evaluation of the DrawHDC parameter has been changed.
To use it, the 'hWnd' parameter must be set to NULL.

Richard


Hi Richard:

Please be more specific about "the relevant information in BCX Help no longer applies".

Are you referring to an example, or some other information ?


MrBcx

Quote from: Robert on November 12, 2023, 05:25:21 PM
Quote from: RMeyer on November 12, 2023, 02:38:51 PM
Hello Mr. Wishlaw,
the conversion of the attached code example showed that the relevant information in BCX Help no longer applies.
Since BCX version 8.0.5 the evaluation of the DrawHDC parameter has been changed.
To use it, the 'hWnd' parameter must be set to NULL.

Richard


Hi Richard:

Please be more specific about "the relevant information in BCX Help no longer applies".

Are you referring to an example, or some other information ?

Hi Robert - Richard attached example.bas to his post.  You must be logged on to see it.

The salient part of his report is:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++
'BCX_RECTANGLE(CBHWND, 0, 0, 100, 100, C%, 1, HDc)
'BCX_RECTANGLE(CBHWND, 20, 20, 80, 80, RGB(255, 255, 0), 1, HDc)  'Works up to BCX version 8.0.4 - malfunction since BCX version 8.0.5

BCX_RECTANGLE(NULL, 0, 0, 100, 100, C%, 1, HDc)
BCX_RECTANGLE(NULL, 20, 20, 80, 80, RGB(255, 255, 0), 1, HDc)    'BCX Version 8.0.5
'+++++++++++++++++++++++++++++++++++++++++++++++++++++ 


Please refer to my earlier reply in this thread:


https://bcxbasiccoders.com/smf/index.php?topic=975.msg4974#msg4974

Robert

Quote from: MrBcx on November 12, 2023, 06:06:29 PM
Quote from: Robert on November 12, 2023, 05:25:21 PM
Quote from: RMeyer on November 12, 2023, 02:38:51 PM
Hello Mr. Wishlaw,
the conversion of the attached code example showed that the relevant information in BCX Help no longer applies.
Since BCX version 8.0.5 the evaluation of the DrawHDC parameter has been changed.
To use it, the 'hWnd' parameter must be set to NULL.

Richard




Hi Richard:

Please be more specific about "the relevant information in BCX Help no longer applies".

Are you referring to an example, or some other information ?

Hi Robert - Richard attached example.bas to his post.  You must be logged on to see it.

The salient part of his report is:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++
'BCX_RECTANGLE(CBHWND, 0, 0, 100, 100, C%, 1, HDc)
'BCX_RECTANGLE(CBHWND, 20, 20, 80, 80, RGB(255, 255, 0), 1, HDc)  'Works up to BCX version 8.0.4 - malfunction since BCX version 8.0.5

BCX_RECTANGLE(NULL, 0, 0, 100, 100, C%, 1, HDc)
BCX_RECTANGLE(NULL, 20, 20, 80, 80, RGB(255, 255, 0), 1, HDc)    'BCX Version 8.0.5
'+++++++++++++++++++++++++++++++++++++++++++++++++++++ 


Please refer to my earlier reply in this thread:


https://bcxbasiccoders.com/smf/index.php?topic=975.msg4974#msg4974

Hi MrBCX:

QuoteYou must be logged on to see it.
Been there. Done that.

QuoteI was unaware of the flaw in the example found in the BCX Help, so thank you
for reporting it.

What example ?


MrBcx

QuoteWhat example?

The example that MrBcx wrongly assumed was in the BCX Help file but upon closer
scrutiny finds the example provided by Mr. Meyer sought only to demonstrate the
need to strengthen the messaging concerning arguments that need to be passed as NULLs.

My apologies for muddying already murky waters.  This will help ...

From the BCX Help:


BCX_RECTANGLE function
Purpose : BCX_RECTANGLE draws a rectangle, optionally filling it.
Syntax:
RetVal% = BCX_RECTANGLE(hWnd, _
                        Left%, _
                         Top%, _
                       Right%, _
                      Bottom%, _
                     [, Pen%]  _
                     [,Fill%]  _
                  [, DrawHDC])

Parameters:
    hWnd Identifies the window where drawing takes place.
    ☞ If printing to a hWnd, the DrawHDC parameter, below, is not used.


The above phrase appears a number of times throughout the BCX Graphics section.

Robert

Quote from: MrBcx on November 12, 2023, 06:54:04 PM
QuoteWhat example?

The example that MrBcx wrongly assumed was in the BCX Help file but upon closer
scrutiny finds the example provided by Mr. Meyer sought only to demonstrate the
need to strengthen the messaging concerning arguments that need to be passed as NULLs.

My apologies for muddying already murky waters.  This will help ...

From the BCX Help:


BCX_RECTANGLE function
Purpose : BCX_RECTANGLE draws a rectangle, optionally filling it.
Syntax:
RetVal% = BCX_RECTANGLE(hWnd, _
                        Left%, _
                         Top%, _
                       Right%, _
                      Bottom%, _
                     [, Pen%]  _
                     [,Fill%]  _
                  [, DrawHDC])

Parameters:
    hWnd Identifies the window where drawing takes place.
    ☞ If printing to a hWnd, the DrawHDC parameter, below, is not used.


    hWnd Identifies the window where drawing takes place.
    ☞ If printing to a hWnd, the DrawHDC parameter, below, is not used.


Yes, that was my suspicion as well, but I hoped that Richard would clarify his statement so that something, perhaps, would not be left undone.

Unfortunately, the NULL argument in the first parameter is not universally required post 8.0.4, for example the BCX_FLOODFILL demo compiles and works with BCX 8.0.7. 

So there's more to this than nullthing.

MrBcx


MrBcx

The BCX_FLOODFILL statement in the "Persistent Graphics Using Dynamic Bitmaps" BCXHelp 8.0.6
demo is outdated and will not compile, as is.

This is the corrected statement:

BCX_FLOODFILL(0, 0, 0, RGB(RND * 255, RND * 255, RND * 255), RGB(RND * 255, RND * 255, RND * 255), TRUE, hDestDC)


RMeyer

Hi Mr. BCX and Mr. Wishlaw,

First of all, I apologize for the inaccuracies in my post and of course thank you for your feedback, which I receive with a time delay in Germany.
Nothing has been forgotten.
Richard

Robert

Quote from: MrBcx on November 13, 2023, 10:01:46 AM
The BCX_FLOODFILL statement in the "Persistent Graphics Using Dynamic Bitmaps" BCXHelp 8.0.6
demo is outdated and will not compile, as is.

This is the corrected statement:

BCX_FLOODFILL(0, 0, 0, RGB(RND * 255, RND * 255, RND * 255), RGB(RND * 255, RND * 255, RND * 255), TRUE, hDestDC)

I thank you for the correction, MrBCX.

Now into the analysis, which goes something like this. W.T.F? This used to work. How was this broken? When? Why?

MrBcx

Quote from: Robert on November 13, 2023, 10:36:18 AM

I thank you for the correction, MrBCX.

Now into the analysis, which goes something like this. W.T.F? This used to work. How was this broken? When? Why?

Robert -- BCX_FLOODFILL change was documented in the 8.0.6 Revisions.txt:

https://bcxbasiccoders.com/smf/index.php?topic=937.0


Kevin Diggins  : BCX_FLOODFILL's argument list was inconsistent with the other BCX graphics
                 commands, in that the optional HDC was not the last argument.  I swapped
                 the last two arguments to bring it into conformance.  This change might
                 require BCX programmers to update their source code.  This will become
                 obvious when a c\c++ compiler detects conflicts with BCX_FLOOD's arguments.


Robert

Quote from: MrBcx on November 13, 2023, 11:12:07 AM
Quote from: Robert on November 13, 2023, 10:36:18 AM

I thank you for the correction, MrBCX.

Now into the analysis, which goes something like this. W.T.F? This used to work. How was this broken? When? Why?

Robert -- BCX_FLOODFILL change was documented in the 8.0.6 Revisions.txt:

https://bcxbasiccoders.com/smf/index.php?topic=937.0


Kevin Diggins  : BCX_FLOODFILL's argument list was inconsistent with the other BCX graphics
                 commands, in that the optional HDC was not the last argument.  I swapped
                 the last two arguments to bring it into conformance.  This change might
                 require BCX programmers to update their source code.  This will become
                 obvious when a c\c++ compiler detects conflicts with BCX_FLOOD's arguments.


Thanks for this, MrBCX, although I applied the changes to the BCX_FLOODFILL section, I neglected to look for other instances of use of BCX_FLOODFILL in other parts of the Help file. I think that trying to understand and document your new graphics functions in 8.0.6 had a higher priority so complete housekeeping of BCX_FLOODFILL was left undone.

MrBcx

Quote from: Robert on November 13, 2023, 02:47:59 PM

Thanks for this, MrBCX, although I applied the changes to the BCX_FLOODFILL section, I neglected to look for other instances of use of BCX_FLOODFILL in other parts of the Help file. I think that trying to understand and document your new graphics functions in 8.0.6 had a higher priority so complete housekeeping of BCX_FLOODFILL was left undone.

In the immortal words of the George Carlin,

"Don't sweat the petty stuff and don't pet the sweaty stuff"