mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 06:13:52 +02:00
Fix performance stat "None", auto status change with company check, print crop and centering
This commit is contained in:
@@ -141,34 +141,50 @@ namespace VRCX
|
||||
|
||||
public byte[] ResizePrintImage(byte[] imageData)
|
||||
{
|
||||
var inputImage = ResizeImageToFitLimits(imageData, false, 1920, 1080);
|
||||
using var fileMemoryStream = new MemoryStream(inputImage);
|
||||
const int desiredWidth = 1920;
|
||||
const int desiredHeight = 1080;
|
||||
|
||||
using var fileMemoryStream = new MemoryStream(imageData);
|
||||
var image = new Bitmap(fileMemoryStream);
|
||||
|
||||
// increase size to 1920x1080
|
||||
if (image.Width < 1920 || image.Height < 1080)
|
||||
if (image.Width < desiredWidth || image.Height < desiredHeight)
|
||||
{
|
||||
var newHeight = image.Height;
|
||||
var newWidth = image.Width;
|
||||
if (image.Width < 1920)
|
||||
if (image.Width < desiredWidth)
|
||||
{
|
||||
newWidth = 1920;
|
||||
newWidth = desiredWidth;
|
||||
newHeight = (int)Math.Round(image.Height / (image.Width / (double)newWidth));
|
||||
}
|
||||
if (image.Height < 1080)
|
||||
if (image.Height < desiredHeight)
|
||||
{
|
||||
newHeight = 1080;
|
||||
newHeight = desiredHeight;
|
||||
newWidth = (int)Math.Round(image.Width / (image.Height / (double)newHeight));
|
||||
}
|
||||
var resizedImage = new Bitmap(1920, 1080);
|
||||
var resizedImage = new Bitmap(desiredWidth, desiredHeight);
|
||||
using var graphics1 = Graphics.FromImage(resizedImage);
|
||||
graphics1.Clear(Color.White);
|
||||
var x = (1920 - newWidth) / 2;
|
||||
var y = (1080 - newHeight) / 2;
|
||||
var x = (desiredWidth - newWidth) / 2;
|
||||
var y = (desiredHeight - newHeight) / 2;
|
||||
graphics1.DrawImage(image, new Rectangle(x, y, newWidth, newHeight));
|
||||
image.Dispose();
|
||||
image = resizedImage;
|
||||
}
|
||||
|
||||
// limit size to 1920x1080
|
||||
if (image.Width > desiredWidth)
|
||||
{
|
||||
var sizingFactor = image.Width / (double)desiredWidth;
|
||||
var newHeight = (int)Math.Round(image.Height / sizingFactor);
|
||||
image = new Bitmap(image, desiredWidth, newHeight);
|
||||
}
|
||||
if (image.Height > desiredHeight)
|
||||
{
|
||||
var sizingFactor = image.Height / (double)desiredHeight;
|
||||
var newWidth = (int)Math.Round(image.Width / sizingFactor);
|
||||
image = new Bitmap(image, newWidth, desiredHeight);
|
||||
}
|
||||
|
||||
// add white border
|
||||
// wtf are these magic numbers
|
||||
@@ -177,7 +193,10 @@ namespace VRCX
|
||||
var newImage = new Bitmap(2048, 1440);
|
||||
using var graphics = Graphics.FromImage(newImage);
|
||||
graphics.Clear(Color.White);
|
||||
graphics.DrawImage(image, new Rectangle(xOffset, yOffset, image.Width, image.Height));
|
||||
// graphics.DrawImage(image, new Rectangle(xOffset, yOffset, image.Width, image.Height));
|
||||
var newX = (2048 - image.Width) / 2;
|
||||
var newY = yOffset;
|
||||
graphics.DrawImage(image, new Rectangle(newX, newY, image.Width, image.Height));
|
||||
image.Dispose();
|
||||
image = newImage;
|
||||
|
||||
|
||||
@@ -1876,6 +1876,12 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('AVATAR:IMPOSTER:DELETE', function (args) {
|
||||
if (args.json && $app.avatarDialog.visible) {
|
||||
$app.showAvatarDialog($app.avatarDialog.id);
|
||||
}
|
||||
});
|
||||
|
||||
// #endregion
|
||||
// #region | API: Notification
|
||||
|
||||
@@ -6253,7 +6259,7 @@ speechSynthesis.getVoices();
|
||||
|
||||
var withCompany = this.lastLocation.playerList.size > 1;
|
||||
if (this.autoStateChangeNoFriends) {
|
||||
withCompany = this.lastLocation.friendList.size > 1;
|
||||
withCompany = this.lastLocation.friendList.size >= 1;
|
||||
}
|
||||
|
||||
var currentStatus = API.currentUser.status;
|
||||
@@ -10317,10 +10323,28 @@ speechSynthesis.getVoices();
|
||||
continue;
|
||||
}
|
||||
if (unityPackage.platform === 'standalonewindows') {
|
||||
if (
|
||||
unityPackage.performanceRating === 'None' &&
|
||||
pc.performanceRating
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
pc = unityPackage;
|
||||
} else if (unityPackage.platform === 'android') {
|
||||
if (
|
||||
unityPackage.performanceRating === 'None' &&
|
||||
android.performanceRating
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
android = unityPackage;
|
||||
} else if (unityPackage.platform === 'ios') {
|
||||
if (
|
||||
unityPackage.performanceRating === 'None' &&
|
||||
ios.performanceRating
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
ios = unityPackage;
|
||||
}
|
||||
}
|
||||
@@ -12019,7 +12043,6 @@ speechSynthesis.getVoices();
|
||||
message: 'Imposter deleted',
|
||||
type: 'success'
|
||||
});
|
||||
this.showAvatarDialog(D.id);
|
||||
return args;
|
||||
});
|
||||
break;
|
||||
@@ -16346,8 +16369,12 @@ speechSynthesis.getVoices();
|
||||
};
|
||||
|
||||
$app.methods.getAndDisplayScreenshotFromFile = async function () {
|
||||
var filePath = await AppApi.OpenFileSelectorDialog(await AppApi.GetVRChatPhotosLocation(), ".png", "PNG Files (*.png)|*.png");
|
||||
if (filePath === "") {
|
||||
var filePath = await AppApi.OpenFileSelectorDialog(
|
||||
await AppApi.GetVRChatPhotosLocation(),
|
||||
'.png',
|
||||
'PNG Files (*.png)|*.png'
|
||||
);
|
||||
if (filePath === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22247,7 +22274,7 @@ speechSynthesis.getVoices();
|
||||
var unityPackage = D.ref.unityPackages[i];
|
||||
if (
|
||||
unityPackage.variant &&
|
||||
unityPackage.variant !== 'standard' &&
|
||||
// unityPackage.variant !== 'standard' &&
|
||||
unityPackage.variant !== 'security'
|
||||
) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user