52 #ifndef __PCL_ImageWindow_h
53 #define __PCL_ImageWindow_h
62 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
76 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
80 class ProcessInterface;
128 return m != NewPreview && m != EditPreview;
161 namespace BackgroundBrush
195 namespace TransparencyMode
205 Default = BackgroundBrush
246 DefaultMode = 0x00000000,
247 PixelData = 0x00000001,
249 ICCProfile = 0x00000004,
250 Keywords = 0x00000008,
252 FormatData = 0x00000020,
253 ImageId = 0x00000040,
254 Resolution = 0x00000080,
255 AstrometricSolution = 0x00000100,
256 ViewProperties = 0x00010000,
258 DeletePropertiesOnEntry = 0x01000000,
259 DeletePropertiesOnExit = 0x02000000,
260 ExcludePreviews = 0x80000000,
261 ExcludeMaskRelations = 0x40000000
269 using UndoFlags = Flags<UndoFlag::mask_type>;
273 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
294 using gui_mode = ImageMode::value_type;
301 using display_channel = DisplayChannel::value_type;
308 using mask_mode = MaskMode::value_type;
315 using background_brush = BackgroundBrush::value_type;
322 using transparency_mode = TransparencyMode::value_type;
376 int bitsPerSample = 32,
bool floatSample =
true,
bool color =
false,
377 bool initialProcessing =
true,
380 ImageWindow(
int width,
int height,
int numberOfChannels,
381 int bitsPerSample,
bool floatSample,
bool color,
382 bool initialProcessing,
385 bitsPerSample, floatSample, color,
537 bool allowMessages =
true );
539 template <
class S1,
class S2>
542 const S2& formatHints,
544 bool allowMessages =
true )
594 return !FileURL().IsEmpty();
616 return ModifyCount() > 0;
677 View v( MainView() ); SelectView( v );
702 return NumberOfPreviews() > 0;
723 return PreviewById(
IsoString( previewId ) );
733 return !IsNull() && !PreviewById( previewId ).IsNull();
738 return PreviewExists(
IsoString( previewId ) );
768 View v( PreviewById( previewId ) ), SelectPreview( v );
786 return CreatePreview( r.
x0, r.
y0, r.
x1, r.
y1, previewId );
791 return CreatePreview( r,
IsoString( previewId ) );
817 return CreatePreview( x0, y0, x1, y1,
IsoString( previewId ) );
830 ModifyPreview( previewId, r.
x0, r.
y0, r.
x1, r.
y1, newId );
835 ModifyPreview(
IsoString( previewId ), r );
840 ModifyPreview( IsoString( previewId ), r, IsoString( newId ) );
870 ModifyPreview(
IsoString( previewId ), x0, y0, x1, y1 );
890 return PreviewRect(
IsoString( previewId ) );
980 SetMask( mask, invert );
998 EnableMask( !disable );
1151 EnableColorManagement( !disable );
1186 EnableProofing( !disable );
1223 EnableGamutCheck( !disable );
1308 keywords = Keywords();
1479 template <
typename T>
1482 DPoint qI(
double( pI.
x ),
double( pI.
y ) );
1483 if ( ImageToCelestial( qI.
x, qI.
y, rawRA ) )
1531 if ( CelestialToImage( qI.
x, qI.
y ) )
1590 SetResolution( r, r, metric );
1758 return CurrentChannel() >= DisplayChannel::Alpha;
1772 return CurrentChannel() - DisplayChannel::Alpha;
1883 return TransparencyMode() != pcl::TransparencyMode::Hide;
1909 SetTransparencyMode( pcl::TransparencyMode::Hide );
1971 SetViewport( center.
x, center.
y, zoom );
2016 bool allowMagnification =
true,
2017 bool allowAnimations =
true,
2018 bool noLimits =
false );
2045 int z = ZoomFactor() + 1;
2046 SetZoomFactor( (z > 0) ? z : +1 );
2057 int z = ZoomFactor() - 1;
2058 SetZoomFactor( (z > 0 || z < -1) ? z : -2 );
2083 GetViewportSize( w, dum );
2093 GetViewportSize( dum, h );
2129 SetViewportPosition( p.
x, p.
y );
2147 return VisibleViewportRect().Width();
2156 return VisibleViewportRect().Height();
2179 void Show(
bool fitWindow =
true );
2301 SetDynamicCursor( xpm, p.
x, p.
y );
2338 SetDynamicCursor( bmp, p.
x, p.
y );
2414 template <
typename T>
2418 ViewportToImage( p1.
x, p1.
y );
2427 template <
typename T>
2431 ViewportToImage( r1.
x0, r1.
y0 );
2432 ViewportToImage( r1.
x1, r1.
y1 );
2467 template <
typename T>
2470 ViewportToImage( a.Begin(), a.Length() );
2512 template <
typename T>
2515 return ViewportScalarToImage(
double( d ) );
2541 template <
typename T>
2545 ImageToViewport( p1.
x, p1.
y );
2558 template <
typename T>
2562 ImageToViewport( r1.
x0, r1.
y0 );
2563 ImageToViewport( r1.
x1, r1.
y1 );
2598 template <
typename T>
2601 ImageToViewport( a.Begin(), a.Length() );
2663 ViewportToGlobal( p1.
x, p1.
y );
2675 ViewportToGlobal( r1.
x0, r1.
y0 );
2676 ViewportToGlobal( r1.
x1, r1.
y1 );
2696 GlobalToViewport( p1.
x, p1.
y );
2708 GlobalToViewport( r1.
x0, r1.
y0 );
2709 GlobalToViewport( r1.
x1, r1.
y1 );
2723 SetZoomFactor( ZoomFactor() );
2743 RegenerateViewportRect( r.
x0, r.
y0, r.
x1, r.
y1 );
2772 RegenerateImageRect( r.
x0, r.
y0, r.
x1, r.
y1 );
2807 UpdateViewportRect( r.
x0, r.
y0, r.
x1, r.
y1 );
2836 UpdateImageRect( r.
x0, r.
y0, r.
x1, r.
y1 );
2897 return ViewportBitmap( r.
x0, r.
y0, r.
x1, r.
y1, flags );
2931 BeginSelection( p.
x, p.
y, flags );
2962 ModifySelection( p.
x, p.
y, flags );
3060 friend class ProcessContextDispatcher;
3061 friend class InternalWindowEnumerator;
bool IsEmpty() const noexcept
Client-side interface to a PixInsight Bitmap object.
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
A generic rectangle in the two-dimensional space.
component x1
Horizontal coordinate of the lower right corner.
component y1
Vertical coordinate of the lower right corner.
component y0
Vertical coordinate of the upper left corner.
component x0
Horizontal coordinate of the upper left corner.
A high-level interface to ICC color profiles.
Format-independent, fundamental image stream options.
High-level interface to an image window object in the PixInsight core application.
void SetResolution(double xRes, double yRes, bool metric=false)
void BeginSelection(int x, int y, uint32 flags=0)
View CreatePreview(int x0, int y0, int x1, int y1, const IsoString &previewId=IsoString())
void SetICCProfile(const ICCProfile &icc)
void EnableColorManagement(bool=true)
void SetRGBWS(const RGBColorSystem &rgbws)
GenericRectangle< T > ImageToViewport(const GenericRectangle< T > &r) const
ImageOptions FileInfo() const
void RegenerateImageRect(double x0, double y0, double x1, double y1)
static ImageWindow ActiveWindow()
bool HasPendingUpdates() const
GenericPoint< T > ImageToViewport(const GenericPoint< T > &p) const
void CommitPendingUpdates()
ImageWindow(ImageWindow &&x)
void ViewportToGlobal(int &x, int &y) const
static bool IsDefaultThumbnailEmbeddingEnabled()
display_channel CurrentChannel() const
void SetDynamicCursor(const char **xpm, const Point &p)
bool GetKeywords(FITSKeywordArray &keywords) const
static bool SetSwapDirectories(const StringList &directories)
int CurrentAlphaChannel() const
ImageWindow(const ImageWindow &w)
DPoint ViewportToImage(const GenericPoint< T > &p) const
void ModifySelection(int x, int y, uint32 flags=0)
void ZoomToFit(bool optimalFit=true, bool allowMagnification=true, bool allowAnimations=true, bool noLimits=false)
void RegenerateViewportRect(const Rect &r)
void HideMask(bool hide=true)
void SelectChannel(display_channel c)
void SetMaskMode(mask_mode mode)
ImageWindow(int width, int height, int numberOfChannels=1, int bitsPerSample=32, bool floatSample=true, bool color=false, bool initialProcessing=true, const IsoString &id=IsoString())
bool HasMaskReferences() const
bool GetICCProfile(ICCProfile &icc) const
void ViewportToImage(Point *p, size_type n) const
Bitmap DynamicCursorBitmap() const
bool IsMaskCompatible(const ImageWindow &)
void BeginSelection(const Point &p, uint32 flags=0)
Rect GlobalToViewport(const Rect &r) const
void DisableProofing(bool disable=true)
void UpdateViewportRect(int x0, int y0, int x1, int y1)
void GetViewportSize(int &width, int &height) const
Point DynamicCursorHotSpot() const
void SetResolution(double r, bool metric=false)
void SetDynamicCursor(const char **xpm, int hx=0, int hy=0)
void SelectPreview(const IsoString &previewId)
View CreatePreview(const Rect &r, const IsoString &previewId=IsoString())
static ImageWindow & Null()
View PreviewById(const IsoString &previewId) const
int ImageScalarToViewport(int) const
void ViewportScalarToImage(int *d, size_type n) const
int VisibleViewportHeight() const
static ImageWindow WindowById(const IsoString &id)
int ViewportHeight() const
Point GlobalToViewport(const Point &p) const
void Show(bool fitWindow=true)
void RegenerateViewportRect(int x0, int y0, int x1, int y1)
void RemoveMaskReferences()
Rect VisibleViewportRect() const
void DeletePreview(const IsoString &previewId)
Array< View > Previews() const
bool IsMaskInverted() const
void SetICCProfile(const String &filePath)
void ViewportToImage(Array< GenericPoint< T > > &a) const
bool PreviewExists(const IsoString &previewId) const
static void SetBackgroundBrush(background_brush brush, uint32 fgColor=0, uint32 bgColor=0)
bool IsAlphaChannelDisplayed() const
void EnableProofing(bool=true)
void EnableGamutCheck(bool=true)
void InvertMask(bool invert=true)
static bool IsDefaultICCProfileEmbeddingEnabledForRGBImages()
void ModifySelection(const Point &p, uint32 flags=0)
bool IsMaskVisible() const
Rect ViewportToGlobal(const Rect &r) const
void SetDynamicCursor(const Bitmap &bmp, int hx=0, int hy=0)
Point ViewportToGlobal(const Point &p) const
double ViewportScalarToImage(T d) const
void GetResolution(double &xRes, double &yRes, bool &metric) const
DRect ViewportToImage(const GenericRectangle< T > &r) const
static StringList SwapDirectories()
static void GetDefaultResolution(double &xRes, double &yRes, bool &metric)
Rect PreviewRect(const IsoString &previewId) const
bool IsTransparencyVisible() const
double ImageScalarToViewport(double) const
void ModifyPreview(const IsoString &previewId, int x0, int y0, int x1, int y1, const IsoString &newId=IsoString())
void ResetDynamicCursor()
void GetSampleFormat(int &bitsPerSample, bool &floatSample) const
static gui_mode CurrentMode()
static bool IsDynamicSessionActive()
static ImageWindow WindowByFilePath(const String &filePath)
void DisableGamutCheck(bool disable=true)
void ImageToViewport(DPoint *p, size_type n) const
void UpdateImageRect(double x0, double y0, double x1, double y1)
void EnableMask(bool=true)
Rect SelectionRect(uint32 *flags=nullptr) const
static bool IsDefaultICCProfileEmbeddingEnabledForGrayscaleImages()
static Array< ImageWindow > AllWindows(bool includeIconicWindows=true)
static bool IsDefaultPropertiesEmbeddingEnabled()
void ViewportToImage(DPoint *p, size_type n) const
void ViewportScalarToImage(double *d, size_type n) const
void SetViewportPosition(const Point &p)
static ProcessInterface * ActiveDynamicInterface()
int NumberOfPreviews() const
Rect ViewportUpdateRect() const
int ViewportWidth() const
Bitmap ViewportBitmap(int x0, int y0, int x1, int y1, uint32 flags=0) const
void UpdateImageRect(const pcl::DRect &r)
void SetSampleFormat(int bitsPerSample, bool floatSample)
bool IsProofingEnabled() const
void SetTransparencyMode(transparency_mode mode, RGBA color=0)
void ImageToViewport(Array< GenericPoint< T > > &a) const
mask_mode MaskMode() const
static void SelectMode(gui_mode mode)
void UpdateViewportRect(const Rect &r)
static void GetGlobalRGBWS(RGBColorSystem &rgbws)
void ViewportToImage(double &x, double &y) const
bool IsGamutCheckEnabled() const
double DisplayPixelRatio() const
static background_brush GetBackgroundBrush(uint32 &fgColor, uint32 &bgColor)
int VisibleViewportWidth() const
void ImageToViewport(Point *p, size_type n) const
size_type ModifyCount() const
void ModifyPreview(const IsoString &previewId, const Rect &r, const IsoString &newId=IsoString())
void SetMask(ImageWindow &w, bool inverted=false)
void SelectPreview(View &)
static bool TerminateDynamicSession(bool closeInterface=true)
void DisableMask(bool disable=true)
void UpdateMaskReferences()
void GlobalToViewport(int &x, int &y) const
void RegenerateImageRect(const pcl::DRect &r)
void SetViewport(double cx, double cy, int zoom=0)
bool IsValidView(const View &) const
static int CursorTolerance()
bool IsMaskEnabled() const
void ImageToViewport(int &x, int &y) const
bool UsingGlobalRGBWS() const
double ViewportScalarToImage(double d) const
void DisableColorManagement(bool disable=true)
RGBA TransparencyColor() const
Point ViewportPosition() const
void SetColorManagementFeatures(bool cmEnabled, bool proofing, bool gamutCheck)
void SetDynamicCursor(const Bitmap &bmp, const Point &p)
bool IsColorManagementEnabled() const
static Array< ImageWindow > Open(const String &url, const IsoString &id=IsoString(), const IsoString &formatHints=IsoString(), bool asCopy=false, bool allowMessages=true)
FITSKeywordArray Keywords() const
static void SetGlobalRGBWS(const RGBColorSystem &rgbws)
void ImageScalarToViewport(double *d, size_type n) const
void GetRGBWS(RGBColorSystem &rgbws) const
void ImageToViewport(double &x, double &y) const
void SetViewport(const DPoint ¢er, int zoom=0)
transparency_mode TransparencyMode() const
Bitmap ViewportBitmap(const Rect &r, uint32 flags=0) const
void ViewportToImage(int &x, int &y) const
void SetViewportPosition(int x, int y)
View SelectedPreview() const
void SetZoomFactor(int z)
void ImageScalarToViewport(int *d, size_type n) const
void SetKeywords(const FITSKeywordArray &keywords)
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
GenericString< char16_type, CharTraits, PCL_STRING_ALLOCATOR > ustring_base
High-level interface to a process instance.
Client-side interface to a PixInsight process interface window.
Colorimetrically defined RGB working color space.
32-bit integer rectangle on the plane.
Root base class for all user interface objects.
A collection of history data item specifiers.
High-level interface to a PixInsight view object.
bool CelestialToImage(DPoint &pI, const DPoint &pRD) const
bool CelestialToImage(double &ra, double &dec) const
bool ImageToCelestial(DPoint &pRD, const GenericPoint< T > &pI, bool rawRA=false) const
bool CopyAstrometricSolution(const ImageWindow &source, bool notify=true)
void UpdateAstrometryMetadata(bool notify=true)
bool HasAstrometricSolution() const
void ClearAstrometricSolution(bool notify=true)
bool ImageToCelestial(double &x, double &y, bool rawRA=false) const
bool RegenerateAstrometricSolution(bool allowGUIMessages=true, bool notify=true)
bool IsValidMainViewMode(value_type m)
bool IsValidPreviewMode(value_type m)