That means there is some mismatch in argument types.
If you read it, it will actually tell you exactly what the problem is (though can be hard to interpret without good C++ knowledge)
Maybe because those strange const strings you have tried to declare.
A much better way to declare those would be with the _LIT macro:
_LIT(FileName,"map.png");
_LIT(Mime,"image/png");
Try that first...
Oh.. also, you should not have the & on the Fss...
out of the error messages, this is the one i'm trying to accomplish: (first one in the sdk help)
CImageDecoder::FileNewL(RFs &, const TDesC16 &, const TDesC8 &, const CImageDecoder::TOptions)
The & in the function declaration just means it will take a reference to the object instead of doing a copy. (basic C++ stuff)
Try this:
RFs Fss;
Fss.Connect();
_LIT(Filename,"map.png");
_LIT8(Mime,"image/png"); //This needs to be an 8 bit descriptor for some reason...
CImageDecoder ImageDecoder = CImageDecoder::FileNewL( Fss, Filename, Mime, CImageDecoder::EOptionNone );
Also, if you are writing an application, you can get a reference to the current file server session (already opened by the framework) by calling
CCoeEnv::Static()->FsSession()
or.. if your code is within a CCoeControl class, you can get it even quicker by
that gives me:
illegal implicit conversion from 'CImageDecoder *' to
and if i add a * : CImageDecoder* ImageDecoder = ....
i get the following:
Undefined symbol: 'class CImageDecoder * CImageDecoder::FileNewL(class RFs &, class TDesC16 const &, class TDesC8 const &, enum CImageDecoder::TOptions) (?FileNewL@CImageDecoder@@SAPAV1@AAVRFs@@ABVTDesC16@@ABVTDesC8@@W4TOptions@1@@Z)'[]
Oh, didn't notice you didn't have the * there, ofcourse its needed
I think you might need to get a C++ book, and a basic symbian book and read through...
Your next step before this is proper symbian code is to add error and resource handling with cleanupstack and protect against leaves.
Your new error is a link error because you havn't included the library in the mmp file.
you need to add a line to it:
ah of course i forgot the library, works now, thanks
i didn't include error handling and such in the post just to keep it simple, since it only protects against runtime errors and doesn't affect the compiling (as far as i know), i'll obviously be adding those
made some progress after the holiday, but still no png on the screen...
this is what i'm doing (in AppView::ConstructL for the moment, will be placing it elsewhere at some point) :
_LIT(Filename,"c:\\map.png"); _LIT8(Mime,"image/png"); RFs Fs; User::LeaveIfError( Fs.Connect() ); CImageDecoder* ImageDecoder; TRAPD(err, ImageDecoder = CImageDecoder::FileNewL( Fs, Filename, Mime, CImageDecoder::EOptionNone ) ); if (err != KErrNone) { Fs.Close(); // die } Fs.Close(); iMappi = new (ELeave) CFbsBitmap; err2 = iMappi->Create(ImageDecoder->FrameInfo().iOverallSizeInPixels, ImageDecoder->FrameInfo().iFrameDisplayMode ); TRequestStatus ReqStat; ImageDecoder->Convert(&ReqStat,*iMappi); if (ReqStat != KErrNone) { TInt asdf; // just for debugging }
and then i use gc.BitBlt(TPoint(0,0),iMappi); to draw it (in AppView::Draw)
it seems that the Convert method isn't doing anything - regardless of whether i comment it out or not, the program prints me a blank white rectangle of the size of the .png file, and it returns KErrNone (doesn't go to TInt asdf;)
Hi,
I have problem,where i have to convert a in memory windows bitmap into CFbsBitmap;
I have used the CImageDecoder::DataNewL(); API to create a decoder.....but the problem is that when i try to convert using User::WaitForRequest(ReqStat) it simply doesnt come out of the loop and the system panics after some seconds.....
I tried creating a active object and using the SetActive() method...but the problem is i have to display the decoded image imediately after the convert function is called.....
Its something like i have a function drawimage( inmemorybitmapstream ) which gets called from the draw( )method...in this drawimage() function i have to convert it into a symbian bitmap and draw the image....i tried using User::WaitForRequest(ReqStat) but it simply panics...wen i try the same using a CDecoder::filenewl() [ Ofcourse using a persistant file ] instead of using a DataNewL() function everything seems to work perfectly....
Forum posts: 1419
That means there is some mismatch in argument types.
If you read it, it will actually tell you exactly what the problem is (though can be hard to interpret without good C++ knowledge)
Maybe because those strange const strings you have tried to declare.
A much better way to declare those would be with the _LIT macro:
_LIT(FileName,"map.png");
_LIT(Mime,"image/png");
Try that first...
Oh.. also, you should not have the & on the Fss...
Forum posts: 9
still getting the same story with the following:
RFs Fss;Fss.Connect();
_LIT(Filename,"map.png");
_LIT(Mime,"image/png");
CImageDecoder ImageDecoder = CImageDecoder::FileNewL( Fss, &Filename, &Mime, CImageDecoder::EOptionNone );
out of the error messages, this is the one i'm trying to accomplish: (first one in the sdk help)
CImageDecoder::FileNewL(RFs &, const TDesC16 &, const TDesC8 &, const CImageDecoder::TOptions)
Forum posts: 1419
oh, you shouldn't have an & on any of them.
The & in the function declaration just means it will take a reference to the object instead of doing a copy. (basic C++ stuff)
Try this:
Also, if you are writing an application, you can get a reference to the current file server session (already opened by the framework) by calling
or.. if your code is within a CCoeControl class, you can get it even quicker by
Forum posts: 9
that gives me:
illegal implicit conversion from 'CImageDecoder *' to
and if i add a * : CImageDecoder* ImageDecoder = ....
i get the following:
Undefined symbol: 'class CImageDecoder * CImageDecoder::FileNewL(class RFs &, class TDesC16 const &, class TDesC8 const &, enum CImageDecoder::TOptions) (?FileNewL@CImageDecoder@@SAPAV1@AAVRFs@@ABVTDesC16@@ABVTDesC8@@W4TOptions@1@@Z)'[]
'least it's a different error
Forum posts: 1419
Oh, didn't notice you didn't have the * there, ofcourse its needed
I think you might need to get a C++ book, and a basic symbian book and read through...
Your next step before this is proper symbian code is to add error and resource handling with cleanupstack and protect against leaves.
Your new error is a link error because you havn't included the library in the mmp file.
you need to add a line to it:
LIBRARY imageconversion.lib
Forum posts: 9
ah of course i forgot the library, works now, thanks
i didn't include error handling and such in the post just to keep it simple, since it only protects against runtime errors and doesn't affect the compiling (as far as i know), i'll obviously be adding those
Forum posts: 9
made some progress after the holiday, but still no png on the screen...
this is what i'm doing (in AppView::ConstructL for the moment, will be placing it elsewhere at some point) :
_LIT(Filename,"c:\\map.png");_LIT8(Mime,"image/png");
RFs Fs;
User::LeaveIfError( Fs.Connect() );
CImageDecoder* ImageDecoder;
TRAPD(err, ImageDecoder = CImageDecoder::FileNewL( Fs, Filename, Mime, CImageDecoder::EOptionNone ) );
if (err != KErrNone)
{
Fs.Close();
// die
}
Fs.Close();
iMappi = new (ELeave) CFbsBitmap;
err2 = iMappi->Create(ImageDecoder->FrameInfo().iOverallSizeInPixels, ImageDecoder->FrameInfo().iFrameDisplayMode );
TRequestStatus ReqStat;
ImageDecoder->Convert(&ReqStat,*iMappi);
if (ReqStat != KErrNone)
{
TInt asdf; // just for debugging
}
and then i use gc.BitBlt(TPoint(0,0),iMappi); to draw it (in AppView::Draw)
it seems that the Convert method isn't doing anything - regardless of whether i comment it out or not, the program prints me a blank white rectangle of the size of the .png file, and it returns KErrNone (doesn't go to TInt asdf;)
Forum posts: 1419
Late reply, and you probably have fixed this already, but you have to wait for the conversion to finish too.
Convert is an asynchronous call, and probably you try draw it before it is done converting the image.
a call to User::WaitForRequest(ReqStat); after the call to convert will block your thread until it is done.
Forum posts: 18
Hi,
I have problem,where i have to convert a in memory windows bitmap into CFbsBitmap;
I have used the CImageDecoder::DataNewL(); API to create a decoder.....but the problem is that when i try to convert using User::WaitForRequest(ReqStat) it simply doesnt come out of the loop and the system panics after some seconds.....
I tried creating a active object and using the SetActive() method...but the problem is i have to display the decoded image imediately after the convert function is called.....
Its something like i have a function drawimage( inmemorybitmapstream ) which gets called from the draw( )method...in this drawimage() function i have to convert it into a symbian bitmap and draw the image....i tried using User::WaitForRequest(ReqStat) but it simply panics...wen i try the same using a CDecoder::filenewl() [ Ofcourse using a persistant file
] instead of using a DataNewL() function everything seems to work perfectly....
How do i do this???
Forum posts: 1419
You should create your decoder with EOptionAlwaysThread.
An asynchronous request must be performed in a separate thread for User::WaitForRequest() to work.
Forum posts: 3
you'd better to see some c++ knownledge
used like this:
CImageDecoder::FileNewL( Fss, Filename, Mime, CImageDecoder::EOptionNone );
will be fine.