Jump to content
Sign in to follow this  
Sundance

pic paint issue

Recommended Posts

Sundance

Hiho,

i have a little problem using the AutoIt3Wrapper in combination with the _ResourceSetImageToCtrl command.

When i use a 32bit BMP file with given transparency and paint on top of a background the transparency ist set and everything looks fine.

When i to again the _ResourceSetImageToCtrl command (just say i want to change the style of the button) it only paints the pic over the background and over the allready shown pic. It seems that the pic is stamped on top of the background and it's then like one layer.

Here you can see my little test script

Opt('ExpandEnvStrings', 1)
 
 #AutoIt3Wrapper_UseUpx=n
 #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, "bin.bmp", bitmap, bin_BMP, 0
 #AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=1 "%out%"
;
;
; TestGui für DuoCon mit Hilfe einer Toolbar
;
;
;~ #include <GuiToolbar.au3>
 #include <GuiConstantsEx.au3>
 #include <WindowsConstants.au3>
 #include <Constants.au3>
 #include <resources.au3>
 Opt('MustDeclareVars', 1)
 Global $i
 
 Global $hGUI; handle des GUIs
 Global $hBackground; handle jpg for background
 Global $hPic; handle des pics
 
 $hGUI = GUICreate("wrong transparency effect", 220, 100, 200, 209)
 
 $hBackground = GUICtrlCreatePic("Background.JPG", 0, 0, 220, 100, BitOR($WS_GROUP, $WS_CLIPSIBLINGS), $WS_EX_LAYERED)
 GUICtrlSetState($hBackground, $GUI_DISABLE)
 
 $hPic = GUICtrlCreatePic("", 100, 10, 48, 48, -1, $WS_EX_TRANSPARENT)
 _ResourceSetImageToCtrl($hPic, "bin_BMP", $RT_BITMAP)
 GUISetState(@SW_SHOW)
 
 Sleep(1000)
 
 For $i = 1 To 10 Step 1
     _ResourceSetImageToCtrl($hPic, "bin_BMP", $RT_BITMAP)
     Sleep(1000)
 Next
 
 MsgBox(0, "finished", "finished")
 Exit

The attachment shows you a bin drawn 4 times on top of a background. You can see that everytime the bin gets darker and the transparency will get lost ..

Has somebody a little hint or trick for me to solve the problem?

greetz

Sundance

post-6889-1224841959_thumb.jpg

post-6889-1224842357_thumb.jpg

bin.bmp

Edited by Sundance

Share this post


Link to post
Share on other sites
martin

This is a Windows problem and not to do with Zedna's UDF I think. If you force the window to be redrawn, say by dragging it so that the bin is off-screen and then drag it back into view, the bin is shown correctly.

One way to fix it is to get Windows to redraw just the area of the windon occupied by the bin like this.

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, "bin.bmp", bitmap, bin_BMP, 0
#AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=1 "%out%"

Opt('ExpandEnvStrings', 1)

;
;
; TestGui für DuoCon mit Hilfe einer Toolbar
;
;
;~ #include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <resources.au3>
#include <staticconstants.au3>
Opt('MustDeclareVars', 1)
Global $i

Global $hGUI; handle des GUIs
Global $hBackground; handle jpg for background
Global $hPic; handle des pics
Global $stRect;structure for the rectangle around the bin

$hGUI = GUICreate("wrong transparency effect", 220, 100, 200, 209)
                                                                     
$hBackground = GUICtrlCreatePic("resource_data\Background.JPG", 0, 0, 220, 100, BitOR($WS_GROUP, $WS_CLIPSIBLINGS), $WS_EX_LAYERED)
GUICtrlSetState($hBackground, $GUI_DISABLE)

$hPic = GUICtrlCreatePic("", 100, 10, 48, 48, -1, $WS_EX_TRANSPARENT)
_ResourceSetImageToCtrl($hPic, "bin_BMP", $RT_BITMAP)
GUISetState(@SW_SHOW)

Sleep(1000)
;create the struct giving the rect around the bin
$stRect = dllstructcreate("int;int;int;int")
DllStructSetData($stRect,1,100);top x coord
DllStructSetData($stRect,2,10);top y
DllStructSetData($stRect,3,124);bottom x<--I have set only half the width of the bin so you can see the difference
DllStructSetData($stRect,4,58);bottom y
For $i = 1 To 10 Step 1
    _ResourceSetImageToCtrl($hPic, "bin_BMP", $RT_BITMAP)
    DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hGUI, "ptr", dllstructgetptr($stRect), "int", 1)
     Sleep(1000)
Next

MsgBox(0, "finished", "finished")
Exit
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Sundance

Hi martin,

thx ! I will try this till monday and will report back.

But how the hell do you know such things?

greetz

Sundance

Share this post


Link to post
Share on other sites
martin

Hi martin,

thx ! I will try this till monday and will report back.

greetz

Sundance

I think it will work.

But how the hell do you know such things?

Well I don't know so much and I often wonder the same thing about other people. I remember one of my first jobs (nothing to do with software) and I thought my boss was realy clever. After I had worked for him for a few years I realized he wasn't so clever he just had done some things before and new the answers. Since then I realized that intelligence is no competion for knowledge but knowledge can look like intelligence.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Sundance

Hi Martin,

i think you're right. I made the same experience with a lot of people. The older you get the more you know that youreself are not that dump and that the others mostly only blind yourself with big words... :-)

So, now back to my transparency problem:

The transparency itself works now like a charme but when you watch the gui under a rdp session the transparency is lost. I never saw such a problem before (there aren't many guis with transparency i guess). Has somebody a hint what this could be or is this a windows problem? When i use ultravnc the gui shows normal. There must be some kind of information wich the rdp protocoll can't catch. I've tried it using 32bit and to disable the bitmap buffering but no help. I attached again the little bin . This time showing it under the rdp session.

greetz and hopefully thx in advance

Sundance

post-6889-1225701754_thumb.jpg

Share this post


Link to post
Share on other sites
wraithdu

I'd guess that RDP doesn't support alpha blending. But don't quote me on that...

Share this post


Link to post
Share on other sites
Sundance

I'd guess that RDP doesn't support alpha blending. But don't quote me on that...

The windows standard is set at maximum of 16bit. Then you won't have the alpha channel, thats right. But with the help of gpedit.msc you can deactivate the limitation and set it up to 24bit. Then you can display alphachannels...

But the 24bit way won't help...

Edited by Sundance

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.