Author Topic: Question about carrier.nut image sizing.  (Read 4864 times)

keithcorcoran

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Question about carrier.nut image sizing.
« on: January 14, 2019, 06:21:59 PM »
What setting controls the size of the images in the carrier slider?

Aside from making wheel images exactly the size you want... I'd like to use existing wheel images, have 1 image display at a time with the rest off screen, but constrain the size of the image to a fixed width (without stretching the image)

Currently if I dont resize the image and feed it the image size I want on screen, the carrier scales the image to fit the width or height since there's only 1 on the screen.

thanks

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Question about carrier.nut image sizing.
« Reply #1 on: January 14, 2019, 10:42:51 PM »
There are a couple of ways to obtain this, basically the carrier.nut image size is controlled by carrier width and height, number of tiles and padding. In your case you only have 1 tile so width and height directly apply to the image, while padding creates a blank border around that image.

So solution 1, if your images all share the same height, you can create your carrier as large as the screen and as high as desired, set to keep image aspect ratio. Let's say screen is 640x480 and images are 300x200, you define your carrier as 640x200, and you should be good to go. This will make your images all the same size, or all the same height if they are not all at the same proportion.

If your images are not at the same proportion, and you want to have them all at the same width, you have to play a bit with padding, so you create a carrier that has a 640xdesired.carrier.height and add padding so that the actual image width is the one you desire. I don't remember how padding is placed but I think it's half on every frame so in your case to have a 300 pixel image on a 640 screen your padding should be 340 pixels.

keithcorcoran

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #2 on: January 15, 2019, 12:06:47 AM »
good explanation. I'll mess with it and see what I come up with.  The scraped wheel images tend to be pretty large so i'll have to tweak until i get something useable.

thanks.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Question about carrier.nut image sizing.
« Reply #3 on: January 15, 2019, 02:41:25 AM »
The scraped wheel images tend to be pretty large so i'll have to tweak until i get something useable.

If you want "pixel perfect" wheel images you should look for "Title" collections (that is the snap of the title screen) and crop them yourself, but you can always let AM scale down larger wheel images (and in this case setting obj.mipmap = 1 for every image object will improve on the downscale quality)

keithcorcoran

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #4 on: January 16, 2019, 07:24:16 PM »
that's actually what I did.

since this implementation only has 3 games it's like no effort. 

that said, is there a way to keep AM from antialiasing when it scales to screen size?

(this is kind of a layout vs scripting question but...)

I plan to either go from RCA out to a CRT NTSC TV or figure out how to get video from the Pi into my arcade CGA with as little hardward(cost) as possible.

Unsure if I should design my theme at 320x240 or 640x480 (in case I am outputting HDMI to VGA to CGA - my least preferred option)

Since NTSC is '525 lines'  I don't knwo what that ends up being in pixels for purposes of creating a theme that appears as hard pixels without antialiasing.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Question about carrier.nut image sizing.
« Reply #5 on: January 16, 2019, 11:53:07 PM »
that said, is there a way to keep AM from antialiasing when it scales to screen size?

Sure, just use the code:

Code: [Select]
picture.smooth = false
and anti-aliasing is disabled.

Quote
Unsure if I should design my theme at 320x240 or 640x480 (in case I am outputting HDMI to VGA to CGA - my least preferred option)

Since NTSC is '525 lines'  I don't knwo what that ends up being in pixels for purposes of creating a theme that appears as hard pixels without antialiasing.

NTSC is 525 lines including overscan and interlacing, I don't know how the output to a CRT is managed in your setup but this is tricky stuff since AFAIK NTSC doesn't even have square pixels. If you plan to run your games at 1:1 resolution on a CRT monitor you may try and force the layout to be that exact resolution. I'm also aware that most consoles use a trick to force CRTs to not use interlacing and instead draw two low resolution frames at 60 Hz, but I don't know if this is the case for arcades too.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #6 on: January 17, 2019, 12:25:19 AM »
Attractmode runs full screen. It will match your “desktop” resolution. If you hard set a resolution, it will stretch it. This can be an issue if you stretch a surface larger, not so much going smaller. I don’t declare layout dimensions, and use percentages for everything. My helpers module has a function for aspect ratios too. Just need to make sure you have room for overscan and text large enough. This is just my method. More than one way to accomplish same goal.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Question about carrier.nut image sizing.
« Reply #7 on: January 17, 2019, 12:30:50 AM »
I don’t declare layout dimensions, and use percentages for everything.

I do something similar: I designed my layout on a 1920x1200 screen, I declared all sizes in pixels for that resolution but then I apply a scaling factor taking the actual screen resolution into account. Which ends up being the same thing as using percentages I guess...

I'm wondering if all this percentages/scaling stuff is actually needed since AM scales anyway for the actual screen size, but it allows me to do some rough testing of how it will look on lower resolutions staying fullscreen.

But I think the OP is interested in avoiding scaling to get a "pixel perfect" theme at native screen resolution which, AFAIK, can be obtained just by using the same screen size as fe.layout.width and fe.layout.height

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #8 on: January 17, 2019, 01:27:14 AM »
It could be needed. Hard setting a resolution will stretch, but maintain aspect ratio. Look at attract-man layout on a wide screen. It maintains close to a 4:3 ratio. Using percentages, I can have a more fluid/responsive layout.

mvscomplete theme before the latest commits (positioning will be fixed on next holiday, but mini marquees stay in aspect) maintains certain things in 4:3 format, but other objects like video snap can stretch to monitor width. Hard setting layout settings and object positioning for my 2011 iMac would fuck things up for my crt’s, and vice versa.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Question about carrier.nut image sizing.
« Reply #9 on: January 17, 2019, 02:10:58 AM »
It could be needed. Hard setting a resolution will stretch, but maintain aspect ratio.
Look at attract-man layout on a wide screen. It maintains close to a 4:3 ratio. Using percentages, I can have a more fluid/responsive layout.

Completely agree. My Arcadeflow layout keeps the vertical spacing of items intact while changing aspect ratio, so basically a larger screen simply means more room for side thumbnails. I like responsive layouts :)

keithcorcoran

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #10 on: January 17, 2019, 08:53:58 AM »
I'd like to get as close to pixel perfect as possible and on the Pi given all the down conversion needed to output to a CRT I dont think it will happen but i'd like to get close.

If nothing else, it will be closer to authentic than throwing a LCD in my cabinet.

I'm kind of straddling posts now in 2 forums but this is probably a better question for this forum.

....

I added imagename.smooth to my vidoe background.. works perfect.

tried adding carrier.smooth = false but that didnt turn off smoothing for the carrier images.

tried adding selector.smooth in carrier.nut since i read the code to mean 'selector' is the actual image in the carrier but that didn't work either.

scratch that. .just saw the comment line.  selector is the frame png around the wheel image

any thoughts?

keithcorcoran

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Question about carrier.nut image sizing.
« Reply #11 on: January 17, 2019, 08:59:02 AM »
got it. turned off smoothing in the wheel images.

added this to carrier.nut around line 152.

obj.smooth=false

would be nice to set this flag in the function call from layout.nut