aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/image
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/gfx/image')
-rw-r--r--engines/sword25/gfx/image/image.h34
-rw-r--r--engines/sword25/gfx/image/vectorimage.cpp365
-rw-r--r--engines/sword25/gfx/image/vectorimage.h154
3 files changed, 279 insertions, 274 deletions
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h
index 0404c50d6f..bc0ff20d77 100644
--- a/engines/sword25/gfx/image/image.h
+++ b/engines/sword25/gfx/image/image.h
@@ -76,17 +76,17 @@ public:
/**
@brief Gibt die Breite des Bildes in Pixeln zurück
*/
- virtual int GetWidth() const = 0;
+ virtual int getWidth() const = 0;
/**
@brief Gibt die Höhe des Bildes in Pixeln zurück
*/
- virtual int GetHeight() const = 0;
+ virtual int getHeight() const = 0;
/**
@brief Gibt das Farbformat des Bildes zurück
*/
- virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const = 0;
+ virtual GraphicEngine::COLOR_FORMATS getColorFormat() const = 0;
//@}
@@ -131,11 +131,11 @@ public:
- IsColorModulationAllowed()
- IsSetContentAllowed()
*/
- virtual bool Blit(int PosX = 0, int PosY = 0,
- int Flipping = FLIP_NONE,
+ virtual bool blit(int posX = 0, int posY = 0,
+ int flipping = FLIP_NONE,
Common::Rect *pPartRect = NULL,
- uint Color = BS_ARGB(255, 255, 255, 255),
- int Width = -1, int Height = -1) = 0;
+ uint color = BS_ARGB(255, 255, 255, 255),
+ int width = -1, int height = -1) = 0;
/**
@brief Füllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
@@ -149,7 +149,7 @@ public:
BS_RGB und BS_ARGB benutzt werden.
@remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
*/
- virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)) = 0;
+ virtual bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)) = 0;
/**
@brief Füllt den Inhalt des Bildes mit Pixeldaten.
@@ -162,7 +162,7 @@ public:
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
*/
- virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) = 0;
+ virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride) = 0;
/**
@brief Liest einen Pixel des Bildes.
@@ -172,7 +172,7 @@ public:
@remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist
eher dafür gedacht einzelne Pixel des Bildes auszulesen.
*/
- virtual uint GetPixel(int X, int Y) = 0;
+ virtual uint getPixel(int x, int y) = 0;
//@{
/** @name Auskunfts-Methoden */
@@ -181,38 +181,38 @@ public:
@brief Überprüft, ob an dem BS_Image Blit() aufgerufen werden darf.
@return Gibt false zurück, falls ein Blit()-Aufruf an diesem Objekt nicht gestattet ist.
*/
- virtual bool IsBlitSource() const = 0;
+ virtual bool isBlitSource() const = 0;
/**
@brief Überprüft, ob das BS_Image ein Zielbild für einen Blit-Aufruf sein kann.
@return Gibt false zurück, falls ein Blit-Aufruf mit diesem Objekt als Ziel nicht gestattet ist.
*/
- virtual bool IsBlitTarget() const = 0;
+ virtual bool isBlitTarget() const = 0;
/**
@brief Gibt true zurück, falls das BS_Image bei einem Aufruf von Blit() skaliert dargestellt werden kann.
*/
- virtual bool IsScalingAllowed() const = 0;
+ virtual bool isScalingAllowed() const = 0;
/**
@brief Gibt true zurück, wenn das BS_Image mit einem Aufruf von Fill() gefüllt werden kann.
*/
- virtual bool IsFillingAllowed() const = 0;
+ virtual bool isFillingAllowed() const = 0;
/**
@brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit einem Alphawert dargestellt werden kann.
*/
- virtual bool IsAlphaAllowed() const = 0;
+ virtual bool isAlphaAllowed() const = 0;
/**
@brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit Farbmodulation dargestellt werden kann.
*/
- virtual bool IsColorModulationAllowed() const = 0;
+ virtual bool isColorModulationAllowed() const = 0;
/**
@brief Gibt true zurück, wenn der Inhalt des BS_Image durch eine Aufruf von SetContent() ausgetauscht werden kann.
*/
- virtual bool IsSetContentAllowed() const = 0;
+ virtual bool isSetContentAllowed() const = 0;
//@}
};
diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp
index 894cc73b6f..7ec47e8a71 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -60,66 +60,67 @@ namespace Sword25 {
class VectorImage::SWFBitStream {
public:
- SWFBitStream(const byte *pData, uint DataSize) :
- m_Pos(pData), m_End(pData + DataSize), m_WordMask(0)
+ SWFBitStream(const byte *pData, uint dataSize) :
+ m_Pos(pData), m_End(pData + dataSize), m_WordMask(0)
{}
- inline uint32 GetBits(uint BitCount) {
- if (BitCount == 0 || BitCount > 32) {
+ inline uint32 getBits(uint bitCount) {
+ if (bitCount == 0 || bitCount > 32) {
error("SWFBitStream::GetBits() must read at least 1 and at most 32 bits at a time");
}
uint32 value = 0;
- while (BitCount) {
- if (m_WordMask == 0) FlushByte();
+ while (bitCount) {
+ if (m_WordMask == 0)
+ flushByte();
value <<= 1;
value |= ((m_Word & m_WordMask) != 0) ? 1 : 0;
m_WordMask >>= 1;
- --BitCount;
+ --bitCount;
}
return value;
}
- inline int32 GetSignedBits(uint BitCount) {
+ inline int32 getSignedBits(uint bitCount) {
// Bits einlesen
- uint32 Temp = GetBits(BitCount);
+ uint32 temp = getBits(bitCount);
// Falls das Sign-Bit gesetzt ist, den Rest des Rückgabewertes mit 1-Bits auffüllen (Sign Extension)
- if (Temp & 1 << (BitCount - 1))
- return (0xffffffff << BitCount) | Temp;
+ if (temp & 1 << (bitCount - 1))
+ return (0xffffffff << bitCount) | temp;
else
- return Temp;
+ return temp;
}
- inline uint32 GetUInt32() {
- uint32 Byte1 = GetByte();
- uint32 Byte2 = GetByte();
- uint32 Byte3 = GetByte();
- uint32 Byte4 = GetByte();
+ inline uint32 getUInt32() {
+ uint32 byte1 = getByte();
+ uint32 byte2 = getByte();
+ uint32 byte3 = getByte();
+ uint32 byte4 = getByte();
- return Byte1 | (Byte2 << 8) | (Byte3 << 16) | (Byte4 << 24);
+ return byte1 | (byte2 << 8) | (byte3 << 16) | (byte4 << 24);
}
- inline uint16 GetUInt16() {
- uint32 Byte1 = GetByte();
- uint32 Byte2 = GetByte();
+ inline uint16 getUInt16() {
+ uint32 byte1 = getByte();
+ uint32 byte2 = getByte();
- return Byte1 | (Byte2 << 8);
+ return byte1 | (byte2 << 8);
}
- inline byte GetByte() {
- FlushByte();
- byte Value = m_Word;
+ inline byte getByte() {
+ flushByte();
+ byte value = m_Word;
m_WordMask = 0;
- FlushByte();
+ flushByte();
- return Value;
+ return value;
}
- inline void FlushByte() {
+ inline void flushByte() {
if (m_WordMask != 128) {
if (m_Pos >= m_End) {
error("Attempted to read past end of file");
@@ -130,12 +131,12 @@ public:
}
}
- inline void SkipBytes(uint SkipLength) {
- FlushByte();
- if (m_Pos + SkipLength >= m_End) {
+ inline void skipBytes(uint skipLength) {
+ flushByte();
+ if (m_Pos + skipLength >= m_End) {
error("Attempted to read past end of file");
} else {
- m_Pos += SkipLength;
+ m_Pos += skipLength;
m_Word = *(m_Pos - 1);
}
}
@@ -144,8 +145,8 @@ private:
const byte *m_Pos;
const byte *m_End;
- byte m_Word;
- uint m_WordMask;
+ byte m_Word;
+ uint m_WordMask;
};
@@ -165,19 +166,19 @@ const uint32 MAX_ACCEPTED_FLASH_VERSION = 3; // Die höchste Flash-Dateiversion
// Konvertiert SWF-Rechteckdaten in einem Bitstrom in Common::Rect-Objekte
// -----------------------------------------------------------------------------
-Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
- bs.FlushByte();
+Common::Rect flashRectToBSRect(VectorImage::SWFBitStream &bs) {
+ bs.flushByte();
// Feststellen mit wie vielen Bits die einzelnen Komponenten kodiert sind
- uint32 BitsPerValue = bs.GetBits(5);
+ uint32 bitsPerValue = bs.getBits(5);
// Die einzelnen Komponenten einlesen
- int32 XMin = bs.GetSignedBits(BitsPerValue);
- int32 XMax = bs.GetSignedBits(BitsPerValue);
- int32 YMin = bs.GetSignedBits(BitsPerValue);
- int32 YMax = bs.GetSignedBits(BitsPerValue);
+ int32 xMin = bs.getSignedBits(bitsPerValue);
+ int32 xMax = bs.getSignedBits(bitsPerValue);
+ int32 yMin = bs.getSignedBits(bitsPerValue);
+ int32 yMax = bs.getSignedBits(bitsPerValue);
- return Common::Rect(XMin, YMin, XMax + 1, YMax + 1);
+ return Common::Rect(xMin, yMin, xMax + 1, yMax + 1);
}
@@ -185,10 +186,10 @@ Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
// Konvertiert SWF-Farben in AntiGrain Farben
// -----------------------------------------------------------------------------
-uint32 FlashColorToAGGRGBA8(uint FlashColor) {
- uint32 ResultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff);
+uint32 flashColorToAGGRGBA8(uint flashColor) {
+ uint32 resultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(flashColor >> 24, (flashColor >> 16) & 0xff, (flashColor >> 8) & 0xff, flashColor & 0xff);
- return ResultColor;
+ return resultColor;
}
@@ -199,7 +200,7 @@ uint32 FlashColorToAGGRGBA8(uint FlashColor) {
struct CBBGetId {
CBBGetId(const VectorImageElement &vectorImageElement_) : vectorImageElement(vectorImageElement_) {}
unsigned operator [](unsigned i) const {
- return vectorImageElement.GetPathInfo(i).GetID();
+ return vectorImageElement.getPathInfo(i).getId();
}
const VectorImageElement &vectorImageElement;
};
@@ -224,75 +225,75 @@ Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement)
// Konstruktion
// -----------------------------------------------------------------------------
-VectorImage::VectorImage(const byte *pFileData, uint FileSize, bool &Success) {
- Success = false;
+VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success) {
+ success = false;
// Bitstream-Objekt erzeugen
// Im Folgenden werden die Dateidaten aus diesem ausgelesen.
- SWFBitStream bs(pFileData, FileSize);
+ SWFBitStream bs(pFileData, fileSize);
// SWF-Signatur überprüfen
- uint32 Signature[3];
- Signature[0] = bs.GetByte();
- Signature[1] = bs.GetByte();
- Signature[2] = bs.GetByte();
- if (Signature[0] != 'F' ||
- Signature[1] != 'W' ||
- Signature[2] != 'S') {
+ uint32 signature[3];
+ signature[0] = bs.getByte();
+ signature[1] = bs.getByte();
+ signature[2] = bs.getByte();
+ if (signature[0] != 'F' ||
+ signature[1] != 'W' ||
+ signature[2] != 'S') {
BS_LOG_ERRORLN("File is not a valid SWF-file");
return;
}
// Versionsangabe überprüfen
- uint32 Version = bs.GetByte();
- if (Version > MAX_ACCEPTED_FLASH_VERSION) {
- BS_LOG_ERRORLN("File is of version %d. Highest accepted version is %d.", Version, MAX_ACCEPTED_FLASH_VERSION);
+ uint32 version = bs.getByte();
+ if (version > MAX_ACCEPTED_FLASH_VERSION) {
+ BS_LOG_ERRORLN("File is of version %d. Highest accepted version is %d.", version, MAX_ACCEPTED_FLASH_VERSION);
return;
}
// Dateigröße auslesen und mit der tatsächlichen Größe vergleichen
- uint32 StoredFileSize = bs.GetUInt32();
- if (StoredFileSize != FileSize) {
+ uint32 storedFileSize = bs.getUInt32();
+ if (storedFileSize != fileSize) {
BS_LOG_ERRORLN("File is not a valid SWF-file");
return;
}
// SWF-Maße auslesen
- Common::Rect MovieRect = FlashRectToBSRect(bs);
+ Common::Rect movieRect = flashRectToBSRect(bs);
// Framerate und Frameanzahl auslesen
- /* uint32 FrameRate = */bs.GetUInt16();
- /* uint32 FrameCount = */bs.GetUInt16();
+ /* uint32 frameRate = */bs.getUInt16();
+ /* uint32 frameCount = */bs.getUInt16();
// Tags parsen
// Da wir uns nur für das erste DefineShape-Tag interessieren
- bool KeepParsing = true;
- while (KeepParsing) {
+ bool keepParsing = true;
+ while (keepParsing) {
// Tags beginnen immer an Bytegrenzen
- bs.FlushByte();
+ bs.flushByte();
// Tagtyp und Länge auslesen
- uint16 TagTypeAndLength = bs.GetUInt16();
- uint32 TagType = TagTypeAndLength >> 6;
- uint32 TagLength = TagTypeAndLength & 0x3f;
- if (TagLength == 0x3f)
- TagLength = bs.GetUInt32();
+ uint16 tagTypeAndLength = bs.getUInt16();
+ uint32 tagType = tagTypeAndLength >> 6;
+ uint32 tagLength = tagTypeAndLength & 0x3f;
+ if (tagLength == 0x3f)
+ tagLength = bs.getUInt32();
- switch (TagType) {
+ switch (tagType) {
case 2:
// DefineShape
- Success = ParseDefineShape(2, bs);
+ success = parseDefineShape(2, bs);
return;
case 22:
// DefineShape2
- Success = ParseDefineShape(2, bs);
+ success = parseDefineShape(2, bs);
return;
case 32:
- Success = ParseDefineShape(3, bs);
+ success = parseDefineShape(3, bs);
return;
default:
// Unbekannte Tags ignorieren
- bs.SkipBytes(TagLength);
+ bs.skipBytes(tagLength);
}
}
@@ -303,147 +304,149 @@ VectorImage::VectorImage(const byte *pFileData, uint FileSize, bool &Success) {
// -----------------------------------------------------------------------------
-bool VectorImage::ParseDefineShape(uint ShapeType, SWFBitStream &bs) {
- /*uint32 ShapeID = */bs.GetUInt16();
+bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
+ /*uint32 shapeID = */bs.getUInt16();
// Bounding Box auslesen
- m_BoundingBox = FlashRectToBSRect(bs);
+ _boundingBox = flashRectToBSRect(bs);
// Erstes Image-Element erzeugen
- m_Elements.resize(1);
+ _elements.resize(1);
// Styles einlesen
- uint NumFillBits;
- uint NumLineBits;
- if (!ParseStyles(ShapeType, bs, NumFillBits, NumLineBits))
+ uint numFillBits;
+ uint numLineBits;
+ if (!parseStyles(shapeType, bs, numFillBits, numLineBits))
return false;
- uint LineStyle = 0;
- uint FillStyle0 = 0;
- uint FillStyle1 = 0;
+ uint lineStyle = 0;
+ uint fillStyle0 = 0;
+ uint fillStyle1 = 0;
// Shaperecord parsen
// ------------------
- bool EndOfShapeDiscovered = false;
- while (!EndOfShapeDiscovered) {
- uint32 TypeFlag = bs.GetBits(1);
+ bool endOfShapeDiscovered = false;
+ while (!endOfShapeDiscovered) {
+ uint32 typeFlag = bs.getBits(1);
// Non-Edge Record
- if (TypeFlag == 0) {
+ if (typeFlag == 0) {
// Feststellen welche Parameter gesetzt werden
- uint32 StateNewStyles = bs.GetBits(1);
- uint32 StateLineStyle = bs.GetBits(1);
- uint32 StateFillStyle1 = bs.GetBits(1);
- uint32 StateFillStyle0 = bs.GetBits(1);
- uint32 StateMoveTo = bs.GetBits(1);
+ uint32 stateNewStyles = bs.getBits(1);
+ uint32 stateLineStyle = bs.getBits(1);
+ uint32 stateFillStyle1 = bs.getBits(1);
+ uint32 stateFillStyle0 = bs.getBits(1);
+ uint32 stateMoveTo = bs.getBits(1);
// End der Shape-Definition erreicht?
- if (!StateNewStyles && !StateLineStyle && !StateFillStyle0 && !StateFillStyle1 && !StateMoveTo)
- EndOfShapeDiscovered = true;
+ if (!stateNewStyles && !stateLineStyle && !stateFillStyle0 && !stateFillStyle1 && !stateMoveTo)
+ endOfShapeDiscovered = true;
// Parameter dekodieren
else {
- int32 MoveDeltaX = 0;
- int32 MoveDeltaY = 0;
- if (StateMoveTo) {
- uint32 MoveToBits = bs.GetBits(5);
- MoveDeltaX = bs.GetSignedBits(MoveToBits);
- MoveDeltaY = bs.GetSignedBits(MoveToBits);
+ int32 moveDeltaX = 0;
+ int32 moveDeltaY = 0;
+ if (stateMoveTo) {
+ uint32 moveToBits = bs.getBits(5);
+ moveDeltaX = bs.getSignedBits(moveToBits);
+ moveDeltaY = bs.getSignedBits(moveToBits);
}
- if (StateFillStyle0) {
- if (NumFillBits > 0)
- FillStyle0 = bs.GetBits(NumFillBits);
+ if (stateFillStyle0) {
+ if (numFillBits > 0)
+ fillStyle0 = bs.getBits(numFillBits);
else
- FillStyle0 = 0;
+ fillStyle0 = 0;
}
- if (StateFillStyle1) {
- if (NumFillBits > 0)
- FillStyle1 = bs.GetBits(NumFillBits);
+ if (stateFillStyle1) {
+ if (numFillBits > 0)
+ fillStyle1 = bs.getBits(numFillBits);
else
- FillStyle1 = 0;
+ fillStyle1 = 0;
}
- if (StateLineStyle) {
- if (NumLineBits)
- LineStyle = bs.GetBits(NumLineBits);
+ if (stateLineStyle) {
+ if (numLineBits)
+ lineStyle = bs.getBits(numLineBits);
else
- NumLineBits = 0;
+ numLineBits = 0;
}
- if (StateNewStyles) {
+ if (stateNewStyles) {
// An dieser Stelle werden in Flash die alten Style-Definitionen verworfen und mit den neuen überschrieben.
// Es wird ein neues Element begonnen.
- m_Elements.resize(m_Elements.size() + 1);
- if (!ParseStyles(ShapeType, bs, NumFillBits, NumLineBits)) return false;
+ _elements.resize(_elements.size() + 1);
+ if (!parseStyles(shapeType, bs, numFillBits, numLineBits))
+ return false;
}
// Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert
- if (StateLineStyle || StateFillStyle0 || StateFillStyle1 || StateMoveTo) {
+ if (stateLineStyle || stateFillStyle0 || stateFillStyle1 || stateMoveTo) {
// Letzte Zeichenposition merken, beim Aufruf von start_new_path() wird die Zeichenpostionen auf 0, 0 zurückgesetzt
#if 0 // TODO
- double LastX = m_Elements.back().m_Paths.last_x();
- double LastY = m_Elements.back().m_Paths.last_y();
+ double lastX = _elements.back()._paths.last_x();
+ double lastY = _elements.back()._paths.last_y();
// Neue Pfadinformation erzeugen
- m_Elements.back().m_PathInfos.push_back(BS_VectorPathInfo(m_Elements.back().m_Paths.start_new_path(), LineStyle, FillStyle0, FillStyle1));
+ _elements.back()._pathInfos.push_back(VectorPathInfo(_elements.back()._paths.start_new_path(), lineStyle, fillStyle0, fillStyle1));
// Falls eine Bewegung definiert wurde, wird die Zeichenpositionen an die entsprechende Position gesetzt.
// Ansonsten wird die Zeichenposition auf die letzte Zeichenposition gesetzt.
- if (StateMoveTo)
- m_Elements.back().m_Paths.move_to(MoveDeltaX, MoveDeltaY);
+ if (stateMoveTo)
+ _elements.back()._paths.move_to(moveDeltaX, moveDeltaY);
else
- m_Elements.back().m_Paths.move_to(LastX, LastY);
+ _elements.back()._paths.move_to(lastX, lastY);
#endif
}
}
} else {
// Edge Record
- uint32 EdgeFlag = bs.GetBits(1);
- uint32 NumBits = bs.GetBits(4) + 2;
+ uint32 edgeFlag = bs.getBits(1);
+ uint32 numBits = bs.getBits(4) + 2;
// Curved edge
- if (EdgeFlag == 0) {
- /* int32 ControlDeltaX = */bs.GetSignedBits(NumBits);
- /* int32 ControlDeltaY = */bs.GetSignedBits(NumBits);
- /* int32 AnchorDeltaX = */bs.GetSignedBits(NumBits);
- /* int32 AnchorDeltaY = */bs.GetSignedBits(NumBits);
+ if (edgeFlag == 0) {
+ /* int32 ControlDeltaX = */bs.getSignedBits(numBits);
+ /* int32 ControlDeltaY = */bs.getSignedBits(numBits);
+ /* int32 AnchorDeltaX = */bs.getSignedBits(numBits);
+ /* int32 AnchorDeltaY = */bs.getSignedBits(numBits);
#if 0 // TODO
- double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX;
- double ControlY = m_Elements.back().m_Paths.last_y() + ControlDeltaY;
- double AnchorX = ControlX + AnchorDeltaX;
- double AnchorY = ControlY + AnchorDeltaY;
- m_Elements.back().m_Paths.curve3(ControlX, ControlY, AnchorX, AnchorY);
+ double controlX = _elements.back()._paths.last_x() + controlDeltaX;
+ double controlY = _elements.back()._paths.last_y() + controlDeltaY;
+ double anchorX = controlX + AnchorDeltaX;
+ double anchorY = controlY + AnchorDeltaY;
+ _elements.back()._paths.curve3(controlX, controlY, anchorX, anchorY);
#endif
} else {
// Staight edge
- int32 DeltaX = 0;
- int32 DeltaY = 0;
+ int32 deltaX = 0;
+ int32 deltaY = 0;
- uint32 GeneralLineFlag = bs.GetBits(1);
- if (GeneralLineFlag) {
- DeltaX = bs.GetSignedBits(NumBits);
- DeltaY = bs.GetSignedBits(NumBits);
+ uint32 generalLineFlag = bs.getBits(1);
+ if (generalLineFlag) {
+ deltaX = bs.getSignedBits(numBits);
+ deltaY = bs.getSignedBits(numBits);
} else {
- uint32 VertLineFlag = bs.GetBits(1);
- if (VertLineFlag)
- DeltaY = bs.GetSignedBits(NumBits);
+ uint32 vertLineFlag = bs.getBits(1);
+ if (vertLineFlag)
+ deltaY = bs.getSignedBits(numBits);
else
- DeltaX = bs.GetSignedBits(NumBits);
+ deltaX = bs.getSignedBits(numBits);
}
#if 0 // TODO
- m_Elements.back().m_Paths.line_rel(DeltaX, DeltaY);
+ _elements.back()._paths.line_rel(deltaX, deltaY);
#endif
}
}
}
// Bounding-Boxes der einzelnen Elemente berechnen
- Common::Array<VectorImageElement>::iterator it = m_Elements.begin();
- for (; it != m_Elements.end(); ++it) it->m_BoundingBox = CalculateBoundingBox(*it);
+ Common::Array<VectorImageElement>::iterator it = _elements.begin();
+ for (; it != _elements.end(); ++it)
+ it->_boundingBox = CalculateBoundingBox(*it);
return true;
}
@@ -451,55 +454,57 @@ bool VectorImage::ParseDefineShape(uint ShapeType, SWFBitStream &bs) {
// -----------------------------------------------------------------------------
-bool VectorImage::ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits) {
- bs.FlushByte();
+bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBits, uint &numLineBits) {
+ bs.flushByte();
// Fillstyles parsen
// -----------------
// Anzahl an Fillstyles bestimmen
- uint FillStyleCount = bs.GetByte();
- if (FillStyleCount == 0xff) FillStyleCount = bs.GetUInt16();
+ uint fillStyleCount = bs.getByte();
+ if (fillStyleCount == 0xff)
+ fillStyleCount = bs.getUInt16();
// Alle Fillstyles einlesen, falls ein Fillstyle mit Typ != 0 gefunden wird, wird das Parsen abgebrochen.
// Es wird nur "solid fill" (Typ 0) unterstützt.
- m_Elements.back().m_FillStyles.reserve(FillStyleCount);
- for (uint i = 0; i < FillStyleCount; ++i) {
- byte Type = bs.GetByte();
- uint32 Color;
- if (ShapeType == 3) {
- Color = (bs.GetByte() << 16) | (bs.GetByte() << 8) | bs.GetByte() | (bs.GetByte() << 24);
+ _elements.back()._fillStyles.reserve(fillStyleCount);
+ for (uint i = 0; i < fillStyleCount; ++i) {
+ byte type = bs.getByte();
+ uint32 color;
+ if (shapeType == 3) {
+ color = (bs.getByte() << 16) | (bs.getByte() << 8) | bs.getByte() | (bs.getByte() << 24);
} else
- Color = bs.GetBits(24) | (0xff << 24);
- if (Type != 0) return false;
+ color = bs.getBits(24) | (0xff << 24);
+ if (type != 0)
+ return false;
- m_Elements.back().m_FillStyles.push_back(FlashColorToAGGRGBA8(Color));
+ _elements.back()._fillStyles.push_back(flashColorToAGGRGBA8(color));
}
// Linestyles parsen
// -----------------
// Anzahl an Linestyles bestimmen
- uint LineStyleCount = bs.GetByte();
- if (LineStyleCount == 0xff)
- LineStyleCount = bs.GetUInt16();
+ uint lineStyleCount = bs.getByte();
+ if (lineStyleCount == 0xff)
+ lineStyleCount = bs.getUInt16();
// Alle Linestyles einlesen
- m_Elements.back().m_LineStyles.reserve(LineStyleCount);
- for (uint i = 0; i < LineStyleCount; ++i) {
- double Width = bs.GetUInt16();
- uint32 Color;
- if (ShapeType == 3)
- Color = (bs.GetByte() << 16) | (bs.GetByte() << 8) | bs.GetByte() | (bs.GetByte() << 24);
+ _elements.back()._lineStyles.reserve(lineStyleCount);
+ for (uint i = 0; i < lineStyleCount; ++i) {
+ double width = bs.getUInt16();
+ uint32 color;
+ if (shapeType == 3)
+ color = (bs.getByte() << 16) | (bs.getByte() << 8) | bs.getByte() | (bs.getByte() << 24);
else
- Color = bs.GetBits(24) | (0xff << 24);
+ color = bs.getBits(24) | (0xff << 24);
- m_Elements.back().m_LineStyles.push_back(VectorImageElement::LineStyleType(Width, FlashColorToAGGRGBA8(Color)));
+ _elements.back()._lineStyles.push_back(VectorImageElement::LineStyleType(width, flashColorToAGGRGBA8(color)));
}
// Bitbreite für die folgenden Styleindizes auslesen
- NumFillBits = bs.GetBits(4);
- NumLineBits = bs.GetBits(4);
+ numFillBits = bs.getBits(4);
+ numLineBits = bs.getBits(4);
return true;
}
@@ -507,7 +512,7 @@ bool VectorImage::ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBit
// -----------------------------------------------------------------------------
-bool VectorImage::Fill(const Common::Rect *pFillRect, uint Color) {
+bool VectorImage::fill(const Common::Rect *pFillRect, uint color) {
BS_LOG_ERRORLN("Fill() is not supported.");
return false;
}
@@ -515,14 +520,14 @@ bool VectorImage::Fill(const Common::Rect *pFillRect, uint Color) {
// -----------------------------------------------------------------------------
-uint VectorImage::GetPixel(int X, int Y) {
+uint VectorImage::getPixel(int x, int y) {
BS_LOG_ERRORLN("GetPixel() is not supported. Returning black.");
return 0;
}
// -----------------------------------------------------------------------------
-bool VectorImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
+bool VectorImage::setContent(const byte *pixeldata, uint size, uint offset, uint stride) {
BS_LOG_ERRORLN("SetContent() is not supported.");
return 0;
}
diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h
index 213775c618..7f14da907c 100644
--- a/engines/sword25/gfx/image/vectorimage.h
+++ b/engines/sword25/gfx/image/vectorimage.h
@@ -60,31 +60,31 @@ class VectorImage;
class VectorPathInfo {
public:
- VectorPathInfo(uint ID, uint LineStyle, uint FillStyle0, uint FillStyle1) :
- m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {}
+ VectorPathInfo(uint id, uint lineStyle, uint fillStyle0, uint fillStyle1) :
+ _id(id), _lineStyle(lineStyle), _fillStyle0(fillStyle0), _fillStyle1(fillStyle1) {}
VectorPathInfo() {
- m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0;
+ _id = _lineStyle = _fillStyle0 = _fillStyle1 = 0;
}
- uint GetID() const {
- return m_ID;
+ uint getId() const {
+ return _id;
}
- uint GetLineStyle() const {
- return m_LineStyle;
+ uint getLineStyle() const {
+ return _lineStyle;
}
- uint GetFillStyle0() const {
- return m_FillStyle0;
+ uint getFillStyle0() const {
+ return _fillStyle0;
}
- uint GetFillStyle1() const {
- return m_FillStyle1;
+ uint getFillStyle1() const {
+ return _fillStyle1;
}
private:
- uint m_ID;
- uint m_LineStyle;
- uint m_FillStyle0;
- uint m_FillStyle1;
+ uint _id;
+ uint _lineStyle;
+ uint _fillStyle0;
+ uint _fillStyle1;
};
@@ -96,61 +96,61 @@ class VectorImageElement {
friend class VectorImage;
public:
#if 0 // TODO
- const agg::path_storage &GetPaths() const {
- return m_Paths;
+ const agg::path_storage &getPaths() const {
+ return _paths;
}
#endif
- uint GetPathCount() const {
- return m_PathInfos.size();
+ uint getPathCount() const {
+ return _pathInfos.size();
}
- const VectorPathInfo &GetPathInfo(uint PathNr) const {
- BS_ASSERT(PathNr < GetPathCount());
- return m_PathInfos[PathNr];
+ const VectorPathInfo &getPathInfo(uint pathNr) const {
+ BS_ASSERT(pathNr < getPathCount());
+ return _pathInfos[pathNr];
}
- double GetLineStyleWidth(uint LineStyle) const {
- BS_ASSERT(LineStyle < m_LineStyles.size());
- return m_LineStyles[LineStyle].Width;
+ double getLineStyleWidth(uint lineStyle) const {
+ BS_ASSERT(lineStyle < _lineStyles.size());
+ return _lineStyles[lineStyle].width;
}
- uint GetLineStyleCount() const {
- return m_LineStyles.size();
+ uint getLineStyleCount() const {
+ return _lineStyles.size();
}
- uint32 GetLineStyleColor(uint LineStyle) const {
- BS_ASSERT(LineStyle < m_LineStyles.size());
- return m_LineStyles[LineStyle].Color;
+ uint32 getLineStyleColor(uint lineStyle) const {
+ BS_ASSERT(lineStyle < _lineStyles.size());
+ return _lineStyles[lineStyle].color;
}
- uint GetFillStyleCount() const {
- return m_FillStyles.size();
+ uint getFillStyleCount() const {
+ return _fillStyles.size();
}
- uint32 GetFillStyleColor(uint FillStyle) const {
- BS_ASSERT(FillStyle < m_FillStyles.size());
- return m_FillStyles[FillStyle];
+ uint32 getFillStyleColor(uint fillStyle) const {
+ BS_ASSERT(fillStyle < _fillStyles.size());
+ return _fillStyles[fillStyle];
}
- const Common::Rect &GetBoundingBox() const {
- return m_BoundingBox;
+ const Common::Rect &getBoundingBox() const {
+ return _boundingBox;
}
private:
struct LineStyleType {
- LineStyleType(double Width_, uint32 Color_) : Width(Width_), Color(Color_) {}
- LineStyleType() { Width = 0; Color = 0; }
- double Width;
- uint32 Color;
+ LineStyleType(double width_, uint32 color_) : width(width_), color(color_) {}
+ LineStyleType() { width = 0; color = 0; }
+ double width;
+ uint32 color;
};
#if 0 // TODO
- agg::path_storage m_Paths;
+ agg::path_storage _paths;
#endif
- Common::Array<VectorPathInfo> m_PathInfos;
- Common::Array<LineStyleType> m_LineStyles;
- Common::Array<uint32> m_FillStyles;
- Common::Rect m_BoundingBox;
+ Common::Array<VectorPathInfo> _pathInfos;
+ Common::Array<LineStyleType> _lineStyles;
+ Common::Array<uint32> _fillStyles;
+ Common::Rect _boundingBox;
};
@@ -162,69 +162,69 @@ private:
class VectorImage : public Image {
public:
- VectorImage(const byte *pFileData, uint FileSize, bool &Success);
+ VectorImage(const byte *pFileData, uint fileSize, bool &success);
- uint GetElementCount() const {
- return m_Elements.size();
+ uint getElementCount() const {
+ return _elements.size();
}
- const VectorImageElement &GetElement(uint ElementNr) const {
- BS_ASSERT(ElementNr < m_Elements.size());
- return m_Elements[ElementNr];
+ const VectorImageElement &getElement(uint elementNr) const {
+ BS_ASSERT(elementNr < _elements.size());
+ return _elements[elementNr];
}
- const Common::Rect &GetBoundingBox() const {
- return m_BoundingBox;
+ const Common::Rect &getBoundingBox() const {
+ return _boundingBox;
}
//
// Die abstrakten Methoden von BS_Image
//
- virtual int GetWidth() const {
- return m_BoundingBox.width();
+ virtual int getWidth() const {
+ return _boundingBox.width();
}
- virtual int GetHeight() const {
- return m_BoundingBox.height();
+ virtual int getHeight() const {
+ return _boundingBox.height();
}
- virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const {
+ virtual GraphicEngine::COLOR_FORMATS getColorFormat() const {
return GraphicEngine::CF_ARGB32;
}
- virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0));
- virtual uint GetPixel(int X, int Y);
- virtual bool IsBlitSource() const {
+ virtual bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0));
+ virtual uint getPixel(int x, int y);
+ virtual bool isBlitSource() const {
return true;
}
- virtual bool IsBlitTarget() const {
+ virtual bool isBlitTarget() const {
return false;
}
- virtual bool IsScalingAllowed() const {
+ virtual bool isScalingAllowed() const {
return true;
}
- virtual bool IsFillingAllowed() const {
+ virtual bool isFillingAllowed() const {
return false;
}
- virtual bool IsAlphaAllowed() const {
+ virtual bool isAlphaAllowed() const {
return true;
}
- virtual bool IsColorModulationAllowed() const {
+ virtual bool isColorModulationAllowed() const {
return true;
}
- virtual bool IsSetContentAllowed() const {
+ virtual bool isSetContentAllowed() const {
return false;
}
- virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride);
- virtual bool Blit(int PosX = 0, int PosY = 0,
- int Flipping = FLIP_NONE,
+ virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride);
+ virtual bool blit(int posX = 0, int posY = 0,
+ int flipping = FLIP_NONE,
Common::Rect *pPartRect = NULL,
- uint Color = BS_ARGB(255, 255, 255, 255),
- int Width = -1, int Height = -1);
+ uint color = BS_ARGB(255, 255, 255, 255),
+ int width = -1, int height = -1);
class SWFBitStream;
private:
- bool ParseDefineShape(uint ShapeType, SWFBitStream &bs);
- bool ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits);
+ bool parseDefineShape(uint shapeType, SWFBitStream &bs);
+ bool parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBits, uint &numLineBits);
- Common::Array<VectorImageElement> m_Elements;
- Common::Rect m_BoundingBox;
+ Common::Array<VectorImageElement> _elements;
+ Common::Rect _boundingBox;
};
} // End of namespace Sword25