Scaling Class Reference

#include <Pt/Gfx/Scaling.h>

Logical-to-physical unit conversion. More...

Public Member Functions

 Scaling (double scaleFactor=1.0)
 Constructs a scaling with the given factor.
 
double scaleFactor () const
 Returns the scale factor.
 
void setScaleFactor (double scaleFactor)
 Sets the scale factor.
 
double toPhysical (double n) const
 Converts a scalar value to physical units.
 
Gfx::PointF toPhysical (const Gfx::PointF &p) const
 Converts a point to physical units.
 
Gfx::SizeF toPhysical (const Gfx::SizeF &s) const
 Converts a size to physical units.
 
Gfx::RectF toPhysical (const Gfx::RectF &r) const
 Converts a rectangle to physical units.
 
double toLogical (double n) const
 Converts a scalar value to logical units.
 
Gfx::PointF toLogical (const Gfx::PointF &p) const
 Converts a point to logical units.
 
Gfx::SizeF toLogical (const Gfx::SizeF &s) const
 Converts a size to logical units.
 
Gfx::RectF toLogical (const Gfx::RectF &r) const
 Converts a rectangle to logical units.
 
double align (double n) const
 Aligns a scalar value to the nearest physical pixel.
 
double alignPixel (double n) const
 Aligns a scalar value to a pixel center.
 
double alignContour (size_t n) const
 Aligns a contour width while preserving visible thickness.
 
Gfx::PointF align (const Gfx::PointF &p) const
 Aligns a point to physical pixels.
 
Gfx::SizeF align (const Gfx::SizeF &s) const
 Aligns a size to physical pixels.
 
Gfx::RectF align (const Gfx::RectF &rect) const
 Aligns a rectangle to physical pixels.
 

Related Functions

bool operator== (const Scaling &a, const Scaling &b)
 Returns true if both scalings are equal.
 
bool operator!= (const Scaling &a, const Scaling &b)
 Returns true if both scalings are different.
 
bool operator< (const Scaling &a, const Scaling &b)
 Returns true if one scaling sorts before another.
 

Detailed Description

Scaling converts coordinates, sizes and rectangles between logical drawing units and physical device pixels. It also provides alignment helpers that snap geometry to pixel boundaries for crisp rendering.