diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cairosimple.c | 10 | ||||
-rw-r--r-- | examples/cairotwisted.c | 8 | ||||
-rw-r--r-- | examples/pangowin32tobmp.c | 24 |
3 files changed, 21 insertions, 21 deletions
diff --git a/examples/cairosimple.c b/examples/cairosimple.c index fc9a77a1..102b9fb3 100644 --- a/examples/cairosimple.c +++ b/examples/cairosimple.c @@ -19,7 +19,7 @@ draw_text (cairo_t *cr) /* Create a PangoLayout, set the font and text */ layout = pango_cairo_create_layout (cr); - + pango_layout_set_text (layout, "Text", -1); desc = pango_font_description_from_string (FONT); pango_layout_set_font_description (layout, desc); @@ -39,10 +39,10 @@ draw_text (cairo_t *cr) cairo_set_source_rgb (cr, red, 0, 1.0 - red); cairo_rotate (cr, angle * G_PI / 180.); - + /* Inform Pango to re-layout the text with the new transformation */ pango_cairo_update_layout (cr, layout); - + pango_layout_get_size (layout, &width, &height); cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS); pango_cairo_show_layout (cr, layout); @@ -72,13 +72,13 @@ int main (int argc, char **argv) surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2 * RADIUS, 2 * RADIUS); cr = cairo_create (surface); - + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_paint (cr); draw_text (cr); cairo_destroy (cr); - + status = cairo_surface_write_to_png (surface, filename); cairo_surface_destroy (surface); diff --git a/examples/cairotwisted.c b/examples/cairotwisted.c index fa108242..586f44da 100644 --- a/examples/cairotwisted.c +++ b/examples/cairotwisted.c @@ -294,7 +294,7 @@ map_path_onto (cairo_t *cr, cairo_path_t *path) current_path = cairo_copy_path (cr); cairo_new_path (cr); - + transform_path (current_path, (transform_point_func_t) point_on_path, ¶m); @@ -325,7 +325,7 @@ draw_text (cairo_t *cr, cairo_font_options_destroy (font_options); layout = pango_cairo_create_layout (cr); - + desc = pango_font_description_from_string (font); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); @@ -361,7 +361,7 @@ draw_twisted (cairo_t *cr, /*path = cairo_copy_path (cr);*/ cairo_new_path (cr); - + draw_text (cr, x, y, font, text); map_path_onto (cr, path); @@ -442,7 +442,7 @@ int main (int argc, char **argv) draw_wow (cr); cairo_destroy (cr); - + status = cairo_surface_write_to_png (surface, filename); cairo_surface_destroy (surface); diff --git a/examples/pangowin32tobmp.c b/examples/pangowin32tobmp.c index 8586a01a..ac95410b 100644 --- a/examples/pangowin32tobmp.c +++ b/examples/pangowin32tobmp.c @@ -43,7 +43,7 @@ static HDC pre_render (int width, int height); static void post_render (HDC hdc, const char* sFile); -static float +static float calc_duration (GTimeVal *tv1, GTimeVal *tv0) { return ( ((float)tv1->tv_sec - tv0->tv_sec) @@ -118,7 +118,7 @@ int main (int argc, char **argv) family_name = g_strdup (pango_font_description_get_family (desc)); font = pango_font_map_load_font (fontmap, context, desc); - + coverage = pango_font_get_coverage (font, lang); /* ... */ @@ -188,7 +188,7 @@ int main (int argc, char **argv) g_get_current_time (&tv1); g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0)); - if (font) + if (font) { PangoItem *item; PangoGlyphString * glyphs; @@ -213,7 +213,7 @@ int main (int argc, char **argv) item->analysis.font = g_object_ref (font); pango_shape ( s, sizeof(s), &(item->analysis), glyphs); - if (hdc) + if (hdc) { /* the positioning isn't correct */ char* name = g_strdup_printf ("%s (%s%s)", @@ -228,7 +228,7 @@ int main (int argc, char **argv) g_get_current_time (&tv0); pango_win32_render (hdc, font, glyphs, 200, line); g_get_current_time (&tv1); - g_print ("\tpango_win32_render took %.3f sec\n", + g_print ("\tpango_win32_render took %.3f sec\n", calc_duration (&tv1, &tv0)); line += (3 * my_font_size / 2); g_free(name); @@ -238,7 +238,7 @@ int main (int argc, char **argv) pango_glyph_string_free (glyphs); pango_item_free (item); - pango_coverage_unref (coverage); + pango_coverage_unref (coverage); g_object_unref (font); } pango_font_description_free (desc); @@ -278,7 +278,7 @@ pre_render (int width, int height) WS_DISABLED, 0, 0, width, height, GetDesktopWindow(), - NULL, + NULL, GetModuleHandle(NULL), NULL); @@ -385,7 +385,7 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) DWORD cb; /* incremental count of bytes */ DWORD dwTmp; HDC hDC; - + pbih = (PBITMAPINFOHEADER) pbmi; lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage); if (!lpBits) @@ -406,7 +406,7 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL); - + if (hf == INVALID_HANDLE_VALUE) return FALSE; hdr.bfType = 0x4d42; /* 0x42 = "B" 0x4d = "M" */ @@ -433,13 +433,13 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) dwTotal = cb = pbih->biSizeImage; if (!WriteFile(hf, (LPSTR) lpBits, (int) cb, - (LPDWORD) &dwTotal, (LPOVERLAPPED) NULL)) + (LPDWORD) &dwTotal, (LPOVERLAPPED) NULL)) return FALSE; /* Close the .BMP file. */ if (!CloseHandle(hf)) return FALSE; - + /* Free memory. */ GlobalFree((HGLOBAL)lpBits); GlobalFree((HGLOBAL)pbmi); @@ -447,4 +447,4 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) DeleteDC(hDC); } // C sucks return TRUE; -} +} |