views:

333

answers:

2

How to obtain a alphablend image in wince 6.0 for a particular child window for n number of times? for example if i have a vol bar graph window which is for volume increase & decrease which is changed on click of vol+ or Vol- button so if i want to keep vol bar graph window as an alphablend image in wince 6.0 then how shall i obtain? Because i have tried in win32 application and i was able to do but i was not able to perform the same in wince 6.0 ?

I have used the below function for painting image for volBarGraph in wince 6.0

void AdjustAlphablendImage(int imgId, char axis_id)

{

LogEntry(L"Entered in AdjustAlphablendImage Function");
BLENDFUNCTION bf;
bf.BlendOp=AC_SRC_OVER;
bf.BlendFlags=0;
bf.SourceConstantAlpha=55;
bf.AlphaFormat=0;
HBITMAP bmp = LoadBitmap(handles.hInstance, 
 MAKEINTRESOURCE(imgId));
HDC wdc = GetWindowDC(handles.parent);
HDC tdc = CreateCompatibleDC(wdc);
SelectObject(tdc,bmp);
AlphaBlend(wdc ,
 imgs[axis_id].x,
 imgs[axis_id].y,
 imgs[axis_id].width ,
 imgs[axis_id].height,
  tdc ,0 ,0 ,
 imgs[axis_id].widthSrc, 
 imgs[axis_id].heightSrc,
            bf);
DeleteDC(wdc);
DeleteDC(tdc);
DeleteObject(bmp);
ReleaseDC(handles.parent,wdc);
LogEntry(L"Exited from AdjustAlphablendImage Function");

}

here 'handles' is an object of type 'HANDLES' and 'parent' is a data member of 'HANDLES' of type 'HWND'.

My structure 'HANDLES' is mentioned below

struct HANDLES

{

    HINSTANCE hInstance;
HWND parent;
HWND volUp;
HWND volDown;
HWND volOnOff;
HWND chUp;
HWND chDown;
HWND tvOnOff;
HWND tvTitle;
HWND volBarGraph; // I am doing alphablending on this...................
HWND chNo;
HWND chNoBcg;
HWND audioStatus;
HWND subTitleStatus;
HWND message;
HWND prevHandle;
WNDPROC oldButtonWndProc;
HWND pressedButton;
int prevButtonId;
char prevButtonAxis;
char screenMode;

};

//The below function is used for calling AdjustAlphablendImage function for volBarGraph.

AdjustAlphablendImage(

                   volumeStatus.volume + volumeStatus.status + INITIAL_VOLUME,  // This is used for taking proper image on particular click of vol+ or vol- Button.
                   AXIS_VOL_BAR_GRAPH                     
                  );

Also how to erase background image in wince 6.0?

Please Reply

Thanks

+1  A: 

Just becasue something works on the desktop doesn't mean it's going to work under Windows CE. Furthermore, since CE is a modular OS, if it works on one device it doesn't mean it will work on another.

Was alpha blending added to the CE image? Does your system's display driver support alpha blending?

The answer to these two are going to have to be "Yes" before you can even try to move forward.

If the answer to them is "yes" then we need to see the code you've tried already.

ctacke
Yes i have added and it support alpha blending.
Abhi
Then we need to see code.
ctacke
I have added code on which i am doing alphablending...
Abhi
Please ReplyThanks
Abhi
I want to know how can i achieve this i have modified my question for better understanding... i have to remove the backgroung image at first before calling AdjustAlphablendImage... So that i can get proper alphablend image pasted on the same coordinates..
Abhi
A: 

I can't see any reason from the documentation for why AlphaBlend wouldn't work for WinCE -- however CE sometimes likes to surprise you! An alternative, slightly klunky but pretty much guaranteed to work, is to go back to the old Ternary Raster opcodes and do a partial blit, i.e. use a brush to modify the blit so that not all the pixels are displayed. This is an old technique I've used since Win 3.1 days and it works on all CE platforms as far as I know - so dig out your old Petzold programming book and see what you can find!

AAT
Is there anyway to erase background image on click of button everytime. Because everytime i click on button i.e vol+ or vol-, the alphablending image darkens everytime by not making image to look as alphablend. Only at beginning the first image looks to be properly alpha blended. After that it darkens on click of buttons by making alphablend image to appear as normal image.. So if i can clear the background screen then the thing can work...Please replyThanks a lot
Abhi