Added wxQuantize, wxSplashScreen, wxEffects & added palette to wxImage

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7892 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-07-28 17:53:25 +00:00
parent cbb4b02f09
commit 3f4fc7967b
15 changed files with 2138 additions and 0 deletions

49
include/wx/effects.h Normal file
View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: effects.h
// Purpose: wxEffects class
// Draws 3D effects.
// Author: Julian Smart et al
// Modified by:
// Created: 25/4/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma interface "effects.h"
#endif
#ifndef _WX_EFFECTS_H_
#define _WX_EFFECTS_H_
/*
* wxEffects: various 3D effects
*/
class WXDLLEXPORT wxEffects: public wxObject
{
DECLARE_CLASS(wxEffects)
public:
// Assume system colours
wxEffects() ;
// Going from lightest to darkest
wxEffects(const wxColour& highlightColour, const wxColour& lightShadow,
const wxColour& faceColour, const wxColour& mediumShadow, const wxColour& darkShadow) ;
// Draw a sunken edge
void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1);
// Tile a bitmap
bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap);
protected:
wxColour m_highlightColour; // Usually white
wxColour m_lightShadow; // Usually light grey
wxColour m_faceColour; // Usually grey
wxColour m_mediumShadow; // Usually dark grey
wxColour m_darkShadow; // Usually black
};
#endif

View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: splash.h
// Purpose: Splash screen class
// Author: Julian Smart
// Modified by:
// Created: 28/6/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma interface "splash.h"
#endif
#ifndef _WX_SPLASH_H_
#define _WX_SPLASH_H_
#include "wx/frame.h"
#include "wx/timer.h"
/*
* A window for displaying a splash screen
*/
#define wxSPLASH_CENTRE_ON_PARENT 0x01
#define wxSPLASH_CENTRE_ON_SCREEN 0x02
#define wxSPLASH_NO_CENTRE 0x00
#define wxSPLASH_TIMEOUT 0x04
#define wxSPLASH_NO_TIMEOUT 0x00
class WXDLLEXPORT wxSplashScreenWindow;
/*
* wxSplashScreen
*/
class WXDLLEXPORT wxSplashScreen: public wxFrame
{
public:
wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSIMPLE_BORDER|wxFRAME_FLOAT_ON_PARENT);
~wxSplashScreen();
void OnCloseWindow(wxCloseEvent& event);
void OnNotify(wxTimerEvent& event);
long GetSplashStyle() const { return m_splashStyle; }
wxSplashScreenWindow* GetSplashWindow() const { return m_window; }
int GetTimeout() const { return m_milliseconds; }
protected:
wxSplashScreenWindow* m_window;
long m_splashStyle;
int m_milliseconds;
wxTimer m_timer;
DECLARE_EVENT_TABLE()
};
/*
* wxSplashScreenWindow
*/
class WXDLLEXPORT wxSplashScreenWindow: public wxWindow
{
public:
wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
void OnPaint(wxPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnChar(wxKeyEvent& event);
void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
wxBitmap& GetBitmap() { return m_bitmap; }
protected:
wxBitmap m_bitmap;
DECLARE_EVENT_TABLE()
};
#endif
// _WX_SPLASH_H_

View File

@@ -177,6 +177,10 @@ public:
void SetMask( bool mask = TRUE );
bool HasMask() const;
bool HasPalette() const { return m_palette.Ok(); }
const wxPalette& GetPalette() const { return m_palette; }
void SetPalette(const wxPalette& palette) { m_palette = palette; }
unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 );
unsigned long ComputeHistogram( wxHashTable &h );
@@ -206,6 +210,7 @@ public:
protected:
static wxList sm_handlers;
wxPalette m_palette;
private:
friend class WXDLLEXPORT wxImageHandler;

71
include/wx/quantize.h Normal file
View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////
// Name: quantize.h
// Purpose: wxQuantizer class
// Author: Julian Smart
// Modified by:
// Created: 22/6/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
/*
* From jquant2.c
*
* Copyright (C) 1991-1996, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*/
#ifdef __GNUG__
#pragma interface "quantize.h"
#endif
#ifndef _WX_QUANTIZE_H_
#define _WX_QUANTIZE_H_
class WXDLLEXPORT wxImage;
/*
* wxQuantize
* Based on the JPEG quantization code. Reduces the number of colours in a wxImage.
*/
#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01
#define wxQUANTIZE_RETURN_8BIT_DATA 0x02
#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04
class WXDLLEXPORT wxQuantize: public wxObject
{
public:
DECLARE_DYNAMIC_CLASS(wxQuantize)
//// Constructor
wxQuantize() {};
//// Operations
// Reduce the colours in the source image and put the result into the
// destination image. Both images may be the same, to overwrite the source image.
// Specify an optional palette pointer to receive the resulting palette.
// This palette may be passed to ConvertImageToBitmap, for example.
// If you pass a palette pointer, you must free the palette yourself.
static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette = NULL, int desiredNoColours = 236,
unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
//// Helpers
// Converts input bitmap(s) into 8bit representation with custom palette
// in_rows and out_rows are arrays [0..h-1] of pointer to rows
// (in_rows contains w * 3 bytes per row, out_rows w bytes per row)
// fills out_rows with indexes into palette (which is also stored into palette variable)
static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours);
};
#endif
// _WX_QUANTIZE_H_

7
include/wx/splash.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef _WX_SPLASH_H_BASE_
#define _WX_SPLASH_H_BASE_
#include "wx/generic/splash.h"
#endif
// _WX_SPLASH_H_BASE_