Reputation: 6627
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 ?
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'.
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;
};
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
Upvotes: 0
Views: 1343
Reputation: 3386
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!
Upvotes: 0
Reputation: 67178
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.
Upvotes: 1