\
src/anchor.cpp \
src/anchor.hpp \
+ src/bitmap_font.cpp \
+ src/bitmap_font.hpp \
src/dialogs.cpp \
src/dialogs.hpp \
src/ft2_bitmap.cpp \
src/ft2_bitmap.hpp \
src/ft2_font.cpp \
src/ft2_font.hpp \
+ src/generic_bitmap.cpp \
src/generic_bitmap.hpp \
src/generic_font.hpp \
src/generic_layout.cpp \
--- /dev/null
+/*****************************************************************************
+ * bitmap_font.cpp
+ *****************************************************************************
+ * Copyright (C) 2004 VideoLAN
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@via.ecp.fr>
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#include "bitmap_font.hpp"
+#include "generic_bitmap.hpp"
+
+
+BitmapFont::BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap ):
+ GenericFont( pIntf ), m_rBitmap( rBitmap )
+{
+}
+
+
+GenericBitmap *BitmapFont::drawString( const UString &rString,
+ uint32_t color, int maxWidth ) const
+{
+ return NULL;
+}
+
--- /dev/null
+/*****************************************************************************
+ * bitmap_font.hpp
+ *****************************************************************************
+ * Copyright (C) 2004 VideoLAN
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@via.ecp.fr>
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#ifndef BITMAP_FONT_HPP
+#define BITMAP_FONT_HPP
+
+#include "generic_font.hpp"
+
+class GenericBitmap;
+
+
+/// Class to handle bitmap fonts
+class BitmapFont: public GenericFont
+{
+ public:
+ BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap );
+ virtual ~BitmapFont() {}
+
+ virtual bool init() { return true; }
+
+ /// Render a string on a bitmap.
+ /// If maxWidth != -1, the text is truncated with '...'
+ virtual GenericBitmap *drawString( const UString &rString,
+ uint32_t color, int maxWidth = -1 ) const;
+
+ /// Get the font size
+ virtual int getSize() const { return 12; }
+
+ private:
+ /// Bitmap
+ const GenericBitmap &m_rBitmap;
+};
+
+#endif
* ft2_font.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ft2_font.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Render a string on a bitmap.
/// If maxWidth != -1, the text is truncated with '...'
- /// rAscent is filled with the maximum ascent of the glyphs in
- /// the string (for explanations, see:
- /// http://www.freetype.org/freetype2/docs/tutorial/step2.html)
virtual GenericBitmap *drawString( const UString &rString,
uint32_t color, int maxWidth = -1 ) const;
--- /dev/null
+/*****************************************************************************
+ * generic_bitmap.cpp
+ *****************************************************************************
+ * Copyright (C) 2004 VideoLAN
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@via.ecp.fr>
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#include "generic_bitmap.hpp"
+
+
+SubBitmap::SubBitmap( intf_thread_t *pIntf, const GenericBitmap &rSource,
+ int left, int top, int width, int height ):
+ GenericBitmap( pIntf ), m_width( width ), m_height( height ),
+ m_pData( NULL )
+{
+ m_pData = new uint8_t[width * height * 4];
+
+ uint32_t *pSrc = (uint32_t*)rSource.getData();
+ uint32_t *pDest = (uint32_t*)m_pData;
+ int srcWidth = rSource.getWidth();
+ for( int y = top; y < top + height; y++ )
+ {
+ memcpy( pDest, pSrc, 4 * width );
+ pSrc += srcWidth;
+ pDest += width;
+ }
+}
+
+
+SubBitmap::~SubBitmap()
+{
+ delete[] m_pData;
+}
+
* generic_bitmap.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: generic_bitmap.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../utils/pointer.hpp"
-/// base class for bitmaps
+/// Base class for bitmaps
class GenericBitmap: public SkinObject
{
public:
GenericBitmap( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
};
+
+/// Bitmap created from a region of another bitmap
+class SubBitmap: public GenericBitmap
+{
+ public:
+ SubBitmap( intf_thread_t *pIntf, const GenericBitmap &rSource,
+ int left, int top, int width, int height );
+ ~SubBitmap();
+
+ /// Get the width of the bitmap
+ virtual int getWidth() const { return m_width; }
+
+ /// Get the heighth of the bitmap
+ virtual int getHeight() const { return m_height; }
+
+ /// Get a linear buffer containing the image data.
+ /// Each pixel is stored in 4 bytes in the order B,G,R,A
+ virtual uint8_t *getData() const { return m_pData; }
+
+ private:
+ /// Size of the bitmap.
+ int m_width, m_height;
+ /// Buffer containing the image data.
+ uint8_t *m_pData;
+};
+
+
typedef CountedPtr<GenericBitmap> GenericBitmapPtr;
#endif
* generic_font.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: generic_font.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Render a string on a bitmap.
/// If maxWidth != -1, the text is truncated with '...'
- /// rAscent is filled with the maximum ascent of the glyphs in
- /// the string (for explanations, see:
- /// http://www.freetype.org/freetype2/docs/tutorial/step2.html)
+ /// The Bitmap is _not_ owned by this object
virtual GenericBitmap *drawString( const UString &rString,
uint32_t color, int maxWidth = -1 ) const = 0;
-
/// Get the font size
virtual int getSize() const = 0;
italic CDATA "false"
underline CDATA "false"
>
+<!ELEMENT BitmapFont EMPTY>
+ <!ATTLIST Font
+ id CDATA #REQUIRED
+ file CDATA #REQUIRED
+ type CDATA "digits"
+ >
<!ELEMENT ThemeInfo EMPTY>
<!ATTLIST ThemeInfo
name CDATA #IMPLIED