From 6ed2679cf1442cb647351792c97b126195a649e7 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 19 Sep 2011 19:07:11 -0400 Subject: PEGASUS: Add the Surface classes Renamed from GWorld; I'm trying to distance us from QuickDraw as much as possible :P --- engines/pegasus/surface.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100755 engines/pegasus/surface.h (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h new file mode 100755 index 0000000000..1b63702960 --- /dev/null +++ b/engines/pegasus/surface.h @@ -0,0 +1,119 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * Additional copyright for this file: + * Copyright (C) 1995-1997 Presto Studios, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PEGASUS_SURFACE_H +#define PEGASUS_SURFACE_H + +#include "common/rect.h" +#include "common/str.h" + +#include "pegasus/types.h" + +namespace Common { + class MacResManager; +} + +namespace Graphics { + struct Surface; +} + +namespace Video { + class SeekableVideoDecoder; +} + +namespace Pegasus { + +// Surface bounds are always normalized. + +class Surface { +public: + Surface(); + virtual ~Surface(); + + virtual void allocateSurface(const Common::Rect &); + virtual void deallocateSurface(); + virtual void shareSurface(Surface *surface); + bool isSurfaceValid() const { return _surface != 0; } + + Graphics::Surface *getSurface() const { return _surface; } + void getSurfaceBounds(Common::Rect &r) { r = _bounds; } + + // None of the CopyToCurrentPort functions do any sanity checks. + // For speed, they just call CopyBits. + // It's up to clients to make sure that the GWorld is valid. + void copyToCurrentPort() const; + void copyToCurrentPortTransparent() const; + void copyToCurrentPort(const Common::Rect &) const; + void copyToCurrentPortTransparent(const Common::Rect &) const; + void copyToCurrentPort(const Common::Rect &, const Common::Rect &) const; + void copyToCurrentPortTransparent(const Common::Rect &, const Common::Rect &) const; + + virtual void getImageFromPICTFile(const Common::String &fileName); + virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id); + +protected: + bool _ownsSurface; + Graphics::Surface *_surface; + Common::Rect _bounds; + +private: + void getImageFromPICTStream(Common::SeekableReadStream *stream); +}; + +class PixelImage : public Surface { +public: + PixelImage(); + virtual ~PixelImage() {} + + void drawImage(const Common::Rect &, const Common::Rect &); + +protected: + virtual void setTransparent(bool transparent) { _transparent = transparent; } + + bool _transparent; +}; + +class Frame : public PixelImage { +public: + Frame() {} + virtual ~Frame() {} + + virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); + virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); +}; + +class SpriteFrame : public Frame { +friend class Sprite; +public: + SpriteFrame() { _referenceCount = 0; } + virtual ~SpriteFrame() {} + +protected: + uint32 _referenceCount; +}; + +} // End of namespace Pegasus + +#endif -- cgit v1.2.3 From 335a043bd06ab269c8c263fb86a2bc48f5ba9f7b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 20 Sep 2011 21:45:39 -0400 Subject: PEGASUS: Add picture class --- engines/pegasus/surface.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 1b63702960..9493323af6 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -29,6 +29,7 @@ #include "common/rect.h" #include "common/str.h" +#include "pegasus/elements.h" #include "pegasus/types.h" namespace Common { @@ -114,6 +115,14 @@ protected: uint32 _referenceCount; }; +class Picture : public DisplayElement, public Frame { +public: + Picture(const tDisplayElementID id) : DisplayElement(id) {} + virtual ~Picture() {} + + virtual void draw(const Common::Rect &); +}; + } // End of namespace Pegasus #endif -- cgit v1.2.3 From 46bc7e6c4d6ec9addccff397f1c8439d6a86bb20 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 21 Sep 2011 19:44:42 -0400 Subject: PEGASUS: Fix bounds of Pictures --- engines/pegasus/surface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 9493323af6..72d614f963 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -120,6 +120,9 @@ public: Picture(const tDisplayElementID id) : DisplayElement(id) {} virtual ~Picture() {} + virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); + virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); + virtual void draw(const Common::Rect &); }; -- cgit v1.2.3 From 8bc240124ad8ea7ffd36f11d697a460e746956a8 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 29 Sep 2011 12:27:38 -0400 Subject: PEGASUS: Allow getting frames from videos --- engines/pegasus/surface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 72d614f963..c94ccdf0fc 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -73,6 +73,7 @@ public: virtual void getImageFromPICTFile(const Common::String &fileName); virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id); + virtual void getImageFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue); protected: bool _ownsSurface; @@ -103,6 +104,7 @@ public: virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); + virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false); }; class SpriteFrame : public Frame { @@ -122,6 +124,7 @@ public: virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false); + virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false); virtual void draw(const Common::Rect &); }; -- cgit v1.2.3 From c8526bf6c3a193cd41a41789eceb9dc155b85f5b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 23 Oct 2011 12:51:33 -0400 Subject: PEGASUS: Add support for scaled/glowing images/movies --- engines/pegasus/surface.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index c94ccdf0fc..9270de0665 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -70,6 +70,9 @@ public: void copyToCurrentPortTransparent(const Common::Rect &) const; void copyToCurrentPort(const Common::Rect &, const Common::Rect &) const; void copyToCurrentPortTransparent(const Common::Rect &, const Common::Rect &) const; + void copyToCurrentPortTransparentGlow(const Common::Rect &, const Common::Rect &) const; + void scaleTransparentCopy(const Common::Rect &, const Common::Rect &) const; + void scaleTransparentCopyGlow(const Common::Rect &, const Common::Rect &) const; virtual void getImageFromPICTFile(const Common::String &fileName); virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id); @@ -82,6 +85,9 @@ protected: private: void getImageFromPICTStream(Common::SeekableReadStream *stream); + + uint32 getGlowColor(uint32 color) const; + bool isTransparent(uint32 color) const; }; class PixelImage : public Surface { -- cgit v1.2.3 From 0d6dbfa2cbaa568464a18071484ab411cddba4f9 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 31 Oct 2011 23:20:54 -0400 Subject: PEGASUS: Add ability to draw masked surfaces --- engines/pegasus/surface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 9270de0665..ca148105f7 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -70,6 +70,7 @@ public: void copyToCurrentPortTransparent(const Common::Rect &) const; void copyToCurrentPort(const Common::Rect &, const Common::Rect &) const; void copyToCurrentPortTransparent(const Common::Rect &, const Common::Rect &) const; + void copyToCurrentPortMasked(const Common::Rect &, const Common::Rect &, const Surface *) const; void copyToCurrentPortTransparentGlow(const Common::Rect &, const Common::Rect &) const; void scaleTransparentCopy(const Common::Rect &, const Common::Rect &) const; void scaleTransparentCopyGlow(const Common::Rect &, const Common::Rect &) const; -- cgit v1.2.3 From b3eb2c65e36258d0018455962e610052b1569748 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 31 Oct 2011 23:25:37 -0400 Subject: PEGASUS: Fix some old Surface comments --- engines/pegasus/surface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index ca148105f7..3ccbf5913e 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -61,9 +61,8 @@ public: Graphics::Surface *getSurface() const { return _surface; } void getSurfaceBounds(Common::Rect &r) { r = _bounds; } - // None of the CopyToCurrentPort functions do any sanity checks. - // For speed, they just call CopyBits. - // It's up to clients to make sure that the GWorld is valid. + // None of the copyToCurrentPort* functions do any sanity checks. + // It's up to clients to make sure that the Surface is valid. void copyToCurrentPort() const; void copyToCurrentPortTransparent() const; void copyToCurrentPort(const Common::Rect &) const; -- cgit v1.2.3 From 12efb47b536d2f663c9cde2739a1fd40599da669 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 16 Dec 2011 14:17:50 -0500 Subject: PEGASUS: Remove t prefix from typedefs Some other minor cleanup too --- engines/pegasus/surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 3ccbf5913e..34a88dbd53 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -125,7 +125,7 @@ protected: class Picture : public DisplayElement, public Frame { public: - Picture(const tDisplayElementID id) : DisplayElement(id) {} + Picture(const DisplayElementID id) : DisplayElement(id) {} virtual ~Picture() {} virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false); -- cgit v1.2.3 From 983bd16bb78b1a6aa8872f2086dbcbca6954f2fb Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 3 Apr 2012 15:23:08 -0400 Subject: PEGASUS: Fix file permissions --- engines/pegasus/surface.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 engines/pegasus/surface.h (limited to 'engines/pegasus/surface.h') diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h old mode 100755 new mode 100644 -- cgit v1.2.3