Beatmup
Beatmup::ImageResolution Class Reference

Represents image size in pixels. More...

#include <image_resolution.h>

Public Member Functions

 ImageResolution ()
 
 ImageResolution (unsigned int width, unsigned int height)
 
bool operator== (const ImageResolution &) const
 
bool operator!= (const ImageResolution &) const
 
msize numPixels () const
 
float megaPixels () const
 
float getAspectRatio () const
 
float getInvAspectRatio () const
 
bool fat () const
 
IntRectangle closedRectangle () const
 
IntRectangle halfOpenedRectangle () const
 
unsigned int getWidth () const
 
unsigned int getHeight () const
 
void set (unsigned int width, unsigned int height)
 
 operator IntPoint () const
 

Private Attributes

unsigned int width
 
unsigned int height
 width and height in pixels More...
 

Detailed Description

Represents image size in pixels.

Definition at line 28 of file image_resolution.h.

Constructor & Destructor Documentation

◆ ImageResolution() [1/2]

ImageResolution::ImageResolution ( )

Definition at line 23 of file image_resolution.cpp.

23 : width(0), height(0) {}
unsigned int height
width and height in pixels

◆ ImageResolution() [2/2]

ImageResolution::ImageResolution ( unsigned int  width,
unsigned int  height 
)

Definition at line 25 of file image_resolution.cpp.

25 : width(width), height(height) {}

Member Function Documentation

◆ operator==()

bool ImageResolution::operator== ( const ImageResolution obj) const

Definition at line 27 of file image_resolution.cpp.

27  {
28  return (obj.width == width) && (obj.height == height);
29 }

◆ operator!=()

bool ImageResolution::operator!= ( const ImageResolution obj) const

Definition at line 31 of file image_resolution.cpp.

31  {
32  return !(*this == obj);
33 }

◆ numPixels()

msize ImageResolution::numPixels ( ) const

Definition at line 36 of file image_resolution.cpp.

36  {
37  return width*height;
38 }

◆ megaPixels()

float ImageResolution::megaPixels ( ) const

Definition at line 40 of file image_resolution.cpp.

40  {
41  return width*height / 1000000.0f;
42 }

◆ getAspectRatio()

float ImageResolution::getAspectRatio ( ) const

Definition at line 44 of file image_resolution.cpp.

44  {
45  return (float)width / height;
46 }

◆ getInvAspectRatio()

float ImageResolution::getInvAspectRatio ( ) const

Definition at line 48 of file image_resolution.cpp.

48  {
49  return (float)height / width;
50 }

◆ fat()

bool ImageResolution::fat ( ) const
Returns
true if the image width is greater than the height.

Definition at line 52 of file image_resolution.cpp.

52  {
53  return width >= height;
54 }

◆ closedRectangle()

IntRectangle Beatmup::ImageResolution::closedRectangle ( ) const
inline

Definition at line 47 of file image_resolution.h.

47  {
48  return IntRectangle(0, 0, width - 1, height - 1);
49  }
CustomRectangle< int > IntRectangle
Definition: geometry.h:630

◆ halfOpenedRectangle()

IntRectangle Beatmup::ImageResolution::halfOpenedRectangle ( ) const
inline

Definition at line 50 of file image_resolution.h.

50  {
51  return IntRectangle(0, 0, width, height);
52  }

◆ getWidth()

unsigned int Beatmup::ImageResolution::getWidth ( ) const
inline

Definition at line 54 of file image_resolution.h.

54 { return width; }

◆ getHeight()

unsigned int Beatmup::ImageResolution::getHeight ( ) const
inline

Definition at line 55 of file image_resolution.h.

55 { return height; }

◆ set()

void ImageResolution::set ( unsigned int  width,
unsigned int  height 
)

Definition at line 56 of file image_resolution.cpp.

56  {
57  this->width = width;
58  this->height = height;
59 }

◆ operator IntPoint()

Beatmup::ImageResolution::operator IntPoint ( ) const
inline

Definition at line 59 of file image_resolution.h.

59 { return IntPoint(width, height); }
CustomPoint< int > IntPoint
Definition: geometry.h:629

Member Data Documentation

◆ width

unsigned int Beatmup::ImageResolution::width
private

Definition at line 30 of file image_resolution.h.

◆ height

unsigned int Beatmup::ImageResolution::height
private

width and height in pixels

Definition at line 30 of file image_resolution.h.


The documentation for this class was generated from the following files: