2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Merged in cwalther/cwe/cursors2 (pull request #10)

Improved Cursors

This is the second attempt at getting the following improvements to the Uru mouse cursors into CWE-ou:

* fix the blurriness
* add a subtle shadow to fix cursors being invisible on light backgrounds
* cleaner, more regular appearance

A (slightly outdated) picture for comparison is at http://forums.openuru.org/viewtopic.php?t=558&p=4265#p4265 , and anyone who has played on Gehn, TOC, or any other shard using the H'uru client has already seen the new cursors.

In order to do this properly, in a way that will continue to work in a cross-platform future, a lot of work done by Deledrius in the H'uru fork is included: He added PNG support to Plasma and introduced a client resource manager that loads resources such as the cursors, but also voice chat indicators and the loading linking book animation, which were also replaced by higher-quality recreations, fromfile instead of from Windows resources. resource.data

This also opens the way for other applications of PNG, such as saving the local copies of KI pictures in a lossless format instead of the heavily compressed JPEG we currently have.

Note: the new code requires a newer version of libpng than included with the CWE sources. Like other library dependencies, this must be installed separately. Instructions for that are at http://wiki.openuru.org/index.php?title=Build_the_client_with_MSVC_2003#Build_steps .
This commit is contained in:
Christian Walther
2012-10-13 00:28:09 +02:00
252 changed files with 4896 additions and 70915 deletions

View File

@ -176,6 +176,13 @@ void pyImage::SaveAsJPEG(const wchar* fileName, UInt8 quality)
plJPEG::Instance().WriteToFile( fileName, this->GetImage() );
}
#include "../plGImage/plPNG.h"
void pyImage::SaveAsPNG(const wchar* fileName)
{
plPNG::Instance().WriteToFile( fileName, this->GetImage() );
}
#include "hsResMgr.h"
#include "../pnKeyedObject/plUoid.h"
PyObject* pyImage::LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16 height)

View File

@ -166,6 +166,7 @@ public:
UInt32 GetWidth(); // returns the width of the image
UInt32 GetHeight(); // returns the height of the image
void SaveAsJPEG(const wchar* fileName, UInt8 quality = 75);
void SaveAsPNG(const wchar* fileName);
static PyObject* LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16 height); // returns pyImage
#endif
};

View File

@ -174,6 +174,41 @@ PYTHON_METHOD_DEFINITION(ptImage, saveAsJPEG, args)
PYTHON_RETURN_ERROR;
}
}
PYTHON_METHOD_DEFINITION(ptImage, saveAsPNG, args)
{
PyObject* filenameObj;
if (!PyArg_ParseTuple(args, "O", &filenameObj))
{
PyErr_SetString(PyExc_TypeError, "saveAsPNG expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(filenameObj))
{
int strLen = PyUnicode_GetSize(filenameObj);
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen);
text[strLen] = L'\0';
self->fThis->SaveAsPNG(text);
delete [] text;
PYTHON_RETURN_NONE;
}
else if (PyString_Check(filenameObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(filenameObj);
wchar_t* wText = hsStringToWString(text);
self->fThis->SaveAsPNG(wText);
delete [] wText;
PYTHON_RETURN_NONE;
}
else
{
PyErr_SetString(PyExc_TypeError, "saveAsPNG expects a string");
PYTHON_RETURN_ERROR;
}
}
#endif // BUILDING_PYPLASMA
PYTHON_START_METHODS_TABLE(ptImage)
@ -183,6 +218,7 @@ PYTHON_START_METHODS_TABLE(ptImage)
PYTHON_METHOD_NOARGS(ptImage, getWidth, "Returns the width of the image"),
PYTHON_METHOD_NOARGS(ptImage, getHeight, "Returns the height of the image"),
PYTHON_METHOD(ptImage, saveAsJPEG, "Params: filename,quality=75\nSaves this image to disk as a JPEG file"),
PYTHON_METHOD(ptImage, saveAsPNG, "Params: filename\nSaves this image to disk as a PNG file"),
#endif
PYTHON_END_METHODS_TABLE;