diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2006-08-19 02:17:01 +0000 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2006-08-19 02:17:01 +0000 |
commit | eca92b139f35c81ca7407ea1060ab657cf9cafee (patch) | |
tree | 0356609335ec41dad4c2433bf9e47f9084b42bdf | |
parent | 8cc7a64eaa12623fbf1f7947a7885aa0e3221ded (diff) |
2006-08-18 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* cairomm/win32_surface.cc:
* cairomm/win32_surface.h: add some missing win32 API that I had overlooked:
cairo_win32_surface_get_dc() and cairo_win32_surface_create_with_dib(),
updated documentation for standard Win32Surface::create() function.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | cairomm/win32_surface.cc | 12 | ||||
-rw-r--r-- | cairomm/win32_surface.h | 28 |
3 files changed, 44 insertions, 3 deletions
@@ -1,3 +1,10 @@ +2006-08-18 Jonathon Jongsma <jonathon.jongsma@gmail.com> + + * cairomm/win32_surface.cc: + * cairomm/win32_surface.h: add some missing win32 API that I had overlooked: + cairo_win32_surface_get_dc() and cairo_win32_surface_create_with_dib(), + updated documentation for standard Win32Surface::create() function. + 2006-08-18 Cedric Gustin <cedric.gustin@gmail.com> * cairomm/context.cc: Define M_PI for MSVC. diff --git a/cairomm/win32_surface.cc b/cairomm/win32_surface.cc index 7e5ed8e..cfed17d 100644 --- a/cairomm/win32_surface.cc +++ b/cairomm/win32_surface.cc @@ -33,6 +33,11 @@ Win32Surface::~Win32Surface() // surface is destroyed in base class } +HDC Win32Surface::get_dc() const +{ + return cairo_win32_surface_get_dc(m_cobject); +} + RefPtr<Win32Surface> Win32Surface::create(HDC hdc) { cairo_surface_t* cobject = cairo_win32_surface_create(hdc); @@ -40,6 +45,13 @@ RefPtr<Win32Surface> Win32Surface::create(HDC hdc) return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */)); } +RefPtr<Win32Surface> Win32Surface::create(Format format, int width, int height) +{ + cairo_surface_t* cobject = cairo_win32_surface_create_with_dib(format, width, height); + check_status_and_throw_exception(cairo_surface_status(cobject)); + return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */)); +} + #endif // CAIRO_HAS_WIN32_SURFACE } //namespace Cairo diff --git a/cairomm/win32_surface.h b/cairomm/win32_surface.h index 467270d..2c9e6a7 100644 --- a/cairomm/win32_surface.h +++ b/cairomm/win32_surface.h @@ -20,6 +20,7 @@ #define __CAIROMM_WIN32_SURFACE_H #include <cairomm/surface.h> +#include <cairomm/enums.h> #ifdef CAIRO_HAS_WIN32_SURFACE #include <cairo-win32.h> @@ -55,13 +56,34 @@ public: explicit Win32Surface(cairo_surface_t* cobject, bool has_reference = false); virtual ~Win32Surface(); - /** Creates a Surface for drawing in Microsoft Windows + /** Returns the HDC associated with this surface, or NULL if none. Also + * returns NULL if the surface is not a win32 surface. * - * @param hdc - * @return A RefPtr to the newly created surface + * @return HDC or NULL if no HDC available. + */ + HDC get_dc() const; + + /** Creates a cairo surface that targets the given DC. The DC will be queried + * for its initial clip extents, and this will be used as the size of the + * cairo surface. Also, if the DC is a raster DC, it will be queried for its + * pixel format and the cairo surface format will be set appropriately. + * + * @param hdc the DC to create a surface for + * @return the newly created surface */ static RefPtr<Win32Surface> create(HDC hdc); + /** Creates a device-independent-bitmap surface not associated with any + * particular existing surface or device context. The created bitmap will be + * unititialized. + * + * @param format format of pixels in the surface to create + * @param width width of the surface, in pixels + * @param height height of the surface, in pixels + * @return the newly created surface + */ + static RefPtr<Win32Surface> create(Format format, int width, int height); + }; #endif // CAIRO_HAS_WIN32_SURFACE |