/**
* gdk_region_polygon:
* @points: an array of #GdkPoint structs
- * @npoints: the number of elements in the @points array
+ * @n_points: the number of elements in the @points array
* @fill_rule: specifies which pixels are included in the region when the
* polygon overlaps itself.
*
* Returns: a new #GdkRegion based on the given polygon
*/
GdkRegion *
-gdk_region_polygon (const GdkPoint *Pts,
- gint Count,
- GdkFillRule rule)
+gdk_region_polygon (const GdkPoint *points,
+ gint n_points,
+ GdkFillRule fill_rule)
{
GdkRegion *region;
EdgeTableEntry *pAET; /* Active Edge Table */
region = gdk_region_new ();
/* special case a rectangle */
- if (((Count == 4) ||
- ((Count == 5) && (Pts[4].x == Pts[0].x) && (Pts[4].y == Pts[0].y))) &&
- (((Pts[0].y == Pts[1].y) &&
- (Pts[1].x == Pts[2].x) &&
- (Pts[2].y == Pts[3].y) &&
- (Pts[3].x == Pts[0].x)) ||
- ((Pts[0].x == Pts[1].x) &&
- (Pts[1].y == Pts[2].y) &&
- (Pts[2].x == Pts[3].x) &&
- (Pts[3].y == Pts[0].y)))) {
- region->extents.x1 = MIN(Pts[0].x, Pts[2].x);
- region->extents.y1 = MIN(Pts[0].y, Pts[2].y);
- region->extents.x2 = MAX(Pts[0].x, Pts[2].x);
- region->extents.y2 = MAX(Pts[0].y, Pts[2].y);
+ if (((n_points == 4) ||
+ ((n_points == 5) && (points[4].x == points[0].x) && (points[4].y == points[0].y))) &&
+ (((points[0].y == points[1].y) &&
+ (points[1].x == points[2].x) &&
+ (points[2].y == points[3].y) &&
+ (points[3].x == points[0].x)) ||
+ ((points[0].x == points[1].x) &&
+ (points[1].y == points[2].y) &&
+ (points[2].x == points[3].x) &&
+ (points[3].y == points[0].y)))) {
+ region->extents.x1 = MIN(points[0].x, points[2].x);
+ region->extents.y1 = MIN(points[0].y, points[2].y);
+ region->extents.x2 = MAX(points[0].x, points[2].x);
+ region->extents.y2 = MAX(points[0].y, points[2].y);
if ((region->extents.x1 != region->extents.x2) &&
(region->extents.y1 != region->extents.y2)) {
region->numRects = 1;
return(region);
}
- pETEs = g_new (EdgeTableEntry, Count);
+ pETEs = g_new (EdgeTableEntry, n_points);
pts = FirstPtBlock.pts;
- CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock);
+ CreateETandAET(n_points, points, &ET, &AET, pETEs, &SLLBlock);
pSLL = ET.scanlines.next;
curPtBlock = &FirstPtBlock;
- if (rule == GDK_EVEN_ODD_RULE) {
+ if (fill_rule == GDK_EVEN_ODD_RULE) {
/*
* for each scanline
*/
* gdk_colormap_free_colors:
* @colormap: a #GdkColormap.
* @colors: the colors to free.
- * @ncolors: the number of colors in @colors.
+ * @n_colors: the number of colors in @colors.
*
* Frees previously allocated colors.
**/
void
gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
- gint ncolors)
+ gint n_colors)
{
GdkColormapPrivateX11 *private;
gulong *pixels;
(colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return;
- pixels = g_new (gulong, ncolors);
+ pixels = g_new (gulong, n_colors);
- for (i = 0; i < ncolors; i++)
+ for (i = 0; i < n_colors; i++)
{
gulong pixel = colors[i].pixel;
* @colormap: a #GdkColormap.
* @colors: The color values to allocate. On return, the pixel
* values for allocated colors will be filled in.
- * @ncolors: The number of colors in @colors.
+ * @n_colors: The number of colors in @colors.
* @writeable: If %TRUE, the colors are allocated writeable
* (their values can later be changed using gdk_color_change()).
* Writeable colors cannot be shared between applications.
gint
gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
- gint ncolors,
+ gint n_colors,
gboolean writeable,
gboolean best_match,
gboolean *success)
gint nremaining = 0;
XColor xcolor;
- g_return_val_if_fail (GDK_IS_COLORMAP (colormap), ncolors);
- g_return_val_if_fail (colors != NULL, ncolors);
- g_return_val_if_fail (success != NULL, ncolors);
+ g_return_val_if_fail (GDK_IS_COLORMAP (colormap), n_colors);
+ g_return_val_if_fail (colors != NULL, n_colors);
+ g_return_val_if_fail (success != NULL, n_colors);
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if (private->screen->closed)
- return ncolors;
+ return n_colors;
- for (i = 0; i < ncolors; i++)
+ for (i = 0; i < n_colors; i++)
success[i] = FALSE;
switch (colormap->visual->type)
case GDK_VISUAL_PSEUDO_COLOR:
case GDK_VISUAL_GRAYSCALE:
if (writeable)
- return gdk_colormap_alloc_colors_writeable (colormap, colors, ncolors,
+ return gdk_colormap_alloc_colors_writeable (colormap, colors, n_colors,
writeable, best_match, success);
else
- return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, ncolors,
+ return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, n_colors,
writeable, best_match, success);
break;
case GDK_VISUAL_TRUE_COLOR:
visual = colormap->visual;
- for (i = 0; i < ncolors; i++)
+ for (i = 0; i < n_colors; i++)
{
/* If bits not used for color are used for something other than padding,
* it's likely alpha, so we set them to 1s.
break;
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
- for (i = 0; i < ncolors; i++)
+ for (i = 0; i < n_colors; i++)
{
xcolor.red = colors[i].red;
xcolor.green = colors[i].green;