From yesterday's post, I forgot the code snippet couldn't upscale, only downscale. This remedies that.
Same downscaling part, but afterwards, if it wasn't downscaled, upscale to the nearest dimension. Basically checking the scale factor for current width -> desired width vs. current height -> desired height. Then we're choosing the smaller ratio, as that would prevent any part of the rect from going outside the bounds.
JsFiddle:
Subscribe to:
Post Comments (Atom)
Coding Challenge #54 C++ int to std::string (no stringstream or to_string())
Gets a string from an integer (ejemplo gratis: 123 -> "123") Wanted to come up with my own function for this like 10 years ago ...
-
I NEEDS MY JAVASCRIPT PLEASE :) Open txtcode .txt Save as .gct Please click the blue cheat code title to activate it, a...
-
So you have a few .wbfs files from your wii game backups. You want their IDs so you can get cheats or cover art for them. Where do you find...
-
submitted for Coursera quiz. Read int's from a file, and calculate their average #include <stdio.h> int main(){ FILE *filePoi...
No comments:
Post a Comment