Место общения программистов C#
Anonymous
Почему я не могу создать растровый карту, когда использую 3DS Max SDK?
Сообщение
Anonymous » 26 июн 2025, 08:46
Когда я создаю растровое изображение, используя C#, он всегда не может создать должным образом.
Код: Выделить всё
// Crop bitmap
public static void CropBitmap(IPBBitmap InBitmap, float clipU, float clipV, float clipW, float clipH)
{
string filename = InBitmap.Bi.PathEx.CStr;
string actualPath = GetActualPath(filename);
string actualFileName = System.IO.Path.GetFileName(actualPath);
string actualFilePath = System.IO.Path.GetDirectoryName(actualPath);
string actualFileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(actualPath);
string actualFileExtension = System.IO.Path.GetExtension(actualPath);
string newFileName = System.IO.Path.Combine(actualFilePath, $"{actualFileNameWithoutExtension}_crop{actualFileExtension}");
float width = InBitmap.Bi.Width * clipW;
float height = InBitmap.Bi.Height * clipH;
var inBitmapInfo = InBitmap.Bi;
IBitmapInfo bitmapInfo = InBitmap.Bi;
bitmapInfo.SetType(inBitmapInfo.Type);
bitmapInfo.SetGamma(inBitmapInfo.Gamma);
bitmapInfo.SetWidth((ushort)width);
bitmapInfo.SetHeight((ushort)height);
bitmapInfo.SetName(newFileName);
Debug.Print($"Bi : {bitmapInfo}");
// RedHaloCore.Global is GlobalInterface.Instance
IBitmap newBitmap = RedHaloCore.Global.TheManager.Create(bitmapInfo);
if (newBitmap == null)
{
Debug.Print($"new bitmap: {newBitmap}");
}
else
{
Debug.Print($"ERROR, can't create bitmap");
}
}
< /code>
печатное сообщение: < /p>
bi: autodesk.max.wrappers.bitmapinfo < /p>
Ошибка, не могу создать растровый < /p>
< /blockquote>
, когда я использую их, (я использую. возвращается всегда null .
Подробнее здесь:
https://stackoverflow.com/questions/796 ... ds-max-sdk
1750916768
Anonymous
Когда я создаю растровое изображение, используя C#, он всегда не может создать должным образом.[code]// Crop bitmap public static void CropBitmap(IPBBitmap InBitmap, float clipU, float clipV, float clipW, float clipH) { string filename = InBitmap.Bi.PathEx.CStr; string actualPath = GetActualPath(filename); string actualFileName = System.IO.Path.GetFileName(actualPath); string actualFilePath = System.IO.Path.GetDirectoryName(actualPath); string actualFileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(actualPath); string actualFileExtension = System.IO.Path.GetExtension(actualPath); string newFileName = System.IO.Path.Combine(actualFilePath, $"{actualFileNameWithoutExtension}_crop{actualFileExtension}"); float width = InBitmap.Bi.Width * clipW; float height = InBitmap.Bi.Height * clipH; var inBitmapInfo = InBitmap.Bi; IBitmapInfo bitmapInfo = InBitmap.Bi; bitmapInfo.SetType(inBitmapInfo.Type); bitmapInfo.SetGamma(inBitmapInfo.Gamma); bitmapInfo.SetWidth((ushort)width); bitmapInfo.SetHeight((ushort)height); bitmapInfo.SetName(newFileName); Debug.Print($"Bi : {bitmapInfo}"); // RedHaloCore.Global is GlobalInterface.Instance IBitmap newBitmap = RedHaloCore.Global.TheManager.Create(bitmapInfo); if (newBitmap == null) { Debug.Print($"new bitmap: {newBitmap}"); } else { Debug.Print($"ERROR, can't create bitmap"); } } < /code> печатное сообщение: < /p> bi: autodesk.max.wrappers.bitmapinfo < /p> Ошибка, не могу создать растровый < /p> < /blockquote> , когда я использую их, (я использую. возвращается всегда null [/code]. Подробнее здесь: [url]https://stackoverflow.com/questions/79679837/why-cant-i-create-a-bitmap-when-i-use-3ds-max-sdk[/url]