THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/09/2011 at 02:53, xxxxxxxx wrote:
Do you mean viewport rendering?
Anyways, saving a JPG to memory seems to work as follows:
Bool MenuTest::Execute(BaseDocument *doc)
{
AutoAlloc<MemoryFileStruct> mfs;
if (!mfs) return FALSE;
Filename fn;
fn.SetMemoryWriteMode(mfs);
BaseBitmap *bmp = NULL;
bmp = BaseBitmap::Alloc();
if (!bmp) return FALSE;
BaseContainer bc;
bc.SetLong(JPGSAVER_QUALITY, 80);
void *mbmp = NULL;
VLONG length = 0;
if (bmp->Init(1024,512) != IMAGERESULT_OK) goto Error;
bmp->Clear(255,0,0);
if (bmp->Save(fn, FILTER_JPG, &bc, SAVEBIT_0) != IMAGERESULT_OK) goto Error;
GePrint("saved");
//get the written data
mfs->GetData(mbmp, length, FALSE);
if (!mbmp) goto Error;
// mbmp is the pointer to the JPG data
GePrint(LongToString(length));
return TRUE;
Error:
BaseBitmap::Free(bmp);
return FALSE;
}
Hope that helps.
cheers,
Matthias