Test-case for issue #25369
#include <Image_AlienPixMap.hxx>
#include <gp.hxx>
#include <TCollection_AsciiString.hxx>
#include <Image_AlienPixMap.hxx>
#include <gp.hxx>
#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <fstream>
#include <algorithm>
#include <fstream>
#include <algorithm>
bool Image_AlienPixMap::Load (const TCollection_AsciiString& theImagePath)
{
Clear();
bool Image_AlienPixMap::Load (const TCollection_AsciiString& theImagePath)
{
Clear();
+
+#ifdef _WIN32
+ const TCollection_ExtendedString aFileNameW (theImagePath.ToCString(), Standard_True);
+ FREE_IMAGE_FORMAT aFIF = FreeImage_GetFileTypeU ((const wchar_t* )aFileNameW.ToExtString(), 0);
+#else
FREE_IMAGE_FORMAT aFIF = FreeImage_GetFileType (theImagePath.ToCString(), 0);
FREE_IMAGE_FORMAT aFIF = FreeImage_GetFileType (theImagePath.ToCString(), 0);
if (aFIF == FIF_UNKNOWN)
{
// no signature? try to guess the file format from the file extension
if (aFIF == FIF_UNKNOWN)
{
// no signature? try to guess the file format from the file extension
aLoadFlags = ICO_MAKEALPHA;
}
aLoadFlags = ICO_MAKEALPHA;
}
- FIBITMAP* anImage = FreeImage_Load (aFIF, theImagePath.ToCString(), aLoadFlags);
+#ifdef _WIN32
+ FIBITMAP* anImage = FreeImage_LoadU (aFIF, (const wchar_t* )aFileNameW.ToExtString(), aLoadFlags);
+#else
+ FIBITMAP* anImage = FreeImage_Load (aFIF, theImagePath.ToCString(), aLoadFlags);
+#endif
if (anImage == NULL)
{
return false;
if (anImage == NULL)
{
return false;
+#ifdef _WIN32
+ const TCollection_ExtendedString aFileNameW (theFileName.ToCString(), Standard_True);
+ FILE* aFile = _wfopen ((const wchar_t* )aFileNameW.ToExtString(), L"wb");
+#else
FILE* aFile = fopen (theFileName.ToCString(), "wb");
FILE* aFile = fopen (theFileName.ToCString(), "wb");
if (aFile == NULL)
{
return false;
if (aFile == NULL)
{
return false;
+#ifdef _WIN32
+ const TCollection_ExtendedString aFileNameW (theFileName.ToCString(), Standard_True);
+ FREE_IMAGE_FORMAT anImageFormat = FreeImage_GetFIFFromFilenameU ((const wchar_t* )aFileNameW.ToExtString());
+#else
FREE_IMAGE_FORMAT anImageFormat = FreeImage_GetFIFFromFilename (theFileName.ToCString());
FREE_IMAGE_FORMAT anImageFormat = FreeImage_GetFIFFromFilename (theFileName.ToCString());
if (anImageFormat == FIF_UNKNOWN)
{
std::cerr << "Image_PixMap, image format doesn't supported!\n";
if (anImageFormat == FIF_UNKNOWN)
{
std::cerr << "Image_PixMap, image format doesn't supported!\n";
- bool isSaved = (FreeImage_Save (anImageFormat, anImageToDump, theFileName.ToCString()) != FALSE);
+#ifdef _WIN32
+ bool isSaved = (FreeImage_SaveU (anImageFormat, anImageToDump, (const wchar_t* )aFileNameW.ToExtString()) != FALSE);
+#else
+ bool isSaved = (FreeImage_Save (anImageFormat, anImageToDump, theFileName.ToCString()) != FALSE);
+#endif
if (anImageToDump != myLibImage)
{
FreeImage_Unload (anImageToDump);
if (anImageToDump != myLibImage)
{
FreeImage_Unload (anImageToDump);
// function : AdjustGamma
// purpose :
// =======================================================================
// function : AdjustGamma
// purpose :
// =======================================================================
-#ifdef HAVE_FREEIMAGE
-Standard_EXPORT bool Image_AlienPixMap::AdjustGamma (const Standard_Real theGammaCorr)
+bool Image_AlienPixMap::AdjustGamma (const Standard_Real theGammaCorr)
return FreeImage_AdjustGamma (myLibImage, theGammaCorr) != FALSE;
return FreeImage_AdjustGamma (myLibImage, theGammaCorr) != FALSE;
-Standard_EXPORT bool Image_AlienPixMap::AdjustGamma (const Standard_Real)
-{
- return false;
-}
+ (void )theGammaCorr;
+ return false;
--- /dev/null
+puts "========"
+puts "OCC25369"
+puts "========"
+puts ""
+###################################################################################################
+# Visualization, Image_AlienPixMap - handle UTF-8 names in image read/save operations on Windows
+###################################################################################################
+
+box b 1 2 3
+vinit View1
+vclear
+vsetdispmode 0
+vdisplay b
+vfit
+set s [encoding convertfrom unicode "\x3A\x04\x30\x04\x40\x04\x2E\x00\x70\x00\x6E\x00\x67\x00"]
+
+vdrawtext $s 0 0 0 255 255 255 0 0 0 0 50 0 Times 1
+vdump $::imagedir/$s
+vtexture b $::imagedir/$s
+
+set only_screen 1