[cairo-commit] cairomm/cairomm win32_surface.h, 1.5, 1.6 win32_surface.cc, 1.4, 1.5

Jonathon Jongsma commit at pdx.freedesktop.org
Fri Aug 18 19:17:04 PDT 2006


Committed by: jjongsma

Update of /cvs/cairo/cairomm/cairomm
In directory kemper:/tmp/cvs-serv2230/cairomm

Modified Files:
	win32_surface.h win32_surface.cc 
Log Message:
2006-08-18  Jonathon Jongsma  <jonathon.jongsma at 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.


Index: win32_surface.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/win32_surface.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- win32_surface.h	5 Jul 2006 14:59:12 -0000	1.5
+++ win32_surface.h	19 Aug 2006 02:17:02 -0000	1.6
@@ -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 @@
   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

Index: win32_surface.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/win32_surface.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- win32_surface.cc	15 Mar 2006 01:00:59 -0000	1.4
+++ win32_surface.cc	19 Aug 2006 02:17:02 -0000	1.5
@@ -33,6 +33,11 @@
   // 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 @@
   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



More information about the cairo-commit mailing list