The OpenNET Project
 
Поиск (ключи):    ПРОГРАММЫ СТАТЬИ СОВЕТЫ ФОРУМ
  WIKI НОВОСТИ (+) MAN'ы ДОКУМЕНТАЦИЯ

Каталог документации / Раздел "Программирование, языки" / Оглавление документа

Use GdkEventExpose.region

Why.  The region field of GdkEventExpose allows you to redraw less than the traditional GdkEventRegion.area.

In GTK+ 1.x, the GdkEventExpose structure only had an area field to let you determine the region that you needed to redraw. In GTK+ 2.x, this field exists for compatibility and as a simple interface. However, there is also a region field which contains a fine-grained region. The area field is simply the bounding rectangle of the region.

Widgets that are very expensive to re-render, such as an image editor, may prefer to use the GdkEventExpose.region field to paint as little as possible. Widgets that just use a few drawing primitives, such as labels and buttons, may prefer to use the traditional GdkEventExpose.area field for simplicity.

Regions have an internal representation that is accessible as a list of rectangles. To turn the GdkEventExpose.region field into such a list, use gdk_region_get_rectangles():

static gboolean
my_widget_expose_event_handler (GtkWidget *widget, GdkEventExpose *event)
{
  GdkRectangle *rects;
  int n_rects;
  int i;

  gdk_region_get_rectangles (event->region, &rects, &n_rects);

  for (i = 0; i < n_rects; i++)
    {
      /* Repaint rectangle: (rects[i].x, rects[i].y), 
       *                    (rects[i].width, rects[i].height)
       */
    }

  g_free (rects);

  return FALSE;
}
    

ПОДПИШИСЬ НА ЖУРНАЛ Linux Format 2012!

Журнал "Linux Format" (Линукс Формат)- Единственный в России и странах СНГ журнал на русском языке, посвящённый Linux и свободному ПО. Журнал для IT-директоров, IT-менеджеров, программистов, системных администраторов, учителей школ и преподавателей ВУЗов и всех пользователей ПК. В каждом выпуске: Новости индустрии OpenSource, обзоры новинок свободного ПО, обучающие и методические статьи.

Каждый, кто оформит подписку, получает бонусы и подарки- объёмные наклейки на системный блок, диск с архивом номеров за 2005-2011 г.г. и ежемесячно электронную версию журнала в pdf-формате.

Оформить подписку на год


  Закладки на сайте
  Проследить за страницей
Created 1996-2012 by Maxim Chirkov  
ДобавитьРекламаВебмастеруГИД  
RUNNet TopList