For displaying the image use inside ur cocecontrol::Draw() method as: gc.BitBlt( Tpoint(10,70), iBitmap); // // // ///// Make the function defination for GetPng Like this/////
can we not draw the png file direct?
i.e Without converting it into CFbsBitmap and then drawing using bitblt? because when i display the png image using above method , it does not give masking effect...
please paste some code to display png file direct.
Brajesh....
Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++
I am pretty sure that Symbian does not offer a way to display PNG directly. That would simply not make sense, from the viewpoint of display system architecture.
Anyway, what exactly do you mean with "masking effect"?
You cannot draw a PNG "directly" as rbrunner said. So you need to convert it to two CFbs Bitmap: one for the data and one for the mask so that you can have the transparency effect.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 85
yes u can draw a .png by using CWindowGC -> gc
try to use and read
CMdaImageFileToBitmapUtility
MMdaImageUtilObserver
void MiuoCreateComplete(TInt aError);
void MiuoOpenComplete(TInt aError);
void MiuoConvertComplete(TInt aError);
u can not only draw the .PNG but u can alos draw the
_LIT(KWildName1, "*.bmp");
_LIT(KWildName2, "*.mbm");
_LIT(KWildName3, "*.jpg");
_LIT(KWildName4, "*.wbmp");
_LIT(KWildName5, "*.ota");
_LIT(KWildName6, "*.gif");
_LIT(KWildName7, "*.tiff");
_LIT(KWildName8, "*.png");
_LIT(KWildName9, "*.wmf");
u just need to read the above classes and try to find about abt them
plz feel free if u have any problem
with regards
kmsoomro
Forum posts: 1155
load it to a CFbsBitmap in ConstructL and reuse it in Draw
Loading it in draw would make your program very slow and eat batteries.
Forum posts: 11
call it like this
_LIT(KImagePath,"\\system\\apps\\mobiletv\\bird1.png");
CFbsBitmap *iBitmap = new(ELeave) CFbsBitmap;
iurObject->GetPng(iBitmap,KImagePath);
For displaying the image use inside ur cocecontrol::Draw()
method as:
gc.BitBlt( Tpoint(10,70), iBitmap);
//
//
//
///// Make the function defination for GetPng Like this/////
GetPng(const TDesC& afilepath,CFbsBitmap* iBitmap,CFbsBitmap* iBmpMask )
{
TFileName filename(afilepath);
User::LeaveIfError (CompleteWithAppPath (filename));
filename.TrimAll();
CImageDecoder* idecoder;
TRAPD(err,idecoder = CImageDecoder::FileNewL(CEikonEnv::Static()->FsSession(),
filename ,_L8("image/png"),
CImageDecoder::EOptionAlwaysThread));
if(err !=KErrNone)
{
//do something
}
TFrameInfo iFrameInfo = idecoder->FrameInfo(0);
iBitmap->Create(iFrameInfo.iOverallSizeInPixels,iFrameInfo.iFrameDisplayMode );
TRequestStatus aStatus = KRequestPending;
TRAPD(err1,idecoder->Convert( &aStatus, *iBitmap,0 ));
User::WaitForRequest( aStatus );
delete idecoder;
}
/////////////////////////////////////////////////////////////////////
Forum posts: 42
Hi
can u give me the code of CompleteWithAppPath (filename) method.
thanks
Hidayath
Forum posts: 1155
No he can't, because that is S60 code.
You can use it by including the "aknutils.h" header file.
Forum posts: 140
can we not draw the png file direct?
i.e Without converting it into CFbsBitmap and then drawing using bitblt? because when i display the png image using above method , it does not give masking effect...
please paste some code to display png file direct.
Brajesh....
Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++
Forum posts: 1145
I am pretty sure that Symbian does not offer a way to display PNG directly. That would simply not make sense, from the viewpoint of display system architecture.
Anyway, what exactly do you mean with "masking effect"?
René Brunner
Forum posts: 1913
You cannot draw a PNG "directly" as rbrunner said. So you need to convert it to two CFbs Bitmap: one for the data and one for the mask so that you can have the transparency effect.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 1155
I assume the problem is you do something wrong so that you lose the alpha (transparency) information when you decode your image.
You have to let CImageDecoder create the mask for you too, and then use BitBltMasked
Edit: As eric says...
well, I guess I contributed by noting you need to use BitBltMasked too 
Forum posts: 140
how the CImageDecoder will handle for masking ?
please give me some fully functional code to draw png file with masking property.
i will be thankfull to you...
Brajesh
Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++