1998-07-26 04:28:48 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsDeviceContext_h___
|
|
|
|
#define nsDeviceContext_h___
|
|
|
|
|
|
|
|
#include "nsIDeviceContext.h"
|
1998-07-29 00:42:50 +00:00
|
|
|
#include "libimg.h"
|
1998-08-03 04:53:25 +00:00
|
|
|
|
1998-07-29 00:42:50 +00:00
|
|
|
class nsIImageRequest;
|
1998-08-07 02:12:34 +00:00
|
|
|
class nsHashtable;
|
1998-07-26 04:28:48 +00:00
|
|
|
|
1998-07-26 23:52:36 +00:00
|
|
|
class DeviceContextImpl : public nsIDeviceContext
|
1998-07-26 04:28:48 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DeviceContextImpl();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
virtual nsresult Init(nsNativeWidget aWidget);
|
|
|
|
|
|
|
|
virtual nsIRenderingContext * CreateRenderingContext(nsIView *aView);
|
|
|
|
virtual nsresult InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow);
|
|
|
|
|
|
|
|
virtual float GetDevUnitsToTwips() const;
|
|
|
|
virtual float GetTwipsToDevUnits() const;
|
|
|
|
|
|
|
|
virtual void SetAppUnitsToDevUnits(float aAppUnits);
|
|
|
|
virtual void SetDevUnitsToAppUnits(float aDevUnits);
|
|
|
|
|
|
|
|
virtual float GetAppUnitsToDevUnits() const;
|
|
|
|
virtual float GetDevUnitsToAppUnits() const;
|
|
|
|
|
|
|
|
virtual nsIFontCache * GetFontCache();
|
|
|
|
virtual void FlushFontCache();
|
|
|
|
|
|
|
|
virtual nsIFontMetrics* GetMetricsFor(const nsFont& aFont);
|
|
|
|
|
|
|
|
virtual void SetZoom(float aZoom);
|
|
|
|
virtual float GetZoom() const;
|
|
|
|
|
|
|
|
virtual float GetGamma(void);
|
|
|
|
virtual void SetGamma(float aGamma);
|
|
|
|
|
|
|
|
virtual PRUint8 * GetGammaTable(void);
|
|
|
|
|
|
|
|
virtual nsNativeWidget GetNativeWidget(void);
|
|
|
|
|
1998-08-03 04:53:25 +00:00
|
|
|
NS_IMETHOD LoadIconImage(PRInt32 aId, nsIImage*& aImage);
|
|
|
|
|
1998-08-07 02:12:34 +00:00
|
|
|
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName);
|
|
|
|
|
|
|
|
NS_IMETHOD GetLocalFontName(const nsString& aFaceName, nsString& aLocalName,
|
|
|
|
PRBool& aAliased);
|
|
|
|
|
1998-08-05 15:26:15 +00:00
|
|
|
NS_IMETHOD GetDepth(PRUint32& aDepth);
|
|
|
|
|
1998-08-03 04:53:25 +00:00
|
|
|
NS_IMETHOD CreateILColorSpace(IL_ColorSpace*& aColorSpace);
|
1998-07-29 00:42:50 +00:00
|
|
|
|
1998-07-26 04:28:48 +00:00
|
|
|
protected:
|
|
|
|
virtual ~DeviceContextImpl();
|
|
|
|
|
|
|
|
nsresult CreateFontCache();
|
|
|
|
void SetGammaTable(PRUint8 * aTable, float aCurrentGamma, float aNewGamma);
|
1998-08-03 04:53:25 +00:00
|
|
|
nsresult CreateIconILGroupContext();
|
1998-08-07 02:12:34 +00:00
|
|
|
virtual nsresult CreateFontAliasTable();
|
|
|
|
nsresult AliasFont(const nsString& aFont,
|
|
|
|
const nsString& aAlias, const nsString& aAltAlias);
|
1998-07-26 04:28:48 +00:00
|
|
|
|
|
|
|
float mTwipsToPixels;
|
|
|
|
float mPixelsToTwips;
|
|
|
|
float mAppUnitsToDevUnits;
|
|
|
|
float mDevUnitsToAppUnits;
|
|
|
|
nsIFontCache *mFontCache;
|
|
|
|
float mZoom;
|
|
|
|
float mGammaValue;
|
|
|
|
PRUint8 *mGammaTable;
|
|
|
|
nsNativeWidget mWidget;
|
1998-07-29 00:42:50 +00:00
|
|
|
IL_GroupContext* mIconImageGroup;
|
|
|
|
nsIImageRequest* mIcons[NS_NUMBER_OF_ICONS];
|
1998-08-07 02:12:34 +00:00
|
|
|
nsHashtable* mFontAliasTable;
|
1998-07-26 04:28:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDeviceContext_h___ */
|