1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0023712: Remove dependency on Aspect_GraphicDevice from Aspect_Window

This commit is contained in:
dbv
2013-02-18 11:59:36 +04:00
parent 8db070a59d
commit dc3fe572ec
114 changed files with 809 additions and 10216 deletions

View File

@@ -71,36 +71,6 @@ public:
Destroy();
}
//! Modifies the window background
Standard_EXPORT virtual void SetBackground (const Aspect_Background& theBackground);
//! Modifies the window background
Standard_EXPORT virtual void SetBackground (const Quantity_NameOfColor theBackColor);
//! Modifies the window background
Standard_EXPORT virtual void SetBackground (const Quantity_Color& theColor);
//! Modifies the window background
Standard_EXPORT void SetBackground (const Aspect_Handle theBackPixmap);
//! Loads the window background from an image file
Standard_EXPORT Standard_Boolean SetBackground (const Standard_CString theName,
const Aspect_FillMethod theMethod = Aspect_FM_CENTERED);
//! Modifies the window gradient background
Standard_EXPORT virtual void SetBackground (const Aspect_GradientBackground& theBackground);
//! Modifies the window gradient background
Standard_EXPORT void SetBackground (const Quantity_Color& theCol1,
const Quantity_Color& theCol2,
const Aspect_GradientFillMethod theMethod = Aspect_GFM_HOR);
//! Activates/Deactivates the Double Buffering capability for this window
Standard_EXPORT virtual void SetDoubleBuffer (const Standard_Boolean theDBmode);
//! Flushes all graphics to the screen and Swap the Double buffer
Standard_EXPORT virtual void Flush() const;
//! Opens the window <me>
Standard_EXPORT virtual void Map() const;
@@ -113,101 +83,22 @@ public:
//! Apply the mapping change to the window <me>
Standard_EXPORT virtual Standard_Boolean DoMapping() const;
//! Clears the Window in the Background color
Standard_EXPORT virtual void Clear() const;
//! Clears the Window Area defined by his center and PIXEL size in the Background color
Standard_EXPORT virtual void ClearArea (const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight) const;
//! Restores The Window from the BackingStored Window
Standard_EXPORT virtual void Restore() const;
//! Restores The Window Area defined by his center and PIXEL size from the BackingStored Window
Standard_EXPORT virtual void RestoreArea (const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight) const;
//! Dumps the Window to file
Standard_EXPORT virtual Standard_Boolean Dump (const Standard_CString theFilename,
const Standard_Real theGammaValue = 1.0) const;
//! Dumps the Window Area defined by his center and PIXEL size to an image file
Standard_EXPORT virtual Standard_Boolean DumpArea (const Standard_CString theFilename,
const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Standard_Real theGammaValue = 1.0) const;
//! Loads the image file to this Window
//! @return TRUE if the loading occurs normaly
Standard_EXPORT virtual Standard_Boolean Load (const Standard_CString theFilename) const;
//! Loads the image file to Window Area
Standard_EXPORT virtual Standard_Boolean LoadArea (const Standard_CString theFilename,
const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight) const;
//! Returns the BackingStore capability for this Window
Standard_EXPORT virtual Standard_Boolean BackingStore() const;
//! Returns the DoubleBuffer state
Standard_EXPORT virtual Standard_Boolean DoubleBuffer() const;
//! Returns True if the window <me> is opened
Standard_EXPORT virtual Standard_Boolean IsMapped() const;
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
Standard_EXPORT virtual Quantity_Ratio Ratio() const;
//! Returns The Window POSITION in DSU
Standard_EXPORT virtual void Position (Quantity_Parameter& X1,
Quantity_Parameter& Y1,
Quantity_Parameter& X2,
Quantity_Parameter& Y2) const;
//! Returns The Window POSITION in PIXEL
Standard_EXPORT virtual void Position (Standard_Integer& X1,
Standard_Integer& Y1,
Standard_Integer& X2,
Standard_Integer& Y2) const;
//! Returns The Window SIZE in DSU
Standard_EXPORT virtual void Size (Quantity_Parameter& theWidth,
Quantity_Parameter& theHeight) const;
//! Returns The Window SIZE in PIXEL
Standard_EXPORT virtual void Size (Standard_Integer& theWidth,
Standard_Integer& theHeight) const;
//! Returns The Window SIZE in MM
Standard_EXPORT virtual void MMSize (Standard_Real& theWidth,
Standard_Real& theHeight) const;
//! Returns the DSU value depending of the PIXEL value
Standard_EXPORT virtual Quantity_Parameter Convert (const Standard_Integer PV) const;
//! Returns the PIXEL value depending of the DSU value
Standard_EXPORT virtual Standard_Integer Convert (const Quantity_Parameter DV) const;
//! Returns the DSU position depending of the PIXEL position
Standard_EXPORT virtual void Convert (const Standard_Integer PX,
const Standard_Integer PY,
Quantity_Parameter& DX,
Quantity_Parameter& DY) const;
//! Returns the PIXEL position depending of the DSU position
Standard_EXPORT virtual void Convert (const Quantity_Parameter DX,
const Quantity_Parameter DY,
Standard_Integer& PX,
Standard_Integer& PY) const;
//! @return associated NSView
Standard_EXPORT NSView* HView() const;

