About Store Forum Documentation Contact
Donations:
225$/mo



Post Reply 
Importing jpg with WIO
Author Message
RedcrowProd Offline
Bronze Supporter

Post: #1
Importing jpg with WIO
Hey,

I need help, as i am missing a key step for importing jpeg, but i cant figure out which one !

here is the code ( i used the tutorial WIO as a base )

Quote:/******************************************************************************/
WindowIO wio; // window handling input/ouput
/******************************************************************************/
void InitPre()
{
EE_INIT();
}
/******************************************************************************/
void Load(C Str &FullPath, ptr user) // this function will be called when 'WindowIO' will load a file
{
File f;
if(f.readStdTry(FullPath))
{
if(loadedimg.ImportTry(f))
{
ptrimg=&loadedimg;
}
}
}
void Save(C Str &name, ptr user) // this function will be called when 'WindowIO' will save a file
{
}
/******************************************************************************/
bool Init()
{
wio.create("jpg", S, S, Load, Save); // create a 'WindowIO', accepting given file extension, paths, and IO functions
return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
bool Update()
{
if(Kb.bp(KB_ESC) && !Gui.window())return false;
Gui.update();

// activate saving/loading on keypress
if(Kb.bp(KB_F3))wio.load();

return true;
}
/******************************************************************************/
void Draw()
{
D .clear(TURQ);
bool Result =false;
if(ptrimg)Result=true;
D .text(0, 0.9, S+ "Press F2/F3 to save/load"+"//"+Result+"/"+loadedimg.is()+"/"+loadedimg.size());
Gui.draw();

if(ptrimg)
{
ptrimg->drawFs();
loadedimg.drawFs();
}
}
/******************************************************************************/

ImagePtr ptrimg;
Image loadedimg;
Image seems to be imported successfuly, image has its properties, but it seems to be blank ?

Thanks,
(This post was last modified: 12-25-2019 07:05 PM by RedcrowProd.)
12-25-2019 05:22 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Importing jpg with WIO
Default mode is IMAGE_SOFT, I think import function has option to specify IMAGE_2D
12-26-2019 03:07 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Bronze Supporter

Post: #3
RE: Importing jpg with WIO
ah !

yes it was,

it seems to be working now, thanks smile
12-26-2019 08:36 AM
Find all posts by this user Quote this message in a reply
Post Reply