gecko-dev/gfx/public/nsDeviceContext.h

125 строки
4.0 KiB
C
Исходник Обычный вид История

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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
1998-07-26 08:28:48 +04:00
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
1998-07-26 08:28:48 +04:00
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
1998-07-26 08:28:48 +04:00
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
1998-07-26 08:28:48 +04:00
*/
#ifndef nsDeviceContext_h___
#define nsDeviceContext_h___
#include "nsIDeviceContext.h"
#include "nsIDeviceContextSpec.h"
#include "libimg.h"
#include "nsCOMPtr.h"
2000-02-05 08:04:09 +03:00
#include "nsIAtom.h"
class nsIImageRequest;
class nsHashtable;
class nsFontCache;
1998-07-26 08:28:48 +04:00
class DeviceContextImpl : public nsIDeviceContext
1998-07-26 08:28:48 +04:00
{
public:
DeviceContextImpl();
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsNativeWidget aWidget);
1998-07-26 08:28:48 +04:00
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext){return NS_ERROR_NOT_IMPLEMENTED;}
1999-10-05 18:48:01 +04:00
NS_IMETHOD InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow);
1998-07-26 08:28:48 +04:00
NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const;
NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const;
1998-07-26 08:28:48 +04:00
NS_IMETHOD SetAppUnitsToDevUnits(float aAppUnits);
NS_IMETHOD SetDevUnitsToAppUnits(float aDevUnits);
1998-07-26 08:28:48 +04:00
NS_IMETHOD GetAppUnitsToDevUnits(float &aAppUnits) const;
NS_IMETHOD GetDevUnitsToAppUnits(float &aDevUnits) const;
1998-07-26 08:28:48 +04:00
NS_IMETHOD GetCanonicalPixelScale(float &aScale) const;
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
nsIFontMetrics*& aMetrics);
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
NS_IMETHOD SetTextZoom(float aTextZoom);
NS_IMETHOD GetTextZoom(float &aTextZoom) const;
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
NS_IMETHOD LoadIconImage(PRInt32 aId, nsIImage*& aImage);
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);
NS_IMETHOD GetILColorSpace(IL_ColorSpace*& aColorSpace);
1998-08-19 04:37:05 +04:00
NS_IMETHOD GetPaletteInfo(nsPaletteInfo&);
1998-07-26 08:28:48 +04:00
protected:
virtual ~DeviceContextImpl();
void CommonInit(void);
1998-07-26 08:28:48 +04:00
nsresult CreateFontCache();
void SetGammaTable(PRUint8 * aTable, float aCurrentGamma, float aNewGamma);
nsresult CreateIconILGroupContext();
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;
nsFontCache *mFontCache;
nsCOMPtr<nsIAtom> mWestern; // XXX temporary fix for performance bug - erik
1998-07-26 08:28:48 +04:00
float mZoom;
float mTextZoom;
1998-07-26 08:28:48 +04:00
float mGammaValue;
PRUint8 *mGammaTable;
IL_GroupContext* mIconImageGroup;
nsIImageRequest* mIcons[NS_NUMBER_OF_ICONS];
nsHashtable* mFontAliasTable;
IL_ColorSpace* mColorSpace;
float mCPixelScale;
public:
nsNativeWidget mWidget;
1998-07-26 08:28:48 +04:00
};
#endif /* nsDeviceContext_h___ */