Zack Rusin | 952e9d4 | 2011-04-09 23:37:21 -0400 | [diff] [blame] | 1 | #include "apisurface.h" |
| 2 | |
| 3 | #include <QDebug> |
| 4 | #include <QSysInfo> |
| 5 | |
| 6 | ApiSurface::ApiSurface() |
| 7 | { |
| 8 | } |
| 9 | |
| 10 | QSize ApiSurface::size() const |
| 11 | { |
| 12 | return m_size; |
| 13 | } |
| 14 | |
| 15 | void ApiSurface::setSize(const QSize &size) |
| 16 | { |
| 17 | m_size = size; |
| 18 | } |
| 19 | |
José Fonseca | b794df1 | 2011-04-12 08:28:45 +0100 | [diff] [blame] | 20 | int ApiSurface::numChannels() const |
| 21 | { |
| 22 | return m_numChannels; |
| 23 | } |
| 24 | |
| 25 | void ApiSurface::setNumChannels(int numChannels) |
| 26 | { |
| 27 | m_numChannels = numChannels; |
| 28 | } |
| 29 | |
Zack Rusin | 952e9d4 | 2011-04-09 23:37:21 -0400 | [diff] [blame] | 30 | void ApiSurface::contentsFromBase64(const QByteArray &base64) |
| 31 | { |
| 32 | QByteArray dataArray = QByteArray::fromBase64(base64); |
Zack Rusin | aa0a782 | 2011-04-25 00:05:48 -0400 | [diff] [blame] | 33 | m_image.loadFromData(dataArray, "png"); |
| 34 | m_image = m_image.mirrored(); |
Zack Rusin | 952e9d4 | 2011-04-09 23:37:21 -0400 | [diff] [blame] | 35 | m_thumb = m_image.scaled(64, 64, Qt::KeepAspectRatio); |
Zack Rusin | 952e9d4 | 2011-04-09 23:37:21 -0400 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | QImage ApiSurface::image() const |
| 39 | { |
| 40 | return m_image; |
| 41 | } |
| 42 | |
| 43 | QImage ApiSurface::thumb() const |
| 44 | { |
| 45 | return m_thumb; |
| 46 | } |
| 47 | |
| 48 | ApiTexture::ApiTexture() |
| 49 | : ApiSurface(), |
| 50 | m_unit(0), |
| 51 | m_level(0) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | int ApiTexture::unit() const |
| 56 | { |
| 57 | return m_unit; |
| 58 | } |
| 59 | |
| 60 | void ApiTexture::setUnit(int un) |
| 61 | { |
| 62 | m_unit = un; |
| 63 | } |
| 64 | |
| 65 | QString ApiTexture::target() const |
| 66 | { |
| 67 | return m_target; |
| 68 | } |
| 69 | |
| 70 | void ApiTexture::setTarget(const QString &str) |
| 71 | { |
| 72 | m_target = str; |
| 73 | } |
| 74 | |
| 75 | int ApiTexture::level() const |
| 76 | { |
| 77 | return m_level; |
| 78 | } |
| 79 | |
| 80 | void ApiTexture::setLevel(int l) |
| 81 | { |
| 82 | m_level = l; |
| 83 | } |
Zack Rusin | a684641 | 2011-04-10 19:51:44 -0400 | [diff] [blame] | 84 | |
| 85 | ApiFramebuffer::ApiFramebuffer() |
| 86 | : ApiSurface() |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | QString ApiFramebuffer::type() const |
| 91 | { |
| 92 | return m_type; |
| 93 | } |
| 94 | |
| 95 | void ApiFramebuffer::setType(const QString &str) |
| 96 | { |
| 97 | m_type = str; |
| 98 | } |