Jump to content
Advert

Recommended Posts

Posted
1 hour ago, WildByDesign said:

According to help file, default isĀ $CCS_TOP, $RBS_VARHEIGHT

You're right, the help file should be amended, here is what it stipulates :

Function Reference
_GUICtrlRebar_Create
Create a Rebar control

#include <GuiReBar.au3>
_GUICtrlRebar_Create ( $hWnd [, $iStyles = 0x513] )
...
Default styles: $CCS_TOP, $RBS_VARHEIGHT
Forced styles: $WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS

As you noticed, 0x513 doesn't correspond at all to BitOr($CCS_TOP, $RBS_VARHEIGHT), that's why the help file should be amended, because the default styles indicated in the help file doesn't equal 0x513

In fact, if we create a rebar control without indicating any style, it is created... at the bottom of the Gui with the following styles :

Local $hReBar = _GUICtrlRebar_Create($hGUI)

Control Viewer => 0x56000513 = CCS_BOTTOM, CCS_NOHILITE, RBS_TOOLTIPS, RBS_BANDBORDERS, WS_CHILD, WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN

[0x40000000, 'WS_CHILD'], _
[0x10000000, 'WS_VISIBLE'], _
[0x04000000, 'WS_CLIPSIBLINGS'], _
[0x02000000, 'WS_CLIPCHILDREN'], _

[0x0400, 'RBS_BANDBORDERS'], _
[0x0100, 'RBS_TOOLTIPS']]
[0x0010, 'CCS_NOHILITE'], _
[0x0003, 'CCS_BOTTOM'], _

0x513 seems to correspond to BitOr($RBS_BANDBORDERS, $RBS_TOOLTIPS, $CCS_NOHILITE, $CCS_BOTTOM)

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Advert
Posted
18 minutes ago, pixelsearch said:

In fact, if we create a rebar control without indicating any style, it is created... at the bottom of the Gui with the following styles :

I noticed this as well. Many users would likely run it without the extra parameters with the assumption of getting default values.

I started to realize that maybe I am the only one to create a Rebar control in the last decade. 🤣

Posted
3 hours ago, WildByDesign said:

I'm not sure if this is the right place to report a bug with a function from the standard UDFs, but I've got a bug inĀ _GUICtrlRebar_Create.

;Func _GUICtrlRebar_Create($hWnd, $iStyles = 0x513)
Func _GUICtrlRebar_Create($hWnd, $iStyles = BitOR($CCS_TOP, $RBS_VARHEIGHT))
    Local Const $ICC_BAR_CLASSES = 0x00000004 ; toolbar
    Local Const $ICC_COOL_CLASSES = 0x00000400 ; rebar

    Local $iStyle = BitOR($__GUICTRLCONSTANT_WS_CHILD, $__GUICTRLCONSTANT_WS_VISIBLE, $__REBARCONSTANT_WS_CLIPCHILDREN, $__REBARCONSTANT_WS_CLIPSIBLINGS)
    If $iStyles <> BitOR($__REBARCONSTANT_CCS_TOP, $RBS_VARHEIGHT) Then
        $iStyle = BitOR($iStyle, $iStyles)
    Else
        $iStyle = BitOR($iStyle, $__REBARCONSTANT_CCS_TOP, $RBS_VARHEIGHT)
    EndIf

    Local $tICCE = DllStructCreate('dword;dword')
    DllStructSetData($tICCE, 1, DllStructGetSize($tICCE))
    DllStructSetData($tICCE, 2, BitOR($ICC_BAR_CLASSES, $ICC_COOL_CLASSES))

    Local $aCall = DllCall('comctl32.dll', 'int', 'InitCommonControlsEx', 'struct*', $tICCE)
    If @error Then Return SetError(@error, @extended, 0)
    If $aCall[0] = 0 Then Return SetError(-2, 0, 0)

    Local $nCtrlID = __GuiCtrl_GetNextGlobalID($hWnd)
    If @error Then Return SetError(@error, @extended, 0)

    Local $hReBar = _WinAPI_CreateWindowEx(0, $__REBARCONSTANT_ClassName, "", $iStyle, 0, 0, 0, 0, $hWnd, $nCtrlID)
    If @error Then Return SetError(-1, -1, 0)

    Return $hReBar
EndFunc   ;==>_GUICtrlRebar_Create

According to help file, default isĀ $CCS_TOP, $RBS_VARHEIGHT

Notice how the original Func line (commented out) has 0x513 as default. Well, I'm guessing that does not equal the BitOR for those two values. I added the Func line below that with the BitOR and that seems to go through the function properly and work as intended.

true never change since 2007 introduction

Posted
4 hours ago, WildByDesign said:

I'm not sure if this is the right place to report a bug with a function from the standard UDFs,

