1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

misc optimisations

This commit is contained in:
jules 2007-06-17 16:02:59 +00:00
parent 00e469d8ac
commit bfdb48d4bc
53 changed files with 1852 additions and 1877 deletions

View file

@ -52,8 +52,8 @@ BEGIN_JUCE_NAMESPACE
#include "../../juce_core/threads/juce_Process.h"
#include "../../juce_core/threads/juce_InterProcessLock.h"
void juce_setCurrentExecutableFileName (const String& filename);
void juce_setCurrentThreadName (const String& name);
void juce_setCurrentExecutableFileName (const String& filename) throw();
void juce_setCurrentThreadName (const String& name) throw();
static JUCEApplication* appInstance = 0;
@ -302,7 +302,7 @@ int JUCEApplication::main (int argc, char* argv[],
static bool juceInitialisedGUI = false;
void JUCE_API initialiseJuce_GUI()
void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI()
{
if (! juceInitialisedGUI)
{
@ -335,7 +335,7 @@ void JUCE_API initialiseJuce_GUI()
}
}
void JUCE_API shutdownJuce_GUI()
void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI()
{
if (juceInitialisedGUI)
{

View file

@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MessageListener::MessageListener() throw()
JUCE_CALLTYPE MessageListener::MessageListener() throw()
{
// are you trying to create a messagelistener before or after juce has been intialised??
jassert (MessageManager::instance != 0);
@ -46,13 +46,13 @@ MessageListener::MessageListener() throw()
MessageManager::instance->messageListeners.add (this);
}
MessageListener::~MessageListener()
JUCE_CALLTYPE MessageListener::~MessageListener()
{
if (MessageManager::instance != 0)
MessageManager::instance->messageListeners.removeValue (this);
}
void MessageListener::postMessage (Message* const message) const throw()
void JUCE_CALLTYPE MessageListener::postMessage (Message* const message) const throw()
{
message->messageRecipient = const_cast <MessageListener*> (this);
@ -62,7 +62,7 @@ void MessageListener::postMessage (Message* const message) const throw()
MessageManager::instance->postMessageToQueue (message);
}
bool MessageListener::isValidMessageListener() const throw()
bool JUCE_CALLTYPE MessageListener::isValidMessageListener() const throw()
{
return (MessageManager::instance != 0)
&& MessageManager::instance->messageListeners.contains (this);

View file

@ -46,7 +46,7 @@ class JUCE_API MessageListener
protected:
//==============================================================================
/** Creates a MessageListener. */
MessageListener() throw();
JUCE_CALLTYPE MessageListener() throw();
public:
//==============================================================================
@ -56,7 +56,7 @@ public:
of registered listeners, so that the isValidMessageListener() method
will no longer return true.
*/
virtual ~MessageListener();
virtual JUCE_CALLTYPE ~MessageListener();
//==============================================================================
/** This is the callback method that receives incoming messages.
@ -78,7 +78,7 @@ public:
references to it after calling this method.
@see handleMessage
*/
void postMessage (Message* const message) const throw();
void JUCE_CALLTYPE postMessage (Message* const message) const throw();
//==============================================================================
/** Checks whether this MessageListener has been deleted.
@ -92,7 +92,7 @@ public:
exact same memory location, but I can't think of a good way of avoiding
this.
*/
bool isValidMessageListener() const throw();
bool JUCE_CALLTYPE isValidMessageListener() const throw();
};

View file

@ -52,7 +52,7 @@ MessageManager* MessageManager::instance = 0;
static const int quitMessageId = 0xfffff321;
MessageManager::MessageManager() throw()
JUCE_CALLTYPE MessageManager::MessageManager() throw()
: broadcastListeners (0),
quitMessagePosted (false),
quitMessageReceived (false),
@ -67,7 +67,7 @@ MessageManager::MessageManager() throw()
currentLockingThreadId = messageThreadId = Thread::getCurrentThreadId();
}
MessageManager::~MessageManager() throw()
JUCE_CALLTYPE MessageManager::~MessageManager() throw()
{
jassert (instance == this);
instance = 0;
@ -76,7 +76,7 @@ MessageManager::~MessageManager() throw()
doPlatformSpecificShutdown();
}
MessageManager* MessageManager::getInstance() throw()
MessageManager* JUCE_CALLTYPE MessageManager::getInstance() throw()
{
if (instance == 0)
{
@ -89,7 +89,7 @@ MessageManager* MessageManager::getInstance() throw()
return instance;
}
void MessageManager::postMessageToQueue (Message* const message)
void JUCE_CALLTYPE MessageManager::postMessageToQueue (Message* const message)
{
if (quitMessagePosted || ! juce_postMessageToSystemQueue (message))
delete message;
@ -97,7 +97,7 @@ void MessageManager::postMessageToQueue (Message* const message)
//==============================================================================
// not for public use..
void MessageManager::deliverMessage (void* message)
void JUCE_CALLTYPE MessageManager::deliverMessage (void* message)
{
const MessageManagerLock lock;
@ -130,8 +130,8 @@ void MessageManager::deliverMessage (void* message)
}
//==============================================================================
bool MessageManager::dispatchNextMessage (const bool returnImmediatelyIfNoMessages,
bool* const wasAMessageDispatched)
bool JUCE_CALLTYPE MessageManager::dispatchNextMessage (const bool returnImmediatelyIfNoMessages,
bool* const wasAMessageDispatched)
{
if (quitMessageReceived)
{
@ -163,7 +163,7 @@ bool MessageManager::dispatchNextMessage (const bool returnImmediatelyIfNoMessag
return result || ! returnImmediatelyIfNoMessages;
}
void MessageManager::dispatchPendingMessages (int maxNumberOfMessagesToDispatch)
void JUCE_CALLTYPE MessageManager::dispatchPendingMessages (int maxNumberOfMessagesToDispatch)
{
jassert (isThisTheMessageThread()); // must only be called by the message thread
@ -187,7 +187,7 @@ void MessageManager::dispatchPendingMessages (int maxNumberOfMessagesToDispatch)
}
}
bool MessageManager::runDispatchLoop()
bool JUCE_CALLTYPE MessageManager::runDispatchLoop()
{
jassert (isThisTheMessageThread()); // must only be called by the message thread
@ -199,7 +199,7 @@ bool MessageManager::runDispatchLoop()
}
//==============================================================================
void MessageManager::postQuitMessage (const bool useMaximumForce)
void JUCE_CALLTYPE MessageManager::postQuitMessage (const bool useMaximumForce)
{
if (! quitMessagePosted)
{
@ -213,13 +213,13 @@ void MessageManager::postQuitMessage (const bool useMaximumForce)
}
}
bool MessageManager::hasQuitMessageBeenPosted() const
bool JUCE_CALLTYPE MessageManager::hasQuitMessageBeenPosted() const
{
return quitMessagePosted;
}
//==============================================================================
void MessageManager::deliverBroadcastMessage (const String& value)
void JUCE_CALLTYPE MessageManager::deliverBroadcastMessage (const String& value)
{
if (broadcastListeners == 0)
broadcastListeners = new ActionListenerList();
@ -227,7 +227,7 @@ void MessageManager::deliverBroadcastMessage (const String& value)
broadcastListeners->sendActionMessage (value);
}
void MessageManager::registerBroadcastListener (ActionListener* listener)
void JUCE_CALLTYPE MessageManager::registerBroadcastListener (ActionListener* listener)
{
if (broadcastListeners == 0)
broadcastListeners = new ActionListenerList();
@ -235,7 +235,7 @@ void MessageManager::registerBroadcastListener (ActionListener* listener)
broadcastListeners->addActionListener (listener);
}
void MessageManager::deregisterBroadcastListener (ActionListener* listener)
void JUCE_CALLTYPE MessageManager::deregisterBroadcastListener (ActionListener* listener)
{
if (broadcastListeners == 0)
broadcastListeners = new ActionListenerList();
@ -246,13 +246,13 @@ void MessageManager::deregisterBroadcastListener (ActionListener* listener)
//==============================================================================
// This gets called occasionally by the timer thread (to save using an extra thread
// for it).
void MessageManager::inactivityCheckCallback()
void JUCE_CALLTYPE MessageManager::inactivityCheckCallback()
{
if (instance != 0)
instance->inactivityCheckCallbackInt();
}
void MessageManager::inactivityCheckCallbackInt()
void JUCE_CALLTYPE MessageManager::inactivityCheckCallbackInt()
{
const unsigned int now = Time::getApproximateMillisecondCounter();
@ -277,7 +277,7 @@ void MessageManager::inactivityCheckCallbackInt()
}
}
void MessageManager::delayWaitCursor()
void JUCE_CALLTYPE MessageManager::delayWaitCursor()
{
if (instance != 0)
{
@ -291,7 +291,7 @@ void MessageManager::delayWaitCursor()
}
}
void MessageManager::setTimeBeforeShowingWaitCursor (const int millisecs)
void JUCE_CALLTYPE MessageManager::setTimeBeforeShowingWaitCursor (const int millisecs)
{
// if this is a bit too small you'll get a lot of unwanted hourglass cursors..
jassert (millisecs <= 0 || millisecs > 200);
@ -311,28 +311,28 @@ void MessageManager::timerCallback()
++messageCounter;
}
int MessageManager::getTimeBeforeShowingWaitCursor() const
int JUCE_CALLTYPE MessageManager::getTimeBeforeShowingWaitCursor() const
{
return timeBeforeWaitCursor;
}
bool MessageManager::isThisTheMessageThread() const
bool JUCE_CALLTYPE MessageManager::isThisTheMessageThread() const
{
return Thread::getCurrentThreadId() == messageThreadId;
}
void MessageManager::setCurrentMessageThread (const int threadId)
void JUCE_CALLTYPE MessageManager::setCurrentMessageThread (const int threadId)
{
messageThreadId = threadId;
}
bool MessageManager::currentThreadHasLockedMessageManager() const
bool JUCE_CALLTYPE MessageManager::currentThreadHasLockedMessageManager() const
{
return Thread::getCurrentThreadId() == currentLockingThreadId;
}
//==============================================================================
MessageManagerLock::MessageManagerLock()
JUCE_CALLTYPE MessageManagerLock::MessageManagerLock()
{
if (MessageManager::instance != 0)
{
@ -342,7 +342,7 @@ MessageManagerLock::MessageManagerLock()
}
}
MessageManagerLock::~MessageManagerLock()
JUCE_CALLTYPE MessageManagerLock::~MessageManagerLock()
{
if (MessageManager::instance != 0)
{

View file

@ -56,7 +56,7 @@ class JUCE_API MessageManager : private DeletedAtShutdown,
public:
//==============================================================================
/** Returns the global instance of the MessageManager. */
static MessageManager* getInstance() throw();
static MessageManager* JUCE_CALLTYPE getInstance() throw();
//==============================================================================
/** Synchronously dispatches up to a certain number of messages from the queue.
@ -64,7 +64,7 @@ public:
This will return when the queue becomes empty, or when the given number of
messages has been sent.
*/
void dispatchPendingMessages (int maxNumberOfMessagesToDispatch = 1000);
void JUCE_CALLTYPE dispatchPendingMessages (int maxNumberOfMessagesToDispatch = 1000);
/** Synchronously sends the next pending message.
@ -79,8 +79,8 @@ public:
@returns false if the thing that's calling it should stop calling - i.e. if the
app is trying to quit.
*/
bool dispatchNextMessage (const bool returnImmediatelyIfNoMessages = false,
bool* const wasAMessageDispatched = 0);
bool JUCE_CALLTYPE dispatchNextMessage (const bool returnImmediatelyIfNoMessages = false,
bool* const wasAMessageDispatched = 0);
//==============================================================================
/** Calls a function using the message-thread.
@ -101,25 +101,25 @@ public:
@returns the value that the callback function returns.
@see MessageManagerLock
*/
void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
void* JUCE_CALLTYPE callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
/** Returns true if the caller-thread is the message thread. */
bool isThisTheMessageThread() const;
bool JUCE_CALLTYPE isThisTheMessageThread() const;
/** Called to tell the manager which thread is the one that's running the dispatch loop.
(Best to ignore this method unless you really know what you're doing..)
@see getCurrentMessageThread
*/
void setCurrentMessageThread (const int threadId);
void JUCE_CALLTYPE setCurrentMessageThread (const int threadId);
/** Returns the ID of the current message thread, as set by setCurrentMessageThread().
(Best to ignore this method unless you really know what you're doing..)
@see setCurrentMessageThread
*/
int getCurrentMessageThread() const throw() { return messageThreadId; }
int JUCE_CALLTYPE getCurrentMessageThread() const throw() { return messageThreadId; }
/** Returns true if the caller thread has currenltly got the message manager locked.
@ -128,7 +128,7 @@ public:
This will be true if the caller is the message thread, because that automatically
gains a lock while a message is being dispatched.
*/
bool currentThreadHasLockedMessageManager() const;
bool JUCE_CALLTYPE currentThreadHasLockedMessageManager() const;
//==============================================================================
/** Sends a message to all other JUCE applications that are running.
@ -137,7 +137,7 @@ public:
method of the broadcast listeners in the other app.
@see registerBroadcastListener, ActionListener
*/
static void broadcastMessage (const String& messageText);
static void JUCE_CALLTYPE broadcastMessage (const String& messageText);
/** Registers a listener to get told about broadcast messages.
@ -146,10 +146,10 @@ public:
@see broadcastMessage
*/
void registerBroadcastListener (ActionListener* listener);
void JUCE_CALLTYPE registerBroadcastListener (ActionListener* listener);
/** Deregisters a broadcast listener. */
void deregisterBroadcastListener (ActionListener* listener);
void JUCE_CALLTYPE deregisterBroadcastListener (ActionListener* listener);
//==============================================================================
/** Sets a time-limit for the app to be 'busy' before an hourglass cursor will be shown.
@ -159,30 +159,30 @@ public:
Mac the system might still decide to show it after a while).
@see MouseCursor::showWaitCursor
*/
void setTimeBeforeShowingWaitCursor (const int millisecs);
void JUCE_CALLTYPE setTimeBeforeShowingWaitCursor (const int millisecs);
/** Returns the time-out before the 'busy' cursor is shown when the app is busy.
@see setTimeBeforeShowingWaitCursor, MouseCursor::showWaitCursor
*/
int getTimeBeforeShowingWaitCursor() const;
int JUCE_CALLTYPE getTimeBeforeShowingWaitCursor() const;
/** Tells the message manager that the system isn't locked-up, even if the message
loop isn't active.
Used internally, this is handy when an OS enters its own modal loop.
*/
static void delayWaitCursor();
static void JUCE_CALLTYPE delayWaitCursor();
//==============================================================================
/** Returns true if JUCEApplication::quit() has been called. */
bool hasQuitMessageBeenPosted() const;
bool JUCE_CALLTYPE hasQuitMessageBeenPosted() const;
//==============================================================================
/** @internal */
void deliverMessage (void*);
void JUCE_CALLTYPE deliverMessage (void*);
/** @internal */
void deliverBroadcastMessage (const String&);
void JUCE_CALLTYPE deliverBroadcastMessage (const String&);
/** @internal */
void timerCallback();
@ -210,16 +210,16 @@ private:
int volatile timeBeforeWaitCursor;
unsigned int lastActivityCheckOkTime;
bool runDispatchLoop();
void postMessageToQueue (Message* const message);
void postQuitMessage (const bool useMaximumForce);
bool JUCE_CALLTYPE runDispatchLoop();
void JUCE_CALLTYPE postMessageToQueue (Message* const message);
void JUCE_CALLTYPE postQuitMessage (const bool useMaximumForce);
static void doPlatformSpecificInitialisation();
static void doPlatformSpecificShutdown();
friend class InternalTimerThread;
static void inactivityCheckCallback();
void inactivityCheckCallbackInt();
static void JUCE_CALLTYPE inactivityCheckCallback();
void JUCE_CALLTYPE inactivityCheckCallbackInt();
friend class MessageManagerLock;
CriticalSection messageDispatchLock;
@ -274,14 +274,14 @@ public:
If the current thread already has the lock, nothing will be done, so it's perfectly
safe to create these locks recursively.
*/
MessageManagerLock();
JUCE_CALLTYPE MessageManagerLock();
/** Releases the current thread's lock on the message manager.
Make sure this object is created and deleted by the same thread,
otherwise there are no guarantees what will happen!
*/
~MessageManagerLock();
JUCE_CALLTYPE ~MessageManagerLock();
private:
int lastLockingThreadId;

View file

@ -61,7 +61,7 @@ private:
InternalTimerThread (const InternalTimerThread&);
const InternalTimerThread& operator= (const InternalTimerThread&);
void addTimer (Timer* const t) throw()
void JUCE_CALLTYPE addTimer (Timer* const t) throw()
{
#ifdef JUCE_DEBUG
Timer* tt = firstTimer;
@ -106,7 +106,7 @@ private:
notify();
}
void removeTimer (Timer* const t) throw()
void JUCE_CALLTYPE removeTimer (Timer* const t) throw()
{
#ifdef JUCE_DEBUG
Timer* tt = firstTimer;
@ -319,7 +319,7 @@ void juce_callAnyTimersSynchronously()
static SortedSet <Timer*> activeTimers;
#endif
Timer::Timer() throw()
JUCE_CALLTYPE Timer::Timer() throw()
: countdownMs (0),
periodMs (0),
previous (0),
@ -330,7 +330,7 @@ Timer::Timer() throw()
#endif
}
Timer::Timer (const Timer&) throw()
JUCE_CALLTYPE Timer::Timer (const Timer&) throw()
: countdownMs (0),
periodMs (0),
previous (0),
@ -341,7 +341,7 @@ Timer::Timer (const Timer&) throw()
#endif
}
Timer::~Timer()
JUCE_CALLTYPE Timer::~Timer()
{
stopTimer();
@ -350,7 +350,7 @@ Timer::~Timer()
#endif
}
void Timer::startTimer (const int interval) throw()
void JUCE_CALLTYPE Timer::startTimer (const int interval) throw()
{
const ScopedLock sl (InternalTimerThread::lock);
@ -371,7 +371,7 @@ void Timer::startTimer (const int interval) throw()
}
}
void Timer::stopTimer() throw()
void JUCE_CALLTYPE Timer::stopTimer() throw()
{
const ScopedLock sl (InternalTimerThread::lock);

View file

@ -65,19 +65,19 @@ protected:
When created, the timer is stopped, so use startTimer() to get it going.
*/
Timer() throw();
JUCE_CALLTYPE Timer() throw();
/** Creates a copy of another timer.
Note that this timer won't be started, even if the one you're copying
is running.
*/
Timer (const Timer& other) throw();
JUCE_CALLTYPE Timer (const Timer& other) throw();
public:
//==============================================================================
/** Destructor. */
virtual ~Timer();
virtual JUCE_CALLTYPE ~Timer();
//==============================================================================
/** The user-defined callback routine that actually gets called periodically.
@ -97,7 +97,7 @@ public:
@param intervalInMilliseconds the interval to use (any values less than 1 will be
rounded up to 1)
*/
void startTimer (const int intervalInMilliseconds) throw();
void JUCE_CALLTYPE startTimer (const int intervalInMilliseconds) throw();
/** Stops the timer.
@ -107,20 +107,20 @@ public:
be currently executing may be allowed to finish before the method
returns.
*/
void stopTimer() throw();
void JUCE_CALLTYPE stopTimer() throw();
//==============================================================================
/** Checks if the timer has been started.
@returns true if the timer is running.
*/
bool isTimerRunning() const throw() { return periodMs > 0; }
bool JUCE_CALLTYPE isTimerRunning() const throw() { return periodMs > 0; }
/** Returns the timer's interval.
@returns the timer's interval in milliseconds if it's running, or 0 if it's not.
*/
int getTimerInterval() const throw() { return periodMs; }
int JUCE_CALLTYPE getTimerInterval() const throw() { return periodMs; }
//==============================================================================

View file

@ -37,10 +37,10 @@ BEGIN_JUCE_NAMESPACE
#include "../juce_Component.h"
#include "../../../../juce_core/threads/juce_ScopedLock.h"
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY);
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type);
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw();
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw();
// isStandard set depending on which interface was used to create the cursor
void juce_deleteMouseCursor (void* cursorHandle, bool isStandard);
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw();
//==============================================================================
@ -51,7 +51,7 @@ static VoidArray standardCursors (2);
class RefCountedMouseCursor
{
public:
RefCountedMouseCursor (MouseCursor::StandardCursorType t)
RefCountedMouseCursor (const MouseCursor::StandardCursorType t) throw()
: refCount (1),
standardType (t),
isStandard (true)
@ -62,7 +62,7 @@ public:
RefCountedMouseCursor (Image& image,
const int hotSpotX,
const int hotSpotY)
const int hotSpotY) throw()
: refCount (1),
standardType (MouseCursor::NormalCursor),
isStandard (false)
@ -70,13 +70,13 @@ public:
handle = juce_createMouseCursorFromImage (image, hotSpotX, hotSpotY);
}
~RefCountedMouseCursor()
~RefCountedMouseCursor() throw()
{
juce_deleteMouseCursor (handle, isStandard);
standardCursors.removeValue (this);
}
void decRef()
void decRef() throw()
{
if (--refCount == 0)
delete this;
@ -92,7 +92,7 @@ public:
return handle;
}
static RefCountedMouseCursor* findInstance (MouseCursor::StandardCursorType type)
static RefCountedMouseCursor* findInstance (MouseCursor::StandardCursorType type) throw()
{
const ScopedLock sl (mouseCursorLock);
@ -116,8 +116,10 @@ public:
private:
void* handle;
int refCount;
MouseCursor::StandardCursorType standardType;
bool isStandard;
const MouseCursor::StandardCursorType standardType;
const bool isStandard;
const RefCountedMouseCursor& operator= (const RefCountedMouseCursor&);
};
@ -134,7 +136,7 @@ MouseCursor::MouseCursor (const StandardCursorType type) throw()
MouseCursor::MouseCursor (Image& image,
const int hotSpotX,
const int hotSpotY)
const int hotSpotY) throw()
{
cursorHandle = new RefCountedMouseCursor (image, hotSpotX, hotSpotY);
}
@ -181,13 +183,13 @@ void* MouseCursor::getHandle() const throw()
return cursorHandle->getHandle();
}
void MouseCursor::showWaitCursor()
void MouseCursor::showWaitCursor() throw()
{
MouseCursor mc (MouseCursor::WaitCursor);
mc.showInAllWindows();
}
void MouseCursor::hideWaitCursor()
void MouseCursor::hideWaitCursor() throw()
{
if (Component::getComponentUnderMouse()->isValidComponent())
{

View file

@ -96,7 +96,7 @@ public:
*/
MouseCursor (Image& image,
const int hotSpotX,
const int hotSpotY);
const int hotSpotY) throw();
//==============================================================================
/** Creates a copy of another cursor object. */
@ -135,7 +135,7 @@ public:
@see MessageManager::setTimeBeforeShowingWaitCursor
*/
static void showWaitCursor();
static void showWaitCursor() throw();
/** If showWaitCursor has been called, this will return the mouse to its
normal state.
@ -145,7 +145,7 @@ public:
@see showWaitCursor
*/
static void hideWaitCursor();
static void hideWaitCursor() throw();
//==============================================================================

View file

@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
static forcedinline uint8 floatAlphaToInt (const float alpha)
static forcedinline uint8 JUCE_CALLTYPE floatAlphaToInt (const float alpha)
{
return (uint8) jlimit (0, 0xff, roundFloatToInt (alpha * 255.0f));
}
@ -46,57 +46,57 @@ static const float oneOver255 = 1.0f / 255.0f;
//==============================================================================
Colour::Colour() throw()
JUCE_CALLTYPE Colour::Colour() throw()
: argb (0)
{
}
Colour::Colour (const Colour& other) throw()
JUCE_CALLTYPE Colour::Colour (const Colour& other) throw()
: argb (other.argb)
{
}
const Colour& Colour::operator= (const Colour& other) throw()
const Colour& JUCE_CALLTYPE Colour::operator= (const Colour& other) throw()
{
argb = other.argb;
return *this;
}
bool Colour::operator== (const Colour& other) const throw()
bool JUCE_CALLTYPE Colour::operator== (const Colour& other) const throw()
{
return argb.getARGB() == other.argb.getARGB();
}
bool Colour::operator!= (const Colour& other) const throw()
bool JUCE_CALLTYPE Colour::operator!= (const Colour& other) const throw()
{
return argb.getARGB() != other.argb.getARGB();
}
//==============================================================================
Colour::Colour (const uint32 argb_) throw()
JUCE_CALLTYPE Colour::Colour (const uint32 argb_) throw()
: argb (argb_)
{
}
Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue) throw()
JUCE_CALLTYPE Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue) throw()
{
argb.setARGB (0xff, red, green, blue);
}
Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const uint8 alpha) throw()
JUCE_CALLTYPE Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const uint8 alpha) throw()
{
argb.setARGB (alpha, red, green, blue);
}
Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const float alpha) throw()
JUCE_CALLTYPE Colour::Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const float alpha) throw()
{
argb.setARGB (floatAlphaToInt (alpha), red, green, blue);
}
@ -168,10 +168,10 @@ static void convertHSBtoRGB (float h, const float s, float v,
}
}
Colour::Colour (const float hue,
const float saturation,
const float brightness,
const float alpha) throw()
JUCE_CALLTYPE Colour::Colour (const float hue,
const float saturation,
const float brightness,
const float alpha) throw()
{
uint8 r = getRed(), g = getGreen(), b = getBlue();
convertHSBtoRGB (hue, saturation, brightness, r, g, b);
@ -179,10 +179,10 @@ Colour::Colour (const float hue,
argb.setARGB (floatAlphaToInt (alpha), r, g, b);
}
Colour::Colour (const float hue,
const float saturation,
const float brightness,
const uint8 alpha) throw()
JUCE_CALLTYPE Colour::Colour (const float hue,
const float saturation,
const float brightness,
const uint8 alpha) throw()
{
uint8 r = getRed(), g = getGreen(), b = getBlue();
convertHSBtoRGB (hue, saturation, brightness, r, g, b);
@ -190,51 +190,51 @@ Colour::Colour (const float hue,
argb.setARGB (alpha, r, g, b);
}
Colour::~Colour() throw()
JUCE_CALLTYPE Colour::~Colour() throw()
{
}
//==============================================================================
const PixelARGB Colour::getPixelARGB() const throw()
const PixelARGB JUCE_CALLTYPE Colour::getPixelARGB() const throw()
{
PixelARGB p (argb);
p.premultiply();
return p;
}
uint32 Colour::getARGB() const throw()
uint32 JUCE_CALLTYPE Colour::getARGB() const throw()
{
return argb.getARGB();
}
//==============================================================================
bool Colour::isTransparent() const throw()
bool JUCE_CALLTYPE Colour::isTransparent() const throw()
{
return getAlpha() == 0;
}
bool Colour::isOpaque() const throw()
bool JUCE_CALLTYPE Colour::isOpaque() const throw()
{
return getAlpha() == 0xff;
}
const Colour Colour::withAlpha (const uint8 newAlpha) const throw()
const Colour JUCE_CALLTYPE Colour::withAlpha (const uint8 newAlpha) const throw()
{
return Colour (getRed(), getGreen(), getBlue(), newAlpha);
}
const Colour Colour::withAlpha (const float newAlpha) const throw()
const Colour JUCE_CALLTYPE Colour::withAlpha (const float newAlpha) const throw()
{
return withAlpha (floatAlphaToInt (newAlpha));
}
const Colour Colour::withMultipliedAlpha (const float alphaMultiplier) const throw()
const Colour JUCE_CALLTYPE Colour::withMultipliedAlpha (const float alphaMultiplier) const throw()
{
return withAlpha ((uint8) jlimit (0, 0xff, roundFloatToInt (alphaMultiplier * getAlpha())));
}
//==============================================================================
const Colour Colour::overlaidWith (const Colour& src) const throw()
const Colour JUCE_CALLTYPE Colour::overlaidWith (const Colour& src) const throw()
{
const int destAlpha = getAlpha();
@ -262,28 +262,28 @@ const Colour Colour::overlaidWith (const Colour& src) const throw()
}
//==============================================================================
float Colour::getFloatRed() const throw()
float JUCE_CALLTYPE Colour::getFloatRed() const throw()
{
return getRed() * oneOver255;
}
float Colour::getFloatGreen() const throw()
float JUCE_CALLTYPE Colour::getFloatGreen() const throw()
{
return getGreen() * oneOver255;
}
float Colour::getFloatBlue() const throw()
float JUCE_CALLTYPE Colour::getFloatBlue() const throw()
{
return getBlue() * oneOver255;
}
float Colour::getFloatAlpha() const throw()
float JUCE_CALLTYPE Colour::getFloatAlpha() const throw()
{
return getAlpha() * oneOver255;
}
//==============================================================================
void Colour::getHSB (float& h, float& s, float& v) const throw()
void JUCE_CALLTYPE Colour::getHSB (float& h, float& s, float& v) const throw()
{
const int r = getRed();
const int g = getGreen();
@ -331,14 +331,14 @@ void Colour::getHSB (float& h, float& s, float& v) const throw()
}
//==============================================================================
float Colour::getHue() const throw()
float JUCE_CALLTYPE Colour::getHue() const throw()
{
float h, s, b;
getHSB (h, s, b);
return h;
}
const Colour Colour::withHue (const float hue) const throw()
const Colour JUCE_CALLTYPE Colour::withHue (const float hue) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -346,7 +346,7 @@ const Colour Colour::withHue (const float hue) const throw()
return Colour (hue, s, b, getAlpha());
}
const Colour Colour::withRotatedHue (const float amountToRotate) const throw()
const Colour JUCE_CALLTYPE Colour::withRotatedHue (const float amountToRotate) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -358,14 +358,14 @@ const Colour Colour::withRotatedHue (const float amountToRotate) const throw()
}
//==============================================================================
float Colour::getSaturation() const throw()
float JUCE_CALLTYPE Colour::getSaturation() const throw()
{
float h, s, b;
getHSB (h, s, b);
return s;
}
const Colour Colour::withSaturation (const float saturation) const throw()
const Colour JUCE_CALLTYPE Colour::withSaturation (const float saturation) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -373,7 +373,7 @@ const Colour Colour::withSaturation (const float saturation) const throw()
return Colour (h, saturation, b, getAlpha());
}
const Colour Colour::withMultipliedSaturation (const float amount) const throw()
const Colour JUCE_CALLTYPE Colour::withMultipliedSaturation (const float amount) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -382,14 +382,14 @@ const Colour Colour::withMultipliedSaturation (const float amount) const throw()
}
//==============================================================================
float Colour::getBrightness() const throw()
float JUCE_CALLTYPE Colour::getBrightness() const throw()
{
float h, s, b;
getHSB (h, s, b);
return b;
}
const Colour Colour::withBrightness (const float brightness) const throw()
const Colour JUCE_CALLTYPE Colour::withBrightness (const float brightness) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -397,7 +397,7 @@ const Colour Colour::withBrightness (const float brightness) const throw()
return Colour (h, s, brightness, getAlpha());
}
const Colour Colour::withMultipliedBrightness (const float amount) const throw()
const Colour JUCE_CALLTYPE Colour::withMultipliedBrightness (const float amount) const throw()
{
float h, s, b;
getHSB (h, s, b);
@ -411,7 +411,7 @@ const Colour Colour::withMultipliedBrightness (const float amount) const throw()
}
//==============================================================================
const Colour Colour::brighter (float amount) const throw()
const Colour JUCE_CALLTYPE Colour::brighter (float amount) const throw()
{
amount = 1.0f / (1.0f + amount);
@ -421,7 +421,7 @@ const Colour Colour::brighter (float amount) const throw()
getAlpha());
}
const Colour Colour::darker (float amount) const throw()
const Colour JUCE_CALLTYPE Colour::darker (float amount) const throw()
{
amount = 1.0f / (1.0f + amount);
@ -432,7 +432,7 @@ const Colour Colour::darker (float amount) const throw()
}
//==============================================================================
const Colour Colour::greyLevel (const float brightness) throw()
const Colour JUCE_CALLTYPE Colour::greyLevel (const float brightness) throw()
{
const uint8 level
= (uint8) jlimit (0x00, 0xff, roundFloatToInt (brightness * 255.0f));
@ -441,15 +441,15 @@ const Colour Colour::greyLevel (const float brightness) throw()
}
//==============================================================================
const Colour Colour::contrasting (const float amount) const throw()
const Colour JUCE_CALLTYPE Colour::contrasting (const float amount) const throw()
{
return overlaidWith ((((int) getRed() + (int) getGreen() + (int) getBlue() >= 3 * 128)
? Colours::black
: Colours::white).withAlpha (amount));
}
const Colour Colour::contrasting (const Colour& colour1,
const Colour& colour2) throw()
const Colour JUCE_CALLTYPE Colour::contrasting (const Colour& colour1,
const Colour& colour2) throw()
{
const float b1 = colour1.getBrightness();
const float b2 = colour2.getBrightness();
@ -474,12 +474,12 @@ const Colour Colour::contrasting (const Colour& colour1,
}
//==============================================================================
const String Colour::toString() const throw()
const String JUCE_CALLTYPE Colour::toString() const throw()
{
return String::toHexString ((int) argb.getARGB());
}
const Colour Colour::fromString (const String& encodedColourString)
const Colour JUCE_CALLTYPE Colour::fromString (const String& encodedColourString)
{
return Colour ((uint32) encodedColourString.getHexValue32());
}

View file

@ -46,10 +46,10 @@ class JUCE_API Colour
public:
//==============================================================================
/** Creates a transparent black colour. */
Colour() throw();
JUCE_CALLTYPE Colour() throw();
/** Creates a copy of another Colour object. */
Colour (const Colour& other) throw();
JUCE_CALLTYPE Colour (const Colour& other) throw();
/** Creates a colour from a 32-bit ARGB value.
@ -61,28 +61,28 @@ public:
@see getPixelARGB
*/
explicit Colour (const uint32 argb) throw();
explicit JUCE_CALLTYPE Colour (const uint32 argb) throw();
/** Creates an opaque colour using 8-bit red, green and blue values */
Colour (const uint8 red,
const uint8 green,
const uint8 blue) throw();
JUCE_CALLTYPE Colour (const uint8 red,
const uint8 green,
const uint8 blue) throw();
/** Creates a colour using 8-bit red, green, blue and alpha values. */
Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const uint8 alpha) throw();
JUCE_CALLTYPE Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const uint8 alpha) throw();
/** Creates a colour from 8-bit red, green, and blue values, and a floating-point alpha.
Alpha of 0.0 is transparent, alpha of 1.0f is opaque.
Values outside the valid range will be clipped.
*/
Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const float alpha) throw();
JUCE_CALLTYPE Colour (const uint8 red,
const uint8 green,
const uint8 blue,
const float alpha) throw();
/** Creates a colour using floating point hue, saturation and brightness values, and an 8-bit alpha.
@ -90,116 +90,116 @@ public:
An alpha of 0x00 is completely transparent, alpha of 0xff is opaque.
Values outside the valid range will be clipped.
*/
Colour (const float hue,
const float saturation,
const float brightness,
const uint8 alpha) throw();
JUCE_CALLTYPE Colour (const float hue,
const float saturation,
const float brightness,
const uint8 alpha) throw();
/** Creates a colour using floating point hue, saturation, brightness and alpha values.
All values must be between 0.0 and 1.0.
Numbers outside the valid range will be clipped.
*/
Colour (const float hue,
const float saturation,
const float brightness,
const float alpha) throw();
JUCE_CALLTYPE Colour (const float hue,
const float saturation,
const float brightness,
const float alpha) throw();
/** Destructor. */
~Colour() throw();
JUCE_CALLTYPE ~Colour() throw();
/** Copies another Colour object. */
const Colour& operator= (const Colour& other) throw();
const Colour& JUCE_CALLTYPE operator= (const Colour& other) throw();
/** Compares two colours. */
bool operator== (const Colour& other) const throw();
bool JUCE_CALLTYPE operator== (const Colour& other) const throw();
/** Compares two colours. */
bool operator!= (const Colour& other) const throw();
bool JUCE_CALLTYPE operator!= (const Colour& other) const throw();
//==============================================================================
/** Returns the red component of this colour.
@returns a value between 0x00 and 0xff.
*/
uint8 getRed() const throw() { return argb.getRed(); }
uint8 JUCE_CALLTYPE getRed() const throw() { return argb.getRed(); }
/** Returns the green component of this colour.
@returns a value between 0x00 and 0xff.
*/
uint8 getGreen() const throw() { return argb.getGreen(); }
uint8 JUCE_CALLTYPE getGreen() const throw() { return argb.getGreen(); }
/** Returns the blue component of this colour.
@returns a value between 0x00 and 0xff.
*/
uint8 getBlue() const throw() { return argb.getBlue(); }
uint8 JUCE_CALLTYPE getBlue() const throw() { return argb.getBlue(); }
/** Returns the red component of this colour as a floating point value.
@returns a value between 0.0 and 1.0
*/
float getFloatRed() const throw();
float JUCE_CALLTYPE getFloatRed() const throw();
/** Returns the green component of this colour as a floating point value.
@returns a value between 0.0 and 1.0
*/
float getFloatGreen() const throw();
float JUCE_CALLTYPE getFloatGreen() const throw();
/** Returns the blue component of this colour as a floating point value.
@returns a value between 0.0 and 1.0
*/
float getFloatBlue() const throw();
float JUCE_CALLTYPE getFloatBlue() const throw();
/** Returns a premultiplied ARGB pixel object that represents this colour.
*/
const PixelARGB getPixelARGB() const throw();
const PixelARGB JUCE_CALLTYPE getPixelARGB() const throw();
/** Returns a 32-bit integer that represents this colour.
The format of this number is:
((alpha << 24) | (red << 16) | (green << 16) | blue).
*/
uint32 getARGB() const throw();
uint32 JUCE_CALLTYPE getARGB() const throw();
//==============================================================================
/** Returns the colour's alpha (opacity).
Alpha of 0x00 is completely transparent, 0xff is completely opaque.
*/
uint8 getAlpha() const throw() { return argb.getAlpha(); }
uint8 JUCE_CALLTYPE getAlpha() const throw() { return argb.getAlpha(); }
/** Returns the colour's alpha (opacity) as a floating point value.
Alpha of 0.0 is completely transparent, 1.0 is completely opaque.
*/
float getFloatAlpha() const throw();
float JUCE_CALLTYPE getFloatAlpha() const throw();
/** Returns true if this colour is completely opaque.
Equivalent to (getAlpha() == 0xff).
*/
bool isOpaque() const throw();
bool JUCE_CALLTYPE isOpaque() const throw();
/** Returns true if this colour is completely transparent.
Equivalent to (getAlpha() == 0x00).
*/
bool isTransparent() const throw();
bool JUCE_CALLTYPE isTransparent() const throw();
/** Returns a colour that's the same colour as this one, but with a new alpha value. */
const Colour withAlpha (const uint8 newAlpha) const throw();
const Colour JUCE_CALLTYPE withAlpha (const uint8 newAlpha) const throw();
/** Returns a colour that's the same colour as this one, but with a new alpha value. */
const Colour withAlpha (const float newAlpha) const throw();
const Colour JUCE_CALLTYPE withAlpha (const float newAlpha) const throw();
/** Returns a colour that's the same colour as this one, but with a modified alpha value.
The new colour's alpha will be this object's alpha multiplied by the value passed-in.
*/
const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
const Colour JUCE_CALLTYPE withMultipliedAlpha (const float alphaMultiplier) const throw();
//==============================================================================
/** Returns a colour that is the result of alpha-compositing a new colour over this one.
@ -207,42 +207,42 @@ public:
If the foreground colour is semi-transparent, it is blended onto this colour
accordingly.
*/
const Colour overlaidWith (const Colour& foregroundColour) const throw();
const Colour JUCE_CALLTYPE overlaidWith (const Colour& foregroundColour) const throw();
//==============================================================================
/** Returns the colour's hue component.
The value returned is in the range 0.0 to 1.0
*/
float getHue() const throw();
float JUCE_CALLTYPE getHue() const throw();
/** Returns the colour's saturation component.
The value returned is in the range 0.0 to 1.0
*/
float getSaturation() const throw();
float JUCE_CALLTYPE getSaturation() const throw();
/** Returns the colour's brightness component.
The value returned is in the range 0.0 to 1.0
*/
float getBrightness() const throw();
float JUCE_CALLTYPE getBrightness() const throw();
/** Returns the colour's hue, saturation and brightness components all at once.
The values returned are in the range 0.0 to 1.0
*/
void getHSB (float& hue,
float& saturation,
float& brightness) const throw();
void JUCE_CALLTYPE getHSB (float& hue,
float& saturation,
float& brightness) const throw();
//==============================================================================
/** Returns a copy of this colour with a different hue. */
const Colour withHue (const float newHue) const throw();
const Colour JUCE_CALLTYPE withHue (const float newHue) const throw();
/** Returns a copy of this colour with a different saturation. */
const Colour withSaturation (const float newSaturation) const throw();
const Colour JUCE_CALLTYPE withSaturation (const float newSaturation) const throw();
/** Returns a copy of this colour with a different brightness.
@see brighter, darker, withMultipliedBrightness
*/
const Colour withBrightness (const float newBrightness) const throw();
const Colour JUCE_CALLTYPE withBrightness (const float newBrightness) const throw();
/** Returns a copy of this colour with it hue rotated.
@ -250,21 +250,21 @@ public:
@see brighter, darker, withMultipliedBrightness
*/
const Colour withRotatedHue (const float amountToRotate) const throw();
const Colour JUCE_CALLTYPE withRotatedHue (const float amountToRotate) const throw();
/** Returns a copy of this colour with its saturation multiplied by the given value.
The new colour's saturation is (this->getSaturation() * multiplier)
(the result is clipped to legal limits).
*/
const Colour withMultipliedSaturation (const float multiplier) const throw();
const Colour JUCE_CALLTYPE withMultipliedSaturation (const float multiplier) const throw();
/** Returns a copy of this colour with its brightness multiplied by the given value.
The new colour's saturation is (this->getBrightness() * multiplier)
(the result is clipped to legal limits).
*/
const Colour withMultipliedBrightness (const float amount) const throw();
const Colour JUCE_CALLTYPE withMultipliedBrightness (const float amount) const throw();
//==============================================================================
/** Returns a brighter version of this colour.
@ -273,7 +273,7 @@ public:
unchanged, and higher values make it brighter
@see withMultipliedBrightness
*/
const Colour brighter (float amountBrighter = 0.4f) const throw();
const Colour JUCE_CALLTYPE brighter (float amountBrighter = 0.4f) const throw();
/** Returns a darker version of this colour.
@ -281,7 +281,7 @@ public:
unchanged, and higher values make it darker
@see withMultipliedBrightness
*/
const Colour darker (float amountDarker = 0.4f) const throw();
const Colour JUCE_CALLTYPE darker (float amountDarker = 0.4f) const throw();
//==============================================================================
/** Returns a colour that will be clearly visible against this colour.
@ -291,7 +291,7 @@ public:
that's just a little bit lighter; Colours::black.contrasting (1.0f) will
return white; Colours::white.contrasting (1.0f) will return black, etc.
*/
const Colour contrasting (const float amount = 1.0f) const throw();
const Colour JUCE_CALLTYPE contrasting (const float amount = 1.0f) const throw();
/** Returns a colour that contrasts against two colours.
@ -299,26 +299,26 @@ public:
Handy for things like choosing a highlight colour in text editors, etc.
*/
static const Colour contrasting (const Colour& colour1,
const Colour& colour2) throw();
static const Colour JUCE_CALLTYPE contrasting (const Colour& colour1,
const Colour& colour2) throw();
//==============================================================================
/** Returns an opaque shade of grey.
@param brightness the level of grey to return - 0 is black, 1.0 is white
*/
static const Colour greyLevel (const float brightness) throw();
static const Colour JUCE_CALLTYPE greyLevel (const float brightness) throw();
//==============================================================================
/** Returns a stringified version of this colour.
The string can be turned back into a colour using the fromString() method.
*/
const String toString() const throw();
const String JUCE_CALLTYPE toString() const throw();
/** Reads the colour from a string that was created with toString().
*/
static const Colour fromString (const String& encodedColourString);
static const Colour JUCE_CALLTYPE fromString (const String& encodedColourString);
//==============================================================================
juce_UseDebuggingNewOperator