View File

@@ -25,32 +25,11 @@
#include <Image_AlienPixMap.hxx>
#include <Aspect_Convert.hxx>
#include <Aspect_GraphicDevice.hxx>
#include <Aspect_WindowDefinitionError.hxx>
IMPLEMENT_STANDARD_HANDLE (Cocoa_Window, Aspect_Window)
IMPLEMENT_STANDARD_RTTIEXT(Cocoa_Window, Aspect_Window)
//! Dummy device class implementation
class Cocoa_GraphicDevice : public Aspect_GraphicDevice
{
public:
virtual Handle_Aspect_GraphicDriver GraphicDriver() const
{
return NULL;
}
DEFINE_STANDARD_RTTI(Cocoa_GraphicDevice)
};
DEFINE_STANDARD_HANDLE(Cocoa_GraphicDevice, Aspect_GraphicDevice)
IMPLEMENT_STANDARD_HANDLE (Cocoa_GraphicDevice, Aspect_GraphicDevice)
IMPLEMENT_STANDARD_RTTIEXT(Cocoa_GraphicDevice, Aspect_GraphicDevice)
static Standard_Integer getScreenBottom()
{
Cocoa_LocalPool aLocalPool;
@@ -83,7 +62,7 @@ Cocoa_Window::Cocoa_Window (const Standard_CString theTitle,
const Standard_Integer thePxTop,
const Standard_Integer thePxWidth,
const Standard_Integer thePxHeight)
: Aspect_Window (new Cocoa_GraphicDevice()),
: Aspect_Window (),
myHWindow (NULL),
myHView (NULL),
myXLeft (thePxLeft),
@@ -131,7 +110,7 @@ Cocoa_Window::Cocoa_Window (const Standard_CString theTitle,
// purpose :
// =======================================================================
Cocoa_Window::Cocoa_Window (NSView* theViewNS)
: Aspect_Window (new Cocoa_GraphicDevice()),
: Aspect_Window (),
myHWindow (NULL),
myHView ([theViewNS retain]),
myXLeft (0),
@@ -189,101 +168,6 @@ void Cocoa_Window::SetHView (NSView* theView)
myHView = [theView retain];
}
// =======================================================================
// function : DoubleBuffer
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::DoubleBuffer() const
{
return Standard_True;
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Aspect_Background& theBackground)
{
SetBackground (theBackground.Color());
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Quantity_NameOfColor theBackColor)
{
SetBackground (Quantity_Color (theBackColor));
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Aspect_Handle theBackPixmap)
{
//
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::SetBackground (const Standard_CString theFileName,
const Aspect_FillMethod theMethod)
{
return Standard_False;
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Quantity_Color& theColor)
{
//
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Aspect_GradientBackground& theGrBackground)
{
Quantity_Color aColor1, aColor2;
theGrBackground.Colors (aColor1, aColor2);
SetBackground (aColor1, aColor2, theGrBackground.BgGradientFillMethod());
}
// =======================================================================
// function : SetBackground
// purpose :
// =======================================================================
void Cocoa_Window::SetBackground (const Quantity_Color& theColor1,
const Quantity_Color& theColor2,
const Aspect_GradientFillMethod theMethod)
{
//
}
// =======================================================================
// function : SetDoubleBuffer
// purpose :
// =======================================================================
void Cocoa_Window::SetDoubleBuffer (const Standard_Boolean )
{
//
}
// =======================================================================
// function : Flush
// purpose :
// =======================================================================
void Cocoa_Window::Flush() const
{
Restore();
}
// =======================================================================
// function : IsMapped
// purpose :
@@ -376,122 +260,6 @@ Standard_Boolean Cocoa_Window::DoMapping() const
return Standard_True;
}
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
void Cocoa_Window::Clear() const
{
//
}
// =======================================================================
// function : ClearArea
// purpose :
// =======================================================================
void Cocoa_Window::ClearArea (const Standard_Integer Xc,
const Standard_Integer Yc,
const Standard_Integer Width,
const Standard_Integer Height) const
{
//
}
// =======================================================================
// function : Restore
// purpose :
// =======================================================================
void Cocoa_Window::Restore() const
{
//
}
// =======================================================================
// function : RestoreArea
// purpose :
// =======================================================================
void Cocoa_Window::RestoreArea (const Standard_Integer Xc,
const Standard_Integer Yc,
const Standard_Integer Width,
const Standard_Integer Height) const
{
//
}
// =======================================================================
// function : Dump
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::Dump (const Standard_CString theFilename,
const Standard_Real theGammaValue) const
{
/*Image_AlienPixMap anImg;
if (!ToPixMap (anImg) || anImg.IsEmpty())
{
return Standard_False;
}
if (Abs (theGammaValue - 1.0) > 0.001)
{
anImg.AdjustGamma (theGammaValue);
}
return anImg.Save (theFilename);*/
return Standard_False;
}
// =======================================================================
// function : DumpArea
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::DumpArea (const Standard_CString theFilename,
const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Standard_Real theGammaValue) const
{
return Standard_False;
}
// =======================================================================
// function : ToPixMap
// purpose :
// =======================================================================
/*Standard_Boolean Cocoa_Window::ToPixMap (Image_PixMap& thePixMap) const
{
return Standard_False;
}*/
// =======================================================================
// function : Load
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::Load (const Standard_CString theFilename) const
{
return Standard_False;
}
// =======================================================================
// function : LoadArea
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::LoadArea (const Standard_CString theFilename,
const Standard_Integer theCenterX,
const Standard_Integer theCenterY,
const Standard_Integer theWidth,
const Standard_Integer theHeight) const
{
return Standard_False;
}
// =======================================================================
// function : BackingStore
// purpose :
// =======================================================================
Standard_Boolean Cocoa_Window::BackingStore() const
{
return Standard_False;
}
// =======================================================================
// function : Ratio
// purpose :
@@ -507,16 +275,6 @@ Quantity_Ratio Cocoa_Window::Ratio() const
return Quantity_Ratio (aBounds.size.width / aBounds.size.height);
}
// =======================================================================
// function : Position
// purpose :
// =======================================================================
void Cocoa_Window::Position (Quantity_Parameter& X1, Quantity_Parameter& Y1,
Quantity_Parameter& X2, Quantity_Parameter& Y2) const
{
//
}
// =======================================================================
// function : Position
// purpose :
@@ -527,16 +285,6 @@ void Cocoa_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
//
}
// =======================================================================
// function : Size
// purpose :
// =======================================================================
void Cocoa_Window::Size (Quantity_Parameter& theWidth,
Quantity_Parameter& theHeight) const
{
//
}
// =======================================================================
// function : Size
// purpose :
@@ -553,55 +301,3 @@ void Cocoa_Window::Size (Standard_Integer& theWidth,
theWidth = (Standard_Integer )aBounds.size.width;
theHeight = (Standard_Integer )aBounds.size.height;
}
// =======================================================================
// function : MMSize
// purpose :
// =======================================================================
void Cocoa_Window::MMSize (Standard_Real& theWidth,
Standard_Real& theHeight) const
{
//
}
// =======================================================================
// function : Convert
// purpose :
// =======================================================================
Quantity_Parameter Cocoa_Window::Convert (const Standard_Integer PV) const
{
return 0.0; ///
}
// =======================================================================
// function : Convert
// purpose :
// =======================================================================
Standard_Integer Cocoa_Window::Convert (const Quantity_Parameter DV) const
{
return 0; ////
}
// =======================================================================
// function : Convert
// purpose :
// =======================================================================
void Cocoa_Window::Convert (const Standard_Integer PX,
const Standard_Integer PY,
Quantity_Parameter& DX,
Quantity_Parameter& DY) const
{
//
}
// =======================================================================
// function : Convert
// purpose :
// =======================================================================
void Cocoa_Window::Convert (const Quantity_Parameter DX,
const Quantity_Parameter DY,
Standard_Integer& PX,
Standard_Integer& PY) const
{
//
}