Yes and no.Ā autoit-technical-discussionĀ is the right place.
This thread is for the help file.
To add an issue with a standard function, you'd open a new thread here inĀ autoit-technical-discussionĀ named something like: "_GUICtrlRebar_Create() don't work like it used to 😢" (Ā Or something like that šŸ˜… )
..because as you can see, as we start going down the rabbit's hole, we take over the thread :)Ā 

Follow the link to my code contributionĀ ( and other things too ).
FAQ -Ā Please Read Before PostingĀ Ā image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted (edited)

ObjEvent ( "AutoIt.Error" [, "function"] )
...If the second parameter is omitted, it will return a string containing the name of the current Error handler function. If no Error handler function has been set, it will return an empty string.

If ObjEvent("AutoIt.Error") = "" And FuncName(ObjEvent("AutoIt.Error")) = "" Then $oMyError = ObjEvent("AutoIt.Error", MyProjectErrFunc)

Should we add that if the function name is not a string we should check for the FuncName ?
Since the help was written before the need to encapsulate the function as a string, ... .
Maybe:Ā it will return a string containing the name of the current Error handler function. and remove the "string" detail ?

P.S.: ..the detail came up scriptingĀ zip-your-project-nicely and I had to think of why wasn't it returning a string.

Ā 

Edited by argumentum

Follow the link to my code contributionĀ ( and other things too ).
FAQ -Ā Please Read Before PostingĀ Ā image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted

@jpm AutoIt actual release 3.3.18.0 : wrong error codes in help file for both functions _GDIPlus_ImageResize() and _GDIPlus_ImageScale()

This is what we read actually, but it corresponds to older code of AutoIt (checked) :

_GDIPlus_ImageResize() - @error:
1 - unable to create new bitmap
2 - unable to create graphics context
3 - unable to set interpolation mode on graphics context
4 - unable to copy image to scaled bitmap


_GDIPlus_ImageScale - @error:
1 - unable to get width of image
2 - unable to get height of image
3 - unable to create new bitmap
4 - unable to create graphics context
5 - unable to set interpolation mode on graphics context
6 - unable to copy image to scaled bitmap

In version 3.3.18.0, both functions should indicate these 4 error codes :

1 - unable to get width of image
2 - unable to get height of image
3 - unable to create new bitmap
4 - error from __GDIPlus_ImageAttributesSetImageWrapMode()

Maybe @UEZ would like to rephrase error #4 to make it more understandable, thanks.

Also let's not forget the important missing line in code (to avoid memory leak) in _GDIPlus_ImageResize(), confirmed by UEZ in this link.

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

Error return value fromĀ __GDIPlus_ImageAttributesSetImageWrapMode() according to MS can be:

Global Enum $Ok = 0, $GenericError, $InvalidParameter, $OutOfMemory, $ObjectBusy, $InsufficientBuffer, _
    $NotImplemented, $Win32Error, $WrongState, $Aborted, $FileNotFound, $ValueOverflow, $AccessDenied, _
    $UnknownImageFormat, $FontFamilyNotFound, $FontStyleNotFound, $NotTrueTypeFont, _
    $UnsupportedGdiplusVersion, $GdiplusNotInitialized, $PropertyNotFound, $PropertyNotSupported, $ProfileNotFound

Ā 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best! ✌
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
ĀÆ\_(惄)_/ĀÆĀ  Ł©(ā—Ģ®Ģ®Ģƒā€¢Ģƒ)Ū¶ Ł©(-̮̮̃-̃)۶ૐ

Posted

Hello everybody :)
Help file topic GUICtrlCreatePic, this is what we read :

Style [optional] Defines the style of the control.
default (-1) : $SS_NOTIFY
forced style : $SS_BITMAP | $SS_CENTERIMAGE

If not mistaken, $SS_CENTERIMAGE shouldn't be mentioned. This is what AutoIt window info tool, WinSpy, or Yashied's tool indicate, when you run "example 1" found at topic GUICtrlCreatePic :

Style : 0x5002010E
SS_BITMAP, SS_NOTIFY, WS_CHILD, WS_VISIBLE, WS_GROUP

[0x40000000, 'WS_CHILD']
[0x10000000, 'WS_VISIBLE']
[0x00020000, 'WS_MINIMIZEBOX | WS_GROUP'] ; GUI | Control
[0x00000100, 'SS_NOTIFY']
[0x0000000E, 'SS_BITMAP']

picstyles.png.556c9624143b1b9dbe2f65166c0dd2fc.png

$SS_CENTERIMAGE is 0x0200 and doesn't seem to be present in the pack.
Thanks for reading and have a great day.

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

@UEZ hello :)
Help file function _GDIPlus_GraphicsSetSmoothingMode

