X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fgraphics.c;h=a8a0318bd86ff19838c80a07a0849f284c851862;hb=f92585f76bce0b8d1efc11d2b2020a0f516234c5;hp=5735bcb34614cb68896a54c774b6f221b9dfb0cf;hpb=dfc0e872bf76faa4944a11d0905eca43143182e2;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/graphics.c b/libchimara/graphics.c index 5735bcb..a8a0318 100644 --- a/libchimara/graphics.c +++ b/libchimara/graphics.c @@ -22,6 +22,10 @@ load_image_in_cache(glui32 image, gint width, gint height) guchar *buffer; /* Lookup the proper resource */ + if(!glk_data->resource_map) { + WARNING("No resource map has been loaded yet."); + return NULL; + } blorb_error = giblorb_load_resource(glk_data->resource_map, giblorb_method_FilePos, &resource, giblorb_ID_Pict, image); if(blorb_error != giblorb_err_None) { WARNING_S( "Error loading resource", giblorb_get_error_message(blorb_error) ); @@ -216,7 +220,7 @@ glk_image_get_info(glui32 image, glui32 *width, glui32 *height) if(width != NULL) *width = found->width; - if(width != NULL) + if(height != NULL) *height = found->height; return TRUE; } @@ -415,7 +419,7 @@ draw_image_common(winid_t win, GdkPixbuf *pixbuf, glsi32 val1, glsi32 val2) * * This function may only be used with graphics windows. To set background * colors in a text window, use text styles with color hints; see Styles. + * linkend="chimara-Styles">Styles. * */ void @@ -481,8 +485,46 @@ glk_window_erase_rect(winid_t win, glsi32 left, glsi32 top, glui32 width, glui32 glk_window_fill_rect(win, win->background_color, left, top, width, height); } +/** + * glk_window_flow_break: + * @win: A window. + * + * You may wish to break the stream of text down below the + * current margin image. Since lines of text can be in any font and size, you + * cannot do this by counting newlines. Instead, use this function. + * + * If the current point in the text is indented around a margin-aligned image, + * this acts like the correct number of newlines to start a new line below the + * image. (If there are several margin-aligned images, it goes below all of + * them.) If the current point is not beside a margin-aligned image, this call + * has no effect. + * + * When a text buffer window is resized, a flow-break behaves cleverly; it may + * become active or inactive as necessary. You can consider this function to + * insert an invisible mark in the text stream. The mark works out how many + * newlines it needs to be whenever the text is formatted for display. + * + * An example of the use of glk_window_flow_break(): If you display a + * left-margin image at the start of every line, they can stack up in a strange + * diagonal way that eventually squeezes all the text off the screen. + * + * If you can't picture this, draw some diagrams. Make the margin images more + * than one line tall, so that each line starts already indented around the + * last image. + * + * To avoid this problem, call glk_window_flow_break() immediately before + * glk_image_draw() for every margin-aligned image. + * + * In all windows other than text buffers, glk_window_flow_break() has no + * effect. + * + * + * This function is not implemented yet. + * + */ void glk_window_flow_break(winid_t win) { + VALID_WINDOW(win, return); } /*** Called when the graphics window is resized. Resize the backing pixmap if necessary ***/