diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-16 17:08:21 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-16 17:08:21 +0000 |
commit | 97c1de64ccb8828d260024cc64a76d3924d7962b (patch) | |
tree | b124ebef675aa4126f30d084ae7efdc44d28151b /src/graphic/graphic.cpp | |
parent | 304c79eeb6785efc39576cc89985787c1faea485 (diff) | |
download | mana-97c1de64ccb8828d260024cc64a76d3924d7962b.tar.gz mana-97c1de64ccb8828d260024cc64a76d3924d7962b.tar.bz2 mana-97c1de64ccb8828d260024cc64a76d3924d7962b.tar.xz mana-97c1de64ccb8828d260024cc64a76d3924d7962b.zip |
Added drawImageRect function to Graphics class.
Diffstat (limited to 'src/graphic/graphic.cpp')
-rw-r--r-- | src/graphic/graphic.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 71fc5a75..281c3c89 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -160,6 +160,46 @@ Graphics::~Graphics() { destroy_bitmap(buffer); } +void Graphics::drawImageRect( + int x, int y, int w, int h, + Image *topLeft, Image *topRight, + Image *bottomLeft, Image *bottomRight, + Image *top, Image *right, + Image *bottom, Image *left, + Image *center) +{ + // Draw the center area + center->drawPattern(buffer, + x + topLeft->getWidth(), y + topLeft->getHeight(), + w - topLeft->getWidth() - topRight->getWidth(), + h - topLeft->getHeight() - bottomLeft->getHeight()); + + // Draw the sides + top->drawPattern(buffer, + x + topLeft->getWidth(), y, + w - topLeft->getWidth() - topRight->getWidth(), top->getHeight()); + bottom->drawPattern(buffer, + x + bottomLeft->getWidth(), y + h - bottom->getHeight(), + w - bottomLeft->getWidth() - bottomRight->getWidth(), + bottom->getHeight()); + left->drawPattern(buffer, + x, y + topLeft->getHeight(), + left->getWidth(), + h - topLeft->getHeight() - bottomLeft->getHeight()); + right->drawPattern(buffer, + x + w - right->getWidth(), y + topRight->getHeight(), + right->getWidth(), + h - topRight->getHeight() - bottomRight->getHeight()); + + // Draw the corners + topLeft->draw(buffer, x, y); + topRight->draw(buffer, x + w - topRight->getWidth(), y); + bottomLeft->draw(buffer, x, y + h - bottomLeft->getHeight()); + bottomRight->draw(buffer, + x + w - bottomRight->getWidth(), + y + h - bottomRight->getHeight()); +} + void Graphics::updateScreen() { blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); |