mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 15:03:32 +00:00
37 lines
798 B
C++
Executable File
37 lines
798 B
C++
Executable File
//
|
|
// PixelCalc.h
|
|
// minecraftpe
|
|
//
|
|
// Created by rhino on 10/24/11.
|
|
// Copyright (c) 2011 Mojang AB. All rights reserved.
|
|
//
|
|
|
|
#ifndef minecraftpe_PixelCalc_h
|
|
#define minecraftpe_PixelCalc_h
|
|
|
|
class PixelCalc
|
|
{
|
|
public:
|
|
PixelCalc(float pixelsPerMillimeter = 1) {
|
|
setPixelsPerMillimeter(pixelsPerMillimeter);
|
|
}
|
|
|
|
float millimetersToPixels(float mm) const {
|
|
return mm * _pixelsPerMillimeter;
|
|
}
|
|
float pixelsToMillimeters(float pp) const {
|
|
return pp * _millimetersPerPixel;
|
|
}
|
|
|
|
void setPixelsPerMillimeter(float pixelsPerMillimeter) {
|
|
_pixelsPerMillimeter = pixelsPerMillimeter;
|
|
_millimetersPerPixel = 1.0f / _pixelsPerMillimeter;
|
|
}
|
|
|
|
private:
|
|
float _pixelsPerMillimeter;
|
|
float _millimetersPerPixel;
|
|
};
|
|
|
|
#endif
|