Skip to content

Commit

Permalink
libgui|Image: Creating an Image with a solid color
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 22, 2013
1 parent 892142d commit c07daf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/libgui/include/de/gui/image.h
Expand Up @@ -151,6 +151,8 @@ class LIBGUI_PUBLIC Image : public ISerializable
static GLFormat glFormat(Format imageFormat);
static GLFormat glFormat(QImage::Format qtImageFormat);

static Image solidColor(Color const &color, Size const &size);

private:
DENG2_PRIVATE(d)
};
Expand Down
8 changes: 8 additions & 0 deletions doomsday/libgui/src/image.cpp
Expand Up @@ -440,4 +440,12 @@ Image::GLFormat Image::glFormat(QImage::Format format)
}
return GLFormat(GL_RGBA, GL_UNSIGNED_BYTE, 4);
}

Image Image::solidColor(Color const &color, Size const &size)
{
QImage img(QSize(size.x, size.y), QImage::Format_ARGB32);
img.fill(QColor(color.x, color.y, color.z, color.w).rgba());
return img;
}

} // namespace de

0 comments on commit c07daf9

Please sign in to comment.