1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added some colour component accessor methods to PixelARGB, PixelRGB. Tidied up some packing macros.

This commit is contained in:
jules 2012-07-21 08:58:27 +01:00
parent a151510501
commit b3556f720e
6 changed files with 38 additions and 44 deletions

View file

@ -34,11 +34,6 @@ namespace AiffFileHelpers
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
//==============================================================================
@ -49,7 +44,7 @@ namespace AiffFileHelpers
uint16 type; // these are different in AIFF and WAV
uint16 startIdentifier;
uint16 endIdentifier;
} PACKED;
} JUCE_PACKED;
int8 baseNote;
int8 detune;
@ -106,14 +101,12 @@ namespace AiffFileHelpers
}
}
} PACKED;
} JUCE_PACKED;
#if JUCE_MSVC
#pragma pack (pop)
#endif
#undef PACKED
//==============================================================================
namespace MarkChunk
{

View file

@ -64,11 +64,6 @@ namespace WavFileHelpers
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
struct BWAVChunk
@ -137,7 +132,7 @@ namespace WavFileHelpers
return MemoryBlock();
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
@ -151,7 +146,7 @@ namespace WavFileHelpers
uint32 end;
uint32 fraction;
uint32 playCount;
} PACKED;
} JUCE_PACKED;
uint32 manufacturer;
uint32 product;
@ -227,7 +222,7 @@ namespace WavFileHelpers
return data;
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
struct InstChunk
@ -272,7 +267,7 @@ namespace WavFileHelpers
return data;
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
struct CueChunk
@ -285,7 +280,7 @@ namespace WavFileHelpers
uint32 chunkStart;
uint32 blockStart;
uint32 offset;
} PACKED;
} JUCE_PACKED;
uint32 numCues;
Cue cues[1];
@ -354,7 +349,7 @@ namespace WavFileHelpers
}
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
namespace ListChunk
@ -427,7 +422,7 @@ namespace WavFileHelpers
uint16 data2;
uint16 data3;
uint8 data4[8];
} PACKED;
} JUCE_PACKED;
struct DataSize64Chunk // chunk ID = 'ds64' if data size > 0xffffffff, 'JUNK' otherwise
{
@ -438,14 +433,12 @@ namespace WavFileHelpers
uint32 sampleCountLow; // low 4 byte sample count of fact chunk
uint32 sampleCountHigh; // high 4 byte sample count of fact chunk
uint32 tableLength; // number of valid entries in array 'table'
} PACKED;
} JUCE_PACKED;
#if JUCE_MSVC
#pragma pack (pop)
#endif
#undef PACKED
}
//==============================================================================

View file

@ -128,7 +128,8 @@ private:
private:
JUCE_LEAK_DETECTOR (MyClass);
};@endcode
};
@endcode
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
*/

View file

@ -278,6 +278,13 @@ namespace juce
#define JUCE_MODAL_LOOPS_PERMITTED 1
#endif
//==============================================================================
#if JUCE_GCC
#define JUCE_PACKED __attribute__((packed))
#elif ! DOXYGEN
#define JUCE_PACKED
#endif
//==============================================================================
// Here, we'll check for C++11 compiler support, and if it's not available, define
// a few workarounds, so that we can still use some of the newer language features.

View file

@ -28,15 +28,8 @@
//==============================================================================
#ifndef DOXYGEN
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
#if JUCE_MSVC
#pragma pack (push, 1)
#endif
class PixelRGB;
@ -84,6 +77,11 @@ public:
forcedinline uint8 getGreen() const noexcept { return components.g; }
forcedinline uint8 getBlue() const noexcept { return components.b; }
forcedinline uint8& getAlpha() noexcept { return components.a; }
forcedinline uint8& getRed() noexcept { return components.r; }
forcedinline uint8& getGreen() noexcept { return components.g; }
forcedinline uint8& getBlue() noexcept { return components.b; }
/** Blends another pixel onto this one.
This takes into account the opacity of the pixel being overlaid, and blends
@ -275,7 +273,7 @@ private:
#else
uint8 b, g, r, a;
#endif
} PACKED;
} JUCE_PACKED;
union
{
@ -284,7 +282,7 @@ private:
};
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@ -326,6 +324,10 @@ public:
forcedinline uint8 getGreen() const noexcept { return g; }
forcedinline uint8 getBlue() const noexcept { return b; }
forcedinline uint8& getRed() noexcept { return r; }
forcedinline uint8& getGreen() noexcept { return g; }
forcedinline uint8& getBlue() noexcept { return b; }
/** Blends another pixel onto this one.
This takes into account the opacity of the pixel being overlaid, and blends
@ -450,7 +452,7 @@ private:
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@ -490,6 +492,8 @@ public:
forcedinline uint32 getAG() const noexcept { return (((uint32) a) << 16) | a; }
forcedinline uint8 getAlpha() const noexcept { return a; }
forcedinline uint8& getAlpha() noexcept { return a; }
forcedinline uint8 getRed() const noexcept { return 0; }
forcedinline uint8 getGreen() const noexcept { return 0; }
forcedinline uint8 getBlue() const noexcept { return 0; }
@ -576,10 +580,10 @@ public:
private:
//==============================================================================
uint8 a : 8;
uint8 a;
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@ -587,6 +591,4 @@ private:
#pragma pack (pop)
#endif
#undef PACKED
#endif // __JUCE_PIXELFORMATS_JUCEHEADER__

View file

@ -56,9 +56,7 @@ class JUCE_API ScrollBar : public Component,
public:
//==============================================================================
/** Creates a Scrollbar.
@param isVertical whether it should be a vertical or horizontal bar
@param buttonsAreVisible whether to show the up/down or left/right buttons
@param isVertical specifies whether the bar should be a vertical or horizontal
*/
ScrollBar (bool isVertical);