diff options
Diffstat (limited to 'engines/wintermute/graphics/transparent_surface.h')
-rw-r--r-- | engines/wintermute/graphics/transparent_surface.h | 82 |
1 files changed, 63 insertions, 19 deletions
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index dc079a1fbc..1f3827d1a9 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -23,6 +23,7 @@ #define GRAPHICS_TRANSPARENTSURFACE_H #include "graphics/surface.h" +#include "engines/wintermute/graphics/transform_struct.h" /* * This code is based on Broken Sword 2.5 engine @@ -66,50 +67,94 @@ struct TransparentSurface : public Graphics::Surface { FLIP_VH = FLIP_H | FLIP_V }; - bool _enableAlphaBlit; + enum AlphaType { + ALPHA_OPAQUE = 0, + ALPHA_BINARY = 1, + ALPHA_FULL = 2 + }; + + #ifdef SCUMM_LITTLE_ENDIAN + static const int kAIndex = 0; + static const int kBIndex = 1; + static const int kGIndex = 2; + static const int kRIndex = 3; + #else + static const int kAIndex = 3; + static const int kBIndex = 2; + static const int kGIndex = 1; + static const int kRIndex = 0; + #endif + + static const int kBShift = 8;//img->format.bShift; + static const int kGShift = 16;//img->format.gShift; + static const int kRShift = 24;//img->format.rShift; + static const int kAShift = 0;//img->format.aShift; + + + static const int kBModShift = 0;//img->format.bShift; + static const int kGModShift = 8;//img->format.gShift; + static const int kRModShift = 16;//img->format.rShift; + static const int kAModShift = 24;//img->format.aShift; + /** @brief renders the surface to another surface - @param pDest a pointer to the target image. In most cases this is the framebuffer. - @param PosX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br> + @param target a pointer to the target surface. In most cases this is the framebuffer. + @param posX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br> The default value is 0. - @param PosY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br> + @param posY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br> The default value is 0. - @param Flipping how the the image should be flipped.<br> + @param flipping how the the image should be flipped.<br> The default value is BS_Image::FLIP_NONE (no flipping) - @param pSrcPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br> + @param pPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br> This referes to the unflipped and unscaled image.<br> The default value is NULL. - @param Color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br> + @param color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br> The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br> The color components determines the color for color modulation.<br> The default value is BS_ARGB(255, 255, 255, 255) (full covering, no color modulation). The macros BS_RGB and BS_ARGB can be used for the creation of the color value. - @param Width the output width of the screen section. + @param width the output width of the screen section. The images will be scaled if the output width of the screen section differs from the image section.<br> The value -1 determines that the image should not be scaled.<br> The default value is -1. - @param Width the output height of the screen section. + @param height the output height of the screen section. The images will be scaled if the output width of the screen section differs from the image section.<br> The value -1 determines that the image should not be scaled.<br> The default value is -1. @return returns false if the rendering failed. */ - Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0, int flipping = FLIP_NONE, Common::Rect *pPartRect = nullptr, uint color = BS_ARGB(255, 255, 255, 255), - int width = -1, int height = -1); + int width = -1, int height = -1, + TSpriteBlendMode blend = BLEND_NORMAL); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); - // The following scale-code supports arbitrary scaling (i.e. no repeats of column 0 at the end of lines) + + /** + * @brief Scale function; this returns a transformed version of this surface after rotation and + * scaling. Please do not use this if angle != 0, use rotoscale. + * + * @param newWidth the resulting width. + * @param newHeight the resulting height. + * @see TransformStruct + */ TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const; - TransparentSurface *scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const; - static byte *_lookup; - static void destroyLookup(); + + /** + * @brief Rotoscale function; this returns a transformed version of this surface after rotation and + * scaling. Please do not use this if angle == 0, use plain old scaling function. + * + * @param transform a TransformStruct wrapping the required info. @see TransformStruct + * + */ + TransparentSurface *rotoscale(const TransformStruct &transform) const; + AlphaType getAlphaMode() const; + void setAlphaMode(AlphaType); private: - static void doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); - static void generateLookup(); + AlphaType _alphaMode; + }; /** @@ -124,8 +169,7 @@ private: } };*/ - -} // End of namespace Graphics +} // End of namespace Wintermute #endif |