View file

@ -53,7 +53,7 @@ LowLevelGraphicsContext::~LowLevelGraphicsContext()
}
//==============================================================================
Graphics::Graphics (Image& imageToDrawOnto)
JUCE_CALLTYPE Graphics::Graphics (Image& imageToDrawOnto) throw()
: context (imageToDrawOnto.createLowLevelContext()),
ownsContext (true),
state (new GraphicsState()),
@ -61,7 +61,7 @@ Graphics::Graphics (Image& imageToDrawOnto)
{
}
Graphics::Graphics (LowLevelGraphicsContext* const internalContext)
JUCE_CALLTYPE Graphics::Graphics (LowLevelGraphicsContext* const internalContext) throw()
: context (internalContext),
ownsContext (false),
state (new GraphicsState()),
@ -69,7 +69,7 @@ Graphics::Graphics (LowLevelGraphicsContext* const internalContext)
{
}
Graphics::~Graphics() throw()
JUCE_CALLTYPE Graphics::~Graphics() throw()
{
delete state;
@ -78,55 +78,55 @@ Graphics::~Graphics() throw()
}
//==============================================================================
void Graphics::resetToDefaultState()
void JUCE_CALLTYPE Graphics::resetToDefaultState() throw()
{
setColour (Colours::black);
state->font.resetToDefaultState();
state->quality = defaultQuality;
}
bool Graphics::isVectorDevice() const
bool JUCE_CALLTYPE Graphics::isVectorDevice() const throw()
{
return context->isVectorDevice();
}
bool Graphics::reduceClipRegion (const int x, const int y,
const int w, const int h)
bool JUCE_CALLTYPE Graphics::reduceClipRegion (const int x, const int y,
const int w, const int h) throw()
{
saveStateIfPending();
return context->reduceClipRegion (x, y, w, h);
}
bool Graphics::reduceClipRegion (const RectangleList& clipRegion)
bool JUCE_CALLTYPE Graphics::reduceClipRegion (const RectangleList& clipRegion) throw()
{
saveStateIfPending();
return context->reduceClipRegion (clipRegion);
}
void Graphics::excludeClipRegion (const int x, const int y,
const int w, const int h)
void JUCE_CALLTYPE Graphics::excludeClipRegion (const int x, const int y,
const int w, const int h) throw()
{
saveStateIfPending();
context->excludeClipRegion (x, y, w, h);
}
bool Graphics::isClipEmpty() const
bool JUCE_CALLTYPE Graphics::isClipEmpty() const throw()
{
return context->isClipEmpty();
}
const Rectangle Graphics::getClipBounds() const
const Rectangle JUCE_CALLTYPE Graphics::getClipBounds() const throw()
{
return context->getClipBounds();
}
void Graphics::saveState()
void JUCE_CALLTYPE Graphics::saveState() throw()
{
saveStateIfPending();
saveStatePending = true;
}
void Graphics::restoreState()
void JUCE_CALLTYPE Graphics::restoreState() throw()
{
if (saveStatePending)
{
@ -154,7 +154,7 @@ void Graphics::restoreState()
}
}
void Graphics::saveStateIfPending()
void JUCE_CALLTYPE Graphics::saveStateIfPending() throw()
{
if (saveStatePending)
{
@ -165,39 +165,39 @@ void Graphics::saveStateIfPending()
}
}
void Graphics::setOrigin (const int newOriginX,
const int newOriginY)
void JUCE_CALLTYPE Graphics::setOrigin (const int newOriginX,
const int newOriginY) throw()
{
saveStateIfPending();
context->setOrigin (newOriginX, newOriginY);
}
bool Graphics::clipRegionIntersects (const int x, const int y,
const int w, const int h) const throw()
bool JUCE_CALLTYPE Graphics::clipRegionIntersects (const int x, const int y,
const int w, const int h) const throw()
{
return context->clipRegionIntersects (x, y, w, h);
}
//==============================================================================
void Graphics::setColour (const Colour& newColour) throw()
void JUCE_CALLTYPE Graphics::setColour (const Colour& newColour) throw()
{
saveStateIfPending();
state->colour = newColour;
deleteAndZero (state->brush);
}
const Colour& Graphics::getCurrentColour() const throw()
const Colour& JUCE_CALLTYPE Graphics::getCurrentColour() const throw()
{
return state->colour;
}
void Graphics::setOpacity (const float newOpacity) throw()
void JUCE_CALLTYPE Graphics::setOpacity (const float newOpacity) throw()
{
saveStateIfPending();
state->colour = state->colour.withAlpha (newOpacity);
}
void Graphics::setBrush (const Brush* const newBrush)
void JUCE_CALLTYPE Graphics::setBrush (const Brush* const newBrush) throw()
{
saveStateIfPending();
delete state->brush;
@ -209,14 +209,14 @@ void Graphics::setBrush (const Brush* const newBrush)
}
//==============================================================================
Graphics::GraphicsState::GraphicsState()
JUCE_CALLTYPE Graphics::GraphicsState::GraphicsState() throw()
: colour (Colours::black),
brush (0),
quality (defaultQuality)
{
}
Graphics::GraphicsState::GraphicsState (const GraphicsState& other)
JUCE_CALLTYPE Graphics::GraphicsState::GraphicsState (const GraphicsState& other) throw()
: colour (other.colour),
brush (other.brush != 0 ? other.brush->createCopy() : 0),
font (other.font),
@ -224,34 +224,34 @@ Graphics::GraphicsState::GraphicsState (const GraphicsState& other)
{
}
Graphics::GraphicsState::~GraphicsState()
JUCE_CALLTYPE Graphics::GraphicsState::~GraphicsState() throw()
{
delete brush;
}
//==============================================================================
void Graphics::setFont (const Font& newFont) throw()
void JUCE_CALLTYPE Graphics::setFont (const Font& newFont) throw()
{
saveStateIfPending();
state->font = newFont;
}
void Graphics::setFont (const float newFontHeight,
const int newFontStyleFlags) throw()
void JUCE_CALLTYPE Graphics::setFont (const float newFontHeight,
const int newFontStyleFlags) throw()
{
saveStateIfPending();
state->font.setSizeAndStyle (newFontHeight, newFontStyleFlags, 1.0f, 0.0f);
}
const Font& Graphics::getCurrentFont() const
const Font& JUCE_CALLTYPE Graphics::getCurrentFont() const throw()
{
return state->font;
}
//==============================================================================
void Graphics::drawSingleLineText (const String& text,
const int startX,
const int baselineY) const
void JUCE_CALLTYPE Graphics::drawSingleLineText (const String& text,
const int startX,
const int baselineY) const throw()
{
if (text.isNotEmpty()
&& startX < context->getClipBounds().getRight())
@ -262,8 +262,8 @@ void Graphics::drawSingleLineText (const String& text,
}
}
void Graphics::drawTextAsPath (const String& text,
const AffineTransform& transform) const
void JUCE_CALLTYPE Graphics::drawTextAsPath (const String& text,
const AffineTransform& transform) const throw()
{
if (text.isNotEmpty())
{
@ -273,10 +273,10 @@ void Graphics::drawTextAsPath (const String& text,
}
}
void Graphics::drawMultiLineText (const String& text,
const int startX,
const int baselineY,
const int maximumLineWidth) const
void JUCE_CALLTYPE Graphics::drawMultiLineText (const String& text,
const int startX,
const int baselineY,
const int maximumLineWidth) const throw()
{
if (text.isNotEmpty()
&& startX < context->getClipBounds().getRight())
@ -289,13 +289,13 @@ void Graphics::drawMultiLineText (const String& text,
}
}
void Graphics::drawText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationType,
const bool useEllipsesIfTooBig) const
void JUCE_CALLTYPE Graphics::drawText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationType,
const bool useEllipsesIfTooBig) const throw()
{
if (text.isNotEmpty() && context->clipRegionIntersects (x, y, width, height))
{
@ -313,14 +313,14 @@ void Graphics::drawText (const String& text,
}
}
void Graphics::drawFittedText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justification,
const int maximumNumberOfLines,
const float minimumHorizontalScale) const
void JUCE_CALLTYPE Graphics::drawFittedText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justification,
const int maximumNumberOfLines,
const float minimumHorizontalScale) const throw()
{
if (text.isNotEmpty()
&& width > 0 && height > 0
@ -340,16 +340,16 @@ void Graphics::drawFittedText (const String& text,
}
//==============================================================================
void Graphics::fillRect (int x,
int y,
int width,
int height) const
void JUCE_CALLTYPE Graphics::fillRect (int x,
int y,
int width,
int height) const throw()
{
SolidColourBrush colourBrush (state->colour);
(state->brush != 0 ? *(state->brush) : (Brush&) colourBrush).paintRectangle (*context, x, y, width, height);
}
void Graphics::fillRect (const Rectangle& r) const
void JUCE_CALLTYPE Graphics::fillRect (const Rectangle& r) const throw()
{
fillRect (r.getX(),
r.getY(),
@ -357,17 +357,17 @@ void Graphics::fillRect (const Rectangle& r) const
r.getHeight());
}
void Graphics::fillRect (const float x,
const float y,
const float width,
const float height) const
void JUCE_CALLTYPE Graphics::fillRect (const float x,
const float y,
const float width,
const float height) const throw()
{
Path p;
p.addRectangle (x, y, width, height);
fillPath (p);
}
void Graphics::setPixel (int x, int y) const
void JUCE_CALLTYPE Graphics::setPixel (int x, int y) const throw()
{
if (context->clipRegionIntersects (x, y, 1, 1))
{
@ -376,12 +376,12 @@ void Graphics::setPixel (int x, int y) const
}
}
void Graphics::fillAll() const
void JUCE_CALLTYPE Graphics::fillAll() const throw()
{
fillRect (context->getClipBounds());
}
void Graphics::fillAll (const Colour& colourToUse) const
void JUCE_CALLTYPE Graphics::fillAll (const Colour& colourToUse) const throw()
{
if (! colourToUse.isTransparent())
{
@ -394,8 +394,8 @@ void Graphics::fillAll (const Colour& colourToUse) const
//==============================================================================
void Graphics::fillPath (const Path& path,
const AffineTransform& transform) const
void JUCE_CALLTYPE Graphics::fillPath (const Path& path,
const AffineTransform& transform) const throw()
{
if ((! context->isClipEmpty()) && ! path.isEmpty())
{
@ -404,9 +404,9 @@ void Graphics::fillPath (const Path& path,
}
}
void Graphics::strokePath (const Path& path,
const PathStrokeType& strokeType,
const AffineTransform& transform) const
void JUCE_CALLTYPE Graphics::strokePath (const Path& path,
const PathStrokeType& strokeType,
const AffineTransform& transform) const throw()
{
if (! state->colour.isTransparent())
{
@ -417,11 +417,11 @@ void Graphics::strokePath (const Path& path,
}
//==============================================================================
void Graphics::drawRect (const int x,
const int y,
const int width,
const int height,
const int lineThickness) const
void JUCE_CALLTYPE Graphics::drawRect (const int x,
const int y,
const int width,
const int height,
const int lineThickness) const throw()
{
SolidColourBrush colourBrush (state->colour);
Brush& b = (state->brush != 0 ? *(state->brush) : (Brush&) colourBrush);
@ -432,14 +432,14 @@ void Graphics::drawRect (const int x,
b.paintRectangle (*context, x, y + height - lineThickness, width, lineThickness);
}
void Graphics::drawBevel (const int x,
const int y,
const int width,
const int height,
const int bevelThickness,
const Colour& topLeftColour,
const Colour& bottomRightColour,
const bool useGradient) const
void JUCE_CALLTYPE Graphics::drawBevel (const int x,
const int y,
const int width,
const int height,
const int bevelThickness,
const Colour& topLeftColour,
const Colour& bottomRightColour,
const bool useGradient) const throw()
{
if (clipRegionIntersects (x, y, width, height))
{
@ -460,57 +460,57 @@ void Graphics::drawBevel (const int x,
}
//==============================================================================
void Graphics::fillEllipse (const float x,
const float y,
const float width,
const float height) const
void JUCE_CALLTYPE Graphics::fillEllipse (const float x,
const float y,
const float width,
const float height) const throw()
{
Path p;
p.addEllipse (x, y, width, height);
fillPath (p);
}
void Graphics::drawEllipse (const float x,
const float y,
const float width,
const float height,
const float lineThickness) const
void JUCE_CALLTYPE Graphics::drawEllipse (const float x,
const float y,
const float width,
const float height,
const float lineThickness) const throw()
{
Path p;
p.addEllipse (x, y, width, height);
strokePath (p, PathStrokeType (lineThickness));
}
void Graphics::fillRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize) const
void JUCE_CALLTYPE Graphics::fillRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize) const throw()
{
Path p;
p.addRoundedRectangle (x, y, width, height, cornerSize);
fillPath (p);
}
void Graphics::drawRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize,
const float lineThickness) const
void JUCE_CALLTYPE Graphics::drawRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize,
const float lineThickness) const throw()
{
Path p;
p.addRoundedRectangle (x, y, width, height, cornerSize);
strokePath (p, PathStrokeType (lineThickness));
}
void Graphics::drawArrow (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness,
const float arrowheadWidth,
const float arrowheadLength) const
void JUCE_CALLTYPE Graphics::drawArrow (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness,
const float arrowheadWidth,
const float arrowheadLength) const throw()
{
Path p;
p.addArrow (startX, startY, endX, endY,
@ -518,12 +518,12 @@ void Graphics::drawArrow (const float startX,
fillPath (p);
}
void Graphics::fillCheckerBoard (int x, int y,
int width, int height,
const int checkWidth,
const int checkHeight,
const Colour& colour1,
const Colour& colour2) const
void JUCE_CALLTYPE Graphics::fillCheckerBoard (int x, int y,
int width, int height,
const int checkWidth,
const int checkHeight,
const Colour& colour1,
const Colour& colour2) const throw()
{
jassert (checkWidth > 0 && checkHeight > 0); // can't be zero or less!
@ -560,20 +560,20 @@ void Graphics::fillCheckerBoard (int x, int y,
}
//==============================================================================
void Graphics::drawVerticalLine (const int x, float top, float bottom) const
void JUCE_CALLTYPE Graphics::drawVerticalLine (const int x, float top, float bottom) const throw()
{
SolidColourBrush colourBrush (state->colour);
(state->brush != 0 ? *(state->brush) : (Brush&) colourBrush).paintVerticalLine (*context, x, top, bottom);
}
void Graphics::drawHorizontalLine (const int y, float left, float right) const
void JUCE_CALLTYPE Graphics::drawHorizontalLine (const int y, float left, float right) const throw()
{
SolidColourBrush colourBrush (state->colour);
(state->brush != 0 ? *(state->brush) : (Brush&) colourBrush).paintHorizontalLine (*context, y, left, right);
}
void Graphics::drawLine (float x1, float y1,
float x2, float y2) const
void JUCE_CALLTYPE Graphics::drawLine (float x1, float y1,
float x2, float y2) const throw()
{
if (! context->isClipEmpty())
{
@ -582,35 +582,35 @@ void Graphics::drawLine (float x1, float y1,
}
}
void Graphics::drawLine (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness) const
void JUCE_CALLTYPE Graphics::drawLine (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness) const throw()
{
Path p;
p.addLineSegment (startX, startY, endX, endY, lineThickness);
fillPath (p);
}
void Graphics::drawLine (const Line& line) const
void JUCE_CALLTYPE Graphics::drawLine (const Line& line) const throw()
{
drawLine (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY());
}
void Graphics::drawLine (const Line& line,
const float lineThickness) const
void JUCE_CALLTYPE Graphics::drawLine (const Line& line,
const float lineThickness) const throw()
{
drawLine (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY(), lineThickness);
}
void Graphics::drawDashedLine (const float startX,
const float startY,
const float endX,
const float endY,
const float* const dashLengths,
const int numDashLengths,
const float lineThickness) const
void JUCE_CALLTYPE Graphics::drawDashedLine (const float startX,
const float startY,
const float endX,
const float endY,
const float* const dashLengths,
const int numDashLengths,
const float lineThickness) const throw()
{
const double dx = endX - startX;
const double dy = endY - startY;
@ -648,17 +648,17 @@ void Graphics::drawDashedLine (const float startX,
}
//==============================================================================
void Graphics::setImageResamplingQuality (const Graphics::ResamplingQuality newQuality)
void JUCE_CALLTYPE Graphics::setImageResamplingQuality (const Graphics::ResamplingQuality newQuality) throw()
{
saveStateIfPending();
state->quality = newQuality;
}
//==============================================================================
void Graphics::drawImageAt (const Image* const imageToDraw,
const int topLeftX,
const int topLeftY,
const bool fillAlphaChannelWithCurrentBrush) const
void JUCE_CALLTYPE Graphics::drawImageAt (const Image* const imageToDraw,
const int topLeftX,
const int topLeftY,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
if (imageToDraw != 0)
{
@ -672,13 +672,13 @@ void Graphics::drawImageAt (const Image* const imageToDraw,
}
}
void Graphics::drawImageWithin (const Image* const imageToDraw,
const int destX,
const int destY,
const int destW,
const int destH,
const RectanglePlacement& placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const
void JUCE_CALLTYPE Graphics::drawImageWithin (const Image* const imageToDraw,
const int destX,
const int destY,
const int destW,
const int destH,
const RectanglePlacement& placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
if (imageToDraw != 0)
{
@ -706,10 +706,10 @@ void Graphics::drawImageWithin (const Image* const imageToDraw,
}
}
void Graphics::drawImage (const Image* const imageToDraw,
int dx, int dy, int dw, int dh,
int sx, int sy, int sw, int sh,
const bool fillAlphaChannelWithCurrentBrush) const
void JUCE_CALLTYPE Graphics::drawImage (const Image* const imageToDraw,
int dx, int dy, int dw, int dh,
int sx, int sy, int sw, int sh,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
if (imageToDraw == 0 || ! context->clipRegionIntersects (dx, dy, dw, dh))
return;
@ -812,13 +812,13 @@ void Graphics::drawImage (const Image* const imageToDraw,
}
}
void Graphics::drawImageTransformed (const Image* const imageToDraw,
int sourceClipX,
int sourceClipY,
int sourceClipWidth,
int sourceClipHeight,
const AffineTransform& transform,
const bool fillAlphaChannelWithCurrentBrush) const
void JUCE_CALLTYPE Graphics::drawImageTransformed (const Image* const imageToDraw,
int sourceClipX,
int sourceClipY,
int sourceClipWidth,
int sourceClipHeight,
const AffineTransform& transform,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
if (imageToDraw != 0
&& (! context->isClipEmpty())

View file

@ -70,10 +70,10 @@ public:
Obviously you shouldn't delete the image before this context is deleted.
*/
Graphics (Image& imageToDrawOnto);
JUCE_CALLTYPE Graphics (Image& imageToDrawOnto) throw();
/** Destructor. */
~Graphics() throw();
JUCE_CALLTYPE ~Graphics() throw();
//==============================================================================
/** Changes the current drawing colour.
@ -86,7 +86,7 @@ public:
@see setOpacity, setBrush, getColour
*/
void setColour (const Colour& newColour) throw();
void JUCE_CALLTYPE setColour (const Colour& newColour) throw();
/** Returns the colour that's currently being used.
@ -95,7 +95,7 @@ public:
@see setColour
*/
const Colour& getCurrentColour() const throw();
const Colour& JUCE_CALLTYPE getCurrentColour() const throw();
/** Changes the opacity to use with the current colour.
@ -104,7 +104,7 @@ public:
A value of 0.0 is completely transparent, 1.0 is completely opaque.
*/
void setOpacity (const float newOpacity) throw();
void JUCE_CALLTYPE setOpacity (const float newOpacity) throw();
/** Changes the current brush to use for drawing.
@ -116,7 +116,7 @@ public:
@see SolidColourBrush, GradientBrush, ImageBrush, Brush
*/
void setBrush (const Brush* const newBrush);
void JUCE_CALLTYPE setBrush (const Brush* const newBrush) throw();
//==============================================================================
/** Changes the font to use for subsequent text-drawing functions.
@ -126,7 +126,7 @@ public:
@see drawSingleLineText, drawMultiLineText, drawTextAsPath, drawText, drawFittedText
*/
void setFont (const Font& newFont) throw();
void JUCE_CALLTYPE setFont (const Font& newFont) throw();
/** Changes the size and style of the currently-selected font.
@ -135,14 +135,14 @@ public:
@see Font
*/
void setFont (const float newFontHeight,
const int fontStyleFlags = Font::plain) throw();
void JUCE_CALLTYPE setFont (const float newFontHeight,
const int fontStyleFlags = Font::plain) throw();
/** Returns the font that's currently being used for text operations.
@see setFont
*/
const Font& getCurrentFont() const;
const Font& JUCE_CALLTYPE getCurrentFont() const throw();
/** Draws a one-line text string.
@ -154,9 +154,9 @@ public:
@param baselineY the position of the text's baseline
@see drawMultiLineText, drawText, drawFittedText, GlyphArrangement::addLineOfText
*/
void drawSingleLineText (const String& text,
const int startX,
const int baselineY) const;
void JUCE_CALLTYPE drawSingleLineText (const String& text,
const int startX,
const int baselineY) const throw();
/** Draws text across multiple lines.
@ -166,10 +166,10 @@ public:
@see setFont, drawSingleLineText, drawFittedText, GlyphArrangement::addJustifiedText
*/
void drawMultiLineText (const String& text,
const int startX,
const int baselineY,
const int maximumLineWidth) const;
void JUCE_CALLTYPE drawMultiLineText (const String& text,
const int startX,
const int baselineY,
const int maximumLineWidth) const throw();
/** Renders a string of text as a vector path.
@ -179,8 +179,8 @@ public:
@see setFont
*/
void drawTextAsPath (const String& text,
const AffineTransform& transform) const;
void JUCE_CALLTYPE drawTextAsPath (const String& text,
const AffineTransform& transform) const throw();
/** Draws a line of text within a specified rectangle.
@ -191,13 +191,13 @@ public:
@see drawSingleLineText, drawFittedText, drawMultiLineText, GlyphArrangement::addJustifiedText
*/
void drawText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationType,
const bool useEllipsesIfTooBig) const;
void JUCE_CALLTYPE drawText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationType,
const bool useEllipsesIfTooBig) const throw();
/** Tries to draw a text string inside a given space.
@ -218,14 +218,14 @@ public:
@see GlyphArrangement::addFittedText
*/
void drawFittedText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationFlags,
const int maximumNumberOfLines,
const float minimumHorizontalScale = 0.7f) const;
void JUCE_CALLTYPE drawFittedText (const String& text,
const int x,
const int y,
const int width,
const int height,
const Justification& justificationFlags,
const int maximumNumberOfLines,
const float minimumHorizontalScale = 0.7f) const throw();
//==============================================================================
/** Fills the context's entire clip region with the current colour or brush.
@ -233,56 +233,56 @@ public:
(See also the fillAll (const Colour&) method which is a quick way of filling
it with a given colour).
*/
void fillAll() const;
void JUCE_CALLTYPE fillAll() const throw();
/** Fills the context's entire clip region with a given colour.
This leaves the context's current colour and brush unchanged, it just
uses the specified colour temporarily.
*/
void fillAll (const Colour& colourToUse) const;
void JUCE_CALLTYPE fillAll (const Colour& colourToUse) const throw();
//==============================================================================
/** Fills a rectangle with the current colour or brush.
@see drawRect, fillRoundedRectangle
*/
void fillRect (int x,
int y,
int width,
int height) const;
void JUCE_CALLTYPE fillRect (int x,
int y,
int width,
int height) const throw();
/** Fills a rectangle with the current colour or brush. */
void fillRect (const Rectangle& rectangle) const;
void JUCE_CALLTYPE fillRect (const Rectangle& rectangle) const throw();
/** Fills a rectangle with the current colour or brush.
This uses sub-pixel positioning so is slower than the fillRect method which
takes integer co-ordinates.
*/
void fillRect (const float x,
const float y,
const float width,
const float height) const;
void JUCE_CALLTYPE fillRect (const float x,
const float y,
const float width,
const float height) const throw();
/** Uses the current colour or brush to fill a rectangle with rounded corners.
@see drawRoundedRectangle, Path::addRoundedRectangle
*/
void fillRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize) const;
void JUCE_CALLTYPE fillRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize) const throw();
/** Fills a rectangle with a checkerboard pattern, alternating between two colours.
*/
void fillCheckerBoard (int x, int y,
int width, int height,
const int checkWidth,
const int checkHeight,
const Colour& colour1,
const Colour& colour2) const;
void JUCE_CALLTYPE fillCheckerBoard (int x, int y,
int width, int height,
const int checkWidth,
const int checkHeight,
const Colour& colour1,
const Colour& colour2) const throw();
/** Draws four lines to form a rectangular outline, using the current colour or brush.
@ -291,22 +291,22 @@ public:
@see fillRect
*/
void drawRect (const int x,
const int y,
const int width,
const int height,
const int lineThickness = 1) const;
void JUCE_CALLTYPE drawRect (const int x,
const int y,
const int width,
const int height,
const int lineThickness = 1) const throw();
/** Uses the current colour or brush to draw the outline of a rectangle with rounded corners.
@see fillRoundedRectangle, Path::addRoundedRectangle
*/
void drawRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize,
const float lineThickness) const;
void JUCE_CALLTYPE drawRoundedRectangle (const float x,
const float y,
const float width,
const float height,
const float cornerSize,
const float lineThickness) const throw();
/** Draws a 3D raised (or indented) bevel using two colours.
@ -317,18 +317,18 @@ public:
bevel; the bottom-right colour is used for the bottom- and right-hand
edges.
*/
void drawBevel (const int x,
const int y,
const int width,
const int height,
const int bevelThickness,
const Colour& topLeftColour = Colours::white,
const Colour& bottomRightColour = Colours::black,
const bool useGradient = true) const;
void JUCE_CALLTYPE drawBevel (const int x,
const int y,
const int width,
const int height,
const int bevelThickness,
const Colour& topLeftColour = Colours::white,
const Colour& bottomRightColour = Colours::black,
const bool useGradient = true) const throw();
/** Draws a pixel using the current colour or brush.
*/
void setPixel (int x, int y) const;
void JUCE_CALLTYPE setPixel (int x, int y) const throw();
//==============================================================================
/** Fills an ellipse with the current colour or brush.
@ -337,53 +337,53 @@ public:
@see drawEllipse, Path::addEllipse
*/
void fillEllipse (const float x,
const float y,
const float width,
const float height) const;
void JUCE_CALLTYPE fillEllipse (const float x,
const float y,
const float width,
const float height) const throw();
/** Draws an elliptical stroke using the current colour or brush.
@see fillEllipse, Path::addEllipse
*/
void drawEllipse (const float x,
const float y,
const float width,
const float height,
const float lineThickness) const;
void JUCE_CALLTYPE drawEllipse (const float x,
const float y,
const float width,
const float height,
const float lineThickness) const throw();
//==============================================================================
/** Draws a line between two points.
The line is 1 pixel wide and drawn with the current colour or brush.
*/
void drawLine (float startX,
float startY,
float endX,
float endY) const;
void JUCE_CALLTYPE drawLine (float startX,
float startY,
float endX,
float endY) const throw();
/** Draws a line between two points with a given thickness.
@see Path::addLineSegment
*/
void drawLine (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness) const;
void JUCE_CALLTYPE drawLine (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness) const throw();
/** Draws a line between two points.
The line is 1 pixel wide and drawn with the current colour or brush.
*/
void drawLine (const Line& line) const;
void JUCE_CALLTYPE drawLine (const Line& line) const throw();
/** Draws a line between two points with a given thickness.
@see Path::addLineSegment
*/
void drawLine (const Line& line,
const float lineThickness) const;
void JUCE_CALLTYPE drawLine (const Line& line,
const float lineThickness) const throw();
/** Draws a dashed line using a custom set of dash-lengths.
@ -398,39 +398,39 @@ public:
@param lineThickness the thickness of the line to draw
@see PathStrokeType::createDashedStroke
*/
void drawDashedLine (const float startX,
const float startY,
const float endX,
const float endY,
const float* const dashLengths,
const int numDashLengths,
const float lineThickness = 1.0f) const;
void JUCE_CALLTYPE drawDashedLine (const float startX,
const float startY,
const float endX,
const float endY,
const float* const dashLengths,
const int numDashLengths,
const float lineThickness = 1.0f) const throw();
/** Draws a vertical line of pixels at a given x position.
The x position is an integer, but the top and bottom of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.
*/
void drawVerticalLine (const int x, float top, float bottom) const;
void JUCE_CALLTYPE drawVerticalLine (const int x, float top, float bottom) const throw();
/** Draws a horizontal line of pixels at a given y position.
The y position is an integer, but the left and right ends of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.
*/
void drawHorizontalLine (const int y, float left, float right) const;
void JUCE_CALLTYPE drawHorizontalLine (const int y, float left, float right) const throw();
//==============================================================================
/** Fills a path using the currently selected colour or brush.
*/
void fillPath (const Path& path,
const AffineTransform& transform = AffineTransform::identity) const;
void JUCE_CALLTYPE fillPath (const Path& path,
const AffineTransform& transform = AffineTransform::identity) const throw();
/** Draws a path's outline using the currently selected colour or brush.
*/
void strokePath (const Path& path,
const PathStrokeType& strokeType,
const AffineTransform& transform = AffineTransform::identity) const;
void JUCE_CALLTYPE strokePath (const Path& path,
const PathStrokeType& strokeType,
const AffineTransform& transform = AffineTransform::identity) const throw();
/** Draws a line with an arrowhead.
@ -442,13 +442,13 @@ public:
@param arrowheadWidth the width of the arrow head (perpendicular to the line)
@param arrowheadLength the length of the arrow head (along the length of the line)
*/
void drawArrow (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness,
const float arrowheadWidth,
const float arrowheadLength) const;
void JUCE_CALLTYPE drawArrow (const float startX,
const float startY,
const float endX,
const float endY,
const float lineThickness,
const float arrowheadWidth,
const float arrowheadLength) const throw();
//==============================================================================
@ -469,7 +469,7 @@ public:
@see Graphics::drawImage, Graphics::drawImageTransformed, Graphics::drawImageWithin
*/
void setImageResamplingQuality (const ResamplingQuality newQuality);
void JUCE_CALLTYPE setImageResamplingQuality (const ResamplingQuality newQuality) throw();
/** Draws an image.
@ -482,10 +482,10 @@ public:
don't want it to be drawn semi-transparently, be sure to call setOpacity (1.0f)
(or setColour() with an opaque colour) before drawing images.
*/
void drawImageAt (const Image* const imageToDraw,
const int topLeftX,
const int topLeftY,
const bool fillAlphaChannelWithCurrentBrush = false) const;
void JUCE_CALLTYPE drawImageAt (const Image* const imageToDraw,
const int topLeftX,
const int topLeftY,
const bool fillAlphaChannelWithCurrentBrush = false) const throw();
/** Draws part of an image, rescaling it to fit in a given target region.
@ -512,16 +512,16 @@ public:
it will just fill the target with a solid rectangle)
@see setImageResamplingQuality, drawImageAt, drawImageWithin, fillAlphaMap
*/
void drawImage (const Image* const imageToDraw,
int destX,
int destY,
int destWidth,
int destHeight,
int sourceX,
int sourceY,
int sourceWidth,
int sourceHeight,
const bool fillAlphaChannelWithCurrentBrush = false) const;
void JUCE_CALLTYPE drawImage (const Image* const imageToDraw,
int destX,
int destY,
int destWidth,
int destHeight,
int sourceX,
int sourceY,
int sourceWidth,
int sourceHeight,
const bool fillAlphaChannelWithCurrentBrush = false) const throw();
/** Draws part of an image, having applied an affine transform to it.
@ -540,13 +540,13 @@ public:
@see setImageResamplingQuality, drawImage
*/
void drawImageTransformed (const Image* const imageToDraw,
int sourceClipX,
int sourceClipY,
int sourceClipWidth,
int sourceClipHeight,
const AffineTransform& transform,
const bool fillAlphaChannelWithCurrentBrush) const;
void JUCE_CALLTYPE drawImageTransformed (const Image* const imageToDraw,
int sourceClipX,
int sourceClipY,
int sourceClipWidth,
int sourceClipHeight,
const AffineTransform& transform,
const bool fillAlphaChannelWithCurrentBrush) const throw();
/** Draws an image to fit within a designated rectangle.
@ -569,13 +569,13 @@ public:
similar to fillAlphaMap(), and see also drawImage()
@see setImageResamplingQuality, drawImage, drawImageTransformed, drawImageAt, RectanglePlacement
*/
void drawImageWithin (const Image* const imageToDraw,
const int destX,
const int destY,
const int destWidth,
const int destHeight,
const RectanglePlacement& placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const;
void JUCE_CALLTYPE drawImageWithin (const Image* const imageToDraw,
const int destX,
const int destY,
const int destWidth,
const int destHeight,
const RectanglePlacement& placementWithinTarget,
const bool fillAlphaChannelWithCurrentBrush) const throw();
//==============================================================================
@ -583,7 +583,7 @@ public:
@see getClipRegion, clipRegionIntersects
*/
const Rectangle getClipBounds() const;
const Rectangle JUCE_CALLTYPE getClipBounds() const throw();
/** Checks whether a rectangle overlaps the context's clipping region.
@ -591,39 +591,39 @@ public:
method can be used to optimise a component's paint() method, by letting it
avoid drawing complex objects that aren't within the region being repainted.
*/
bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
bool JUCE_CALLTYPE clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
/** Intersects the current clipping region with another region.
@returns true if the resulting clipping region is non-zero in size
@see setOrigin, clipRegionIntersects, getClipLeft, getClipRight, getClipWidth, getClipHeight
*/
bool reduceClipRegion (const int x, const int y,
const int width, const int height);
bool JUCE_CALLTYPE reduceClipRegion (const int x, const int y,
const int width, const int height) throw();
/** Intersects the current clipping region with a rectangle list region.
@returns true if the resulting clipping region is non-zero in size
@see setOrigin, clipRegionIntersects, getClipLeft, getClipRight, getClipWidth, getClipHeight
*/
bool reduceClipRegion (const RectangleList& clipRegion);
bool JUCE_CALLTYPE reduceClipRegion (const RectangleList& clipRegion) throw();
/** Excludes a rectangle to stop it being drawn into. */
void excludeClipRegion (const int x, const int y,
const int width, const int height);
void JUCE_CALLTYPE excludeClipRegion (const int x, const int y,
const int width, const int height) throw();
/** Returns true if no drawing can be done because the clip region is zero. */
bool isClipEmpty() const;
bool JUCE_CALLTYPE isClipEmpty() const throw();
/** Saves the current graphics state on an internal stack.
To restore the state, use restoreState().
*/
void saveState();
void JUCE_CALLTYPE saveState() throw();
/** Restores a graphics state that was previously saved with saveState().
*/
void restoreState();
void JUCE_CALLTYPE restoreState() throw();
/** Moves the position of the context's origin.
@ -635,14 +635,14 @@ public:
@see reduceClipRegion
*/
void setOrigin (const int newOriginX,
const int newOriginY);
void JUCE_CALLTYPE setOrigin (const int newOriginX,
const int newOriginY) throw();
/** Resets the current colour, brush, and font to default settings. */
void resetToDefaultState();
void JUCE_CALLTYPE resetToDefaultState() throw();
/** Returns true if this context is drawing to a vector-based device, such as a printer. */
bool isVectorDevice() const;
bool JUCE_CALLTYPE isVectorDevice() const throw();
//==============================================================================
juce_UseDebuggingNewOperator
@ -653,10 +653,10 @@ public:
NB. The context will NOT be deleted by this object when it is deleted.
*/
Graphics (LowLevelGraphicsContext* const internalContext);
JUCE_CALLTYPE Graphics (LowLevelGraphicsContext* const internalContext) throw();
/** @internal */
LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
LowLevelGraphicsContext* JUCE_CALLTYPE getInternalContext() const throw() { return context; }
private:
//==============================================================================
@ -665,9 +665,9 @@ private:
struct GraphicsState
{
GraphicsState();
GraphicsState (const GraphicsState&);
~GraphicsState();
JUCE_CALLTYPE GraphicsState() throw();
JUCE_CALLTYPE GraphicsState (const GraphicsState&) throw();
JUCE_CALLTYPE ~GraphicsState() throw();
Colour colour;
Brush* brush;
@ -679,7 +679,7 @@ private:
OwnedArray <GraphicsState> stateStack;
bool saveStatePending;
void saveStateIfPending();
void JUCE_CALLTYPE saveStateIfPending() throw();
const Graphics& operator= (const Graphics& other);
Graphics (const Graphics&);