1998-07-26 08:28:48 +04: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-11-14 05:05:13 +03:00
|
|
|
#include "nsIDeviceContextSpec.h"
|
1998-07-29 04:42:50 +04:00
|
|
|
#include "libimg.h"
|
1998-08-03 08:53:25 +04:00
|
|
|
|
1998-07-29 04:42:50 +04:00
|
|
|
class nsIImageRequest;
|
1998-08-07 06:12:34 +04:00
|
|
|
class nsHashtable;
|
1998-09-30 22:58:24 +04:00
|
|
|
class nsFontCache;
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-07-27 03:52:36 +04:00
|
|
|
class DeviceContextImpl : public nsIDeviceContext
|
1998-07-26 08:28:48 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DeviceContextImpl();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1998-08-27 09:05:03 +04:00
|
|
|
NS_IMETHOD Init(nsNativeWidget aWidget);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-27 09:05:03 +04:00
|
|
|
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext);
|
1998-10-02 05:07:56 +04:00
|
|
|
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext);
|
1999-10-08 00:43:03 +04:00
|
|
|
//NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext) = 0;
|
1999-10-05 18:48:01 +04:00
|
|
|
|
1998-08-27 09:05:03 +04:00
|
|
|
NS_IMETHOD InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-27 09:05:03 +04:00
|
|
|
NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const;
|
|
|
|
NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const;
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-28 02:45:35 +04:00
|
|
|
NS_IMETHOD SetAppUnitsToDevUnits(float aAppUnits);
|
|
|
|
NS_IMETHOD SetDevUnitsToAppUnits(float aDevUnits);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-28 02:45:35 +04:00
|
|
|
NS_IMETHOD GetAppUnitsToDevUnits(float &aAppUnits) const;
|
|
|
|
NS_IMETHOD GetDevUnitsToAppUnits(float &aDevUnits) const;
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-11-14 05:05:13 +03:00
|
|
|
NS_IMETHOD GetCanonicalPixelScale(float &aScale) const;
|
|
|
|
|
1998-08-28 00:43:04 +04:00
|
|
|
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-27 22:47:22 +04:00
|
|
|
NS_IMETHOD SetZoom(float aZoom);
|
|
|
|
NS_IMETHOD GetZoom(float &aZoom) const;
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-27 22:47:22 +04:00
|
|
|
NS_IMETHOD GetGamma(float &aGamma);
|
|
|
|
NS_IMETHOD SetGamma(float aGamma);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-27 22:47:22 +04:00
|
|
|
NS_IMETHOD GetGammaTable(PRUint8 *&aGammaTable);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
1998-08-03 08:53:25 +04:00
|
|
|
NS_IMETHOD LoadIconImage(PRInt32 aId, nsIImage*& aImage);
|
|
|
|
|
1998-08-07 06:12:34 +04:00
|
|
|
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName);
|
|
|
|
|
|
|
|
NS_IMETHOD GetLocalFontName(const nsString& aFaceName, nsString& aLocalName,
|
|
|
|
PRBool& aAliased);
|
|
|
|
|
1998-12-02 03:36:08 +03:00
|
|
|
NS_IMETHOD FlushFontCache(void);
|
|
|
|
|
1998-08-05 19:26:15 +04:00
|
|
|
NS_IMETHOD GetDepth(PRUint32& aDepth);
|
|
|
|
|
1998-08-18 03:20:42 +04:00
|
|
|
NS_IMETHOD GetILColorSpace(IL_ColorSpace*& aColorSpace);
|
1998-07-29 04:42:50 +04:00
|
|
|
|
1998-08-19 04:37:05 +04:00
|
|
|
NS_IMETHOD GetPaletteInfo(nsPaletteInfo&);
|
|
|
|
|
1998-07-26 08:28:48 +04:00
|
|
|
protected:
|
|
|
|
virtual ~DeviceContextImpl();
|
|
|
|
|
1998-11-14 05:05:13 +03:00
|
|
|
void CommonInit(void);
|
1998-07-26 08:28:48 +04:00
|
|
|
nsresult CreateFontCache();
|
|
|
|
void SetGammaTable(PRUint8 * aTable, float aCurrentGamma, float aNewGamma);
|
1998-08-03 08:53:25 +04:00
|
|
|
nsresult CreateIconILGroupContext();
|
1998-08-07 06:12:34 +04:00
|
|
|
virtual nsresult CreateFontAliasTable();
|
|
|
|
nsresult AliasFont(const nsString& aFont,
|
1998-08-12 03:54:04 +04:00
|
|
|
const nsString& aAlias, const nsString& aAltAlias,
|
|
|
|
PRBool aForceAlias);
|
1998-07-26 08:28:48 +04:00
|
|
|
|
|
|
|
float mTwipsToPixels;
|
|
|
|
float mPixelsToTwips;
|
|
|
|
float mAppUnitsToDevUnits;
|
|
|
|
float mDevUnitsToAppUnits;
|
1998-09-30 22:58:24 +04:00
|
|
|
nsFontCache *mFontCache;
|
1998-07-26 08:28:48 +04:00
|
|
|
float mZoom;
|
|
|
|
float mGammaValue;
|
|
|
|
PRUint8 *mGammaTable;
|
1998-07-29 04:42:50 +04:00
|
|
|
IL_GroupContext* mIconImageGroup;
|
|
|
|
nsIImageRequest* mIcons[NS_NUMBER_OF_ICONS];
|
1998-08-07 06:12:34 +04:00
|
|
|
nsHashtable* mFontAliasTable;
|
1998-08-18 03:20:42 +04:00
|
|
|
IL_ColorSpace* mColorSpace;
|
1998-11-14 05:05:13 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
nsNativeWidget mWidget;
|
1998-07-26 08:28:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDeviceContext_h___ */
|