[cairo-commit] [cairo-www] src/samples

Carl Worth cworth at freedesktop.org
Fri May 28 06:43:43 PDT 2010


 src/samples/dotnet-gdi-rendering.mdwn |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 72ddb8b6beac96bff5e7b8589ac0dcea8bbb4b67
Author: MikeLischke <MikeLischke at web>
Date:   Fri May 28 06:43:43 2010 -0700

    Better text formatting

diff --git a/src/samples/dotnet-gdi-rendering.mdwn b/src/samples/dotnet-gdi-rendering.mdwn
index 5dd4ba7..02c7f8b 100644
--- a/src/samples/dotnet-gdi-rendering.mdwn
+++ b/src/samples/dotnet-gdi-rendering.mdwn
@@ -29,18 +29,19 @@ Using GDI+ Bitmap as surface can be as simple as that (given in managed C++):
 
 	g->ReleaseHdc(hdc);
 
-This works quite well but has one big disadvantage: cairo_win32_surface_create always returns a 24bit surface. So what if we have a bitmap with an alpha channel (like a png image we loaded and want to add something to it)? With the code above the alpha channel used in your cairo commands is lost.
+This works quite well but has one big disadvantage: cairo\_ win32\_surface_create always returns a 24bit surface. So what if we have a bitmap with an alpha channel (like a png image we loaded and want to add something to it)? With the code above the alpha channel used in your cairo commands is lost.
 
-One could create a 32bit DIB surface (using cairo_win32_surface_create_with_dib), but that creates a *separate* surface, which needs to be merged later to your actual target. Using an API like AlphaBlend (via pinvoke) produces exactly the same result as in the code above.
+One could create a 32bit DIB surface (using cairo\_win32\_surface\_create\_with\_dib), but that creates a **separate** surface, which needs to be merged later to your actual target. Using an API like AlphaBlend (via pinvoke) produces exactly the same result as in the code above. So this is no help either.
 
-The solution to this dilemma is an image surface (e.g. you get an image surface when you load png images in cairo).
+The solution for this dilemma is an image surface (e.g. you get an image surface when you load png images in cairo).
 
 	// Instead of getting an HDC and and use cairo_win32_surface we get directly
 	// to the pixels in the bitmap and create the image surface from that.
 	Imaging::BitmapData^ bitmapData= contentBitmap->LockBits(Drawing::Rectangle(0, 0, Width, Height),
 	  Imaging::ImageLockMode::ReadWrite, contentBitmap->PixelFormat);
 	unsigned char* data= (unsigned char*) bitmapData->Scan0.ToPointer();
-	cairo_surface_t* surface= cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, Width, Height, bitmapData->Stride);
+	cairo_surface_t* surface= cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, Width, Height,
+	  bitmapData->Stride);
 
 	// The rest is the same as above, except we have to unlock the bits after we finished drawing.
 	contentBitmap->UnlockBits(bitmapData);


More information about the cairo-commit mailing list