Parameters
$hGraphics : Handle to a Graphics object
$iSmooth   : Smoothing mode:
    0 - Smoothing is not applied
    1 - Smoothing is applied using an 8 X 4 box filter
    2 - Smoothing is applied using an 8 X 8 box filter

Please have a look at the example found in the help file and let's modify this line ;

; original line found in the example :
; _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;set smoothing mode (8 X 4 box filter)

; modified line as per help file indication :
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 1)

Now when you run the example, it will MsgBox twice "Smoothing enabled: 0" and both lines are aliased... which is correct as 1 means $GDIP_SMOOTHINGMODE_HIGHSPEED (smoothing is not applied).

Do you think the help file should be amended ?
Thanks

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted (edited)

Hi,

what must be amend is the $iSmooth setting be and the other too

$GDIP_SMOOTHINGMODE_HIGHQUAaannLITY (1) - Smoothing is applied using an 8 X 4 box filter
Edited by jpm
Posted

Hello Jean-Paul :)

It seems a bit more complicated (at least for me) especially after having checked GdiPlusEnums.h , the constants found on msdn and GDIPlusConstants.au3, both topics _GDIPlus_GraphicsSetSmoothingMode() and _GDIPlus_GraphicsGetSmoothingMode() found in the help file, and the 2 corresponding functions found on msdn.

Wishing you the best to fix the help file as it should be.
Thanks and have a super great day !

Ā 

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

Hi again Jean-Paul :)

GDIPlusConstants.au3 (corresponds to msdn constants) :

; Graphic SmoothingMode constants
Global Const $GDIP_SMOOTHINGMODE_INVALID = -1 ; Reserved.
Global Const $GDIP_SMOOTHINGMODE_DEFAULT = 0 ; Specifies that smoothing is not applied.
Global Const $GDIP_SMOOTHINGMODE_HIGHSPEED = 1 ; Specifies that smoothing is not applied.
Global Const $GDIP_SMOOTHINGMODE_HIGHQUALITY = 2 ; Specifies that smoothing is applied using an 8 X 4 box filter.
Global Const $GDIP_SMOOTHINGMODE_NONE = 3 ; Specifies that smoothing is not applied.
Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 = 4 ; Specifies that smoothing is applied using an 8 X 4 box filter.
Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS = $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 ; Specifies that smoothing is applied using an 8 X 4 box filter.
Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS8X8 = 5 ; Specifies that smoothing is applied using an 8 X 8 box filter.

We are allowed to indicate a smoothing parameter from 0 to 5 for the function _GDIPlus_GraphicsGetSmoothingMode

* If we indicate the parameter by the variable name, for example $GDIP_SMOOTHINGMODE_HIGHQUALITY, then it's ok and the smoothing is applied using an 8 X 4 box

* But if we indicate the "same" parameter by its value (as wrongly indicated in the help file actually) then we pass 1, which is not correct at all and the line is aliased in the example (no smoothing)

That's all I noticed. Changing in the help file...

1 - Smoothing is applied using an 8 X 4 box filter

to...

2 - Smoothing is applied using an 8 X 4 box filter

...seems to solve it. Passing 2 is the same as passing $GDIP_SMOOTHINGMODE_HIGHQUALITY

Of course it's always safer to indicate the variable names rather than their values, but in the present case the variable names are not found in the help file, so we need the exact corresponding values that match them, i.e. 2 instead of 1

Ā 

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted (edited)

Ā Ā What did I understand?Ā Ā 

The issue isn't that the GDI+ constants themselves are wrong in the library,
the problem lies in the documentation (Help File) for _GDIPlus_GraphicsSetSmoothingMode.

Currently, the Help File suggests that passing values 1 and 2 enables specific box filters:

Ā  Ā  1 - Smoothing is applied using an 8 X 4 box filter (Incorrect)
Ā  Ā  2 - Smoothing is applied using an 8 X 8 box filter (Incorrect)

However, according to gdiplusenums.h and MSDN:

Ā  Ā  1 is SmoothingModeHighSpeed (No anti-aliasing applied).
Ā  Ā  2 is SmoothingModeHighQuality (General high quality, not specifically an 8x4 filter).

The actual constants that correspond to the "8x4" and "8x8" filters are 4 ($GDIP_SMOOTHINGMODE_ANTIALIAS8X4) and 5 ($GDIP_SMOOTHINGMODE_ANTIALIAS8X8).

The Help File creates confusion because it assigns the specific "8x4/8x8" descriptions to the generic "HighSpeed/HighQuality" modes.
A developer following the help file will get pixelated results when they expect smoothing.

It would be helpful if the documentation could be updated to map the correct constants ($GDIP_SMOOTHINGMODE_ANTIALIAS...) to these descriptions,
rather than using 1 and 2.

Ā 

gdiplusenums.h (10.0.26100.0)

