Author Topic: Problem with fe.layout + fe.add_surface  (Read 9725 times)

amuser

  • Newbie
  • *
  • Posts: 2
    • View Profile
Problem with fe.layout + fe.add_surface
« on: September 26, 2016, 09:45:09 PM »
The original image.jpg and rpi2 resolution size are both 1920x1080.

This works fine:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local image = fe.add_image( "image.jpg", 0, 0, flw, flh );

this works fine too:
Code: [Select]
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;
local imageSurface = fe.add_surface(flx, fly);
imageSurface.set_pos(0, 0, flw, flh);
local img = imageSurface.add_image( "image.jpg", 0, 0, flw, flh );
img.set_pos(0, 0, flw, flh);

but if i try to put the image (or a text) inside a surface and set fe.layout with 640x480 the image (or text) looks pixelated:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local imageSurface = fe.add_surface(flx, fly);
imageSurface.set_pos(0, 0, flw, flh);
local img = imageSurface.add_image( "image.jpg", 0, 0, flw, flh );
img.set_pos(0, 0, flw, flh);

So, i can't use fe.layout.width=640 and fe.layout.height=480 because the surfaces will look bad, except for surfaces using fade module:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local surface_flyer = fe.add_surface( flx, fly );
surface_flyer.set_pos(flx*0.01, fly*0.01, flw*0.5, flh*0.8);
local flyer = FadeArt( "flyer", 0, 0, flw, flh, surface_flyer );

Im missing something or it is a bug?
« Last Edit: September 26, 2016, 09:51:56 PM by amuser »

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: Problem with fe.layout + fe.add_surface
« Reply #1 on: September 28, 2016, 08:34:28 PM »
amuser-

The surface art can be independent of what the layout resolution is.

For example, I can define my surface art to be 1024x768 while my layout is 640x480. 

local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;

//create surface for snap
local surface_snap = fe.add_surface( 1024, 768 );
local snap = FadeArt("snap", 0, 0, 1024, 768, surface_snap);

amuser

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Problem with fe.layout + fe.add_surface
« Reply #2 on: September 29, 2016, 11:28:28 PM »
yeah, i can use this:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local imageSurface = fe.add_surface(1920, 1080);
imageSurface.set_pos(0, 0, 1920, 1080);
local img = imageSurface.add_image( "image.jpg", 0, 0, flw, flh );
img.set_pos(0, 0, flw, flh);

but if i do this i will go back to the main reason i was thinking to use 640x480: slowdown. If i set the surface and the image to 1920x1080 the wheel scrolls very slow. And if i set the same image to 1920x1080 without surface the wheel scrolls fast, even with the fe.layout in 1920x1080:
Code: [Select]
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;
local image = fe.add_image( "image.jpg", 0, 0, flw, flh );

But i need the surface to turn the image visible/invisible.
So, for now:

Great image quality, good performance (but no surface):
Code: [Select]
local flx = fe.layout.width; //1920
local fly = fe.layout.height; //1080
local flw = fe.layout.width;
local flh = fe.layout.height;
local image = fe.add_image( "image.jpg", 0, 0, flw, flh );

Poor image quality, good performance:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local imageSurface = fe.add_surface(flx, fly);
imageSurface.set_pos(0, 0, flw, flh);
local img = imageSurface.add_image( "image.jpg", 0, 0, flw, flh );
img.set_pos(0, 0, flw, flh);

Great image quality, bad performance:
Code: [Select]
local flx = fe.layout.width=640;
local fly = fe.layout.height=480;
local flw = fe.layout.width;
local flh = fe.layout.height;
local imageSurface = fe.add_surface(1920, 1080);
imageSurface.set_pos(0, 0, 1920, 1080);
local img = imageSurface.add_image( "image.jpg", 0, 0, flw, flh );
img.set_pos(0, 0, flw, flh);

Why the combination of surface at 1920x1080 + image at 1920x1080 is going to a bad performance if the same image at 1920x1080 without surface do not slowdown? Even converting the image to just 50KB dont speed up...
« Last Edit: September 29, 2016, 11:36:00 PM by amuser »