Spoiler
//--------------------------------------------------------------------------
// Quality mode constants
//--------------------------------------------------------------------------

enum QualityMode
{
    QualityModeInvalid   = -1,
    QualityModeDefault   = 0,
    QualityModeLow       = 1, // Best performance
    QualityModeHigh      = 2  // Best rendering quality
};

//---------------------------------------------------------------------------
// Smoothing Mode
//---------------------------------------------------------------------------

enum SmoothingMode
{
    SmoothingModeInvalid     = QualityModeInvalid,
    SmoothingModeDefault     = QualityModeDefault,
    SmoothingModeHighSpeed   = QualityModeLow,
    SmoothingModeHighQuality = QualityModeHigh,
    SmoothingModeNone,
    SmoothingModeAntiAlias,
#if (GDIPVER >= 0x0110)
    SmoothingModeAntiAlias8x4 = SmoothingModeAntiAlias,
    SmoothingModeAntiAlias8x8
#endif //(GDIPVER >= 0x0110) 
};

Ā 

Ā 

Edited by ioa747

I know that I know nothing

Posted
43 minutes ago, jpm said:

$GDIP_SMOOTHINGMODE_HIGHQUALITY) = 1

I'm not ok with this, because $GDIP_SMOOTHINGMODE_HIGHQUALITY = 2 as indicated in @ioa747 gdiplusenums.h just above, or in another gdiplusenums.h I found :

typedef enum QualityMode {
    QualityModeInvalid = -1,
    QualityModeDefault = 0,
    QualityModeLow = 1,
    QualityModeHigh = 2
} QualityMode;

typedef enum SmoothingMode {
    SmoothingModeInvalid = QualityModeInvalid,
    SmoothingModeDefault = 0,
    SmoothingModeHighSpeed = 1,
    SmoothingModeHighQuality = 2,
    SmoothingModeNone = 3,
    SmoothingModeAntiAlias8x4 = 4,
    SmoothingModeAntiAlias = 4,
    SmoothingModeAntiAlias8x8 = 5
} SmoothingMode;

Why should we alter $GDIP_SMOOTHINGMODE_HIGHQUALITY) to 1 ? Just to keep the help file untouched and not followĀ gdiplusenums.h / msdn anymoreĀ  ?

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
56 minutes ago, ioa747 said:

Ā Ā What did I understand?Ā Ā 

The issue isn't that the GDI+ constants themselves are wrong in the library,
the problem lies in the documentation (Help File) for _GDIPlus_GraphicsSetSmoothingMode.

Currently, the Help File suggests that passing values 1 and 2 enables specific box filters:

Ā  Ā  1 - Smoothing is applied using an 8 X 4 box filter (Incorrect)
Ā  Ā  2 - Smoothing is applied using an 8 X 8 box filter (Incorrect)

However, according to gdiplusenums.h and MSDN:

Ā  Ā  1 is SmoothingModeHighSpeed (No anti-aliasing applied).
Ā  Ā  2 is SmoothingModeHighQuality (General high quality, not specifically an 8x4 filter).

The actual constants that correspond to the "8x4" and "8x8" filters are 4 ($GDIP_SMOOTHINGMODE_ANTIALIAS8X4) and 5 ($GDIP_SMOOTHINGMODE_ANTIALIAS8X8).

The Help File creates confusion because it assigns the specific "8x4/8x8" descriptions to the generic "HighSpeed/HighQuality" modes.
A developer following the help file will get pixelated results when they expect smoothing.

It would be helpful if the documentation could be updated to map the correct constants ($GDIP_SMOOTHINGMODE_ANTIALIAS...) to these descriptions,
rather than using 1 and 2.

Ā 

gdiplusenums.h (10.0.26100.0)

Ā  Hide contents
//--------------------------------------------------------------------------
// Quality mode constants
//--------------------------------------------------------------------------

enum QualityMode
{
    QualityModeInvalid   = -1,
    QualityModeDefault   = 0,
    QualityModeLow       = 1, // Best performance
    QualityModeHigh      = 2  // Best rendering quality
};

//---------------------------------------------------------------------------
// Smoothing Mode
//---------------------------------------------------------------------------

enum SmoothingMode
{
    SmoothingModeInvalid     = QualityModeInvalid,
    SmoothingModeDefault     = QualityModeDefault,
    SmoothingModeHighSpeed   = QualityModeLow,
    SmoothingModeHighQuality = QualityModeHigh,
    SmoothingModeNone,
    SmoothingModeAntiAlias,
#if (GDIPVER >= 0x0110)
    SmoothingModeAntiAlias8x4 = SmoothingModeAntiAlias,
    SmoothingModeAntiAlias8x8
#endif //(GDIPVER >= 0x0110) 
};

Ā 

Ā 

What is the effect of SmoothingModeNode is it equal to SmoothingModeDefault?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...