Logo Search packages:      
Sourcecode: ardour version File versions  Download package

region.h

// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GDKMM_REGION_H
#define _GDKMM_REGION_H

#include <glibmm.h>

/* $Id: region.h 4 2005-05-13 20:47:18Z taybin $ */

/* region.h
 *
 * Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

extern "C" { typedef struct _GdkRegion GdkRegion; }

#include <glibmm/arrayhandle.h>
#include <gdkmm/types.h>
#include <gdkmm/rectangle.h>


namespace Gdk
{


/** @addtogroup gdkmmEnums Enums and Flags */

/**
 * @ingroup gdkmmEnums
 */
enum FillRule
{
  EVEN_ODD_RULE,
  WINDING_RULE
};

} // namespace Gdk


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gdk::FillRule> : public Glib::Value_Enum<Gdk::FillRule>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gdk
{

/**
 * @ingroup gdkmmEnums
 */
enum OverlapType
{
  OVERLAP_RECTANGLE_IN,
  OVERLAP_RECTANGLE_OUT,
  OVERLAP_RECTANGLE_PART
};

} // namespace Gdk


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gdk::OverlapType> : public Glib::Value_Enum<Gdk::OverlapType>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gdk
{


/** This is an opaque data type holding a set of arbitrary pixels, and is usually used for clipping graphical operations
 * (see Gdk::GC::set_clip_region()).
 */
00107 class Region
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef Region CppObjectType;
  typedef GdkRegion BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  Region();

  // Use make_a_copy=true when getting it directly from a struct.
  explicit Region(GdkRegion* castitem, bool make_a_copy = false);

  Region(const Region& src);
  Region& operator=(const Region& src);

  ~Region();

  GdkRegion*       gobj()       { return gobject_; }
  const GdkRegion* gobj() const { return gobject_; }

  ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
  GdkRegion* gobj_copy() const;

protected:
  GdkRegion* gobject_;

private:

  
public:

  Region(const Glib::ArrayHandle<Gdk::Point>& points, FillRule fill_rule);
  explicit Region(const Rectangle& rectangle);

  
  void get_clipbox(const Rectangle& rectangle);
  Glib::ArrayHandle<Rectangle> get_rectangles() const;

  
  bool empty();
  
  bool point_in(int x, int y);
  
  OverlapType rect_in(const Rectangle& rect);

  
  void offset(int dx, int dy);
  
  void shrink(int dx, int dy);
  
  /** Sets the area of @a region  to the union of the areas of @a region  and
   *  @a rect . The resulting area is the set of pixels contained in
   * either @a region  or @a rect .
   * @param rect A Gdk::Rectangle.
   */
  void union_with_rect(const Rectangle& rect);
  
  /** Sets the area of @a source1  to the intersection of the areas of @a source1 
   * and @a source2 . The resulting area is the set of pixels contained in
   * both @a source1  and @a source2 .
   * @param source2 Another Gdk::Region.
   */
  void intersect(const Region& source2);
  
  /** Sets the area of @a source1  to the union of the areas of @a source1  and
   *  @a source2 . The resulting area is the set of pixels contained in
   * either @a source1  or @a source2 .
   * @param source2 A Gdk::Region.
   */
  void union_(const Region& source2); //union is a keyword.
  
  /** Subtracts the area of @a source2  from the area @a source1 . The resulting
   * area is the set of pixels contained in @a source1  but not in @a source2 .
   * @param source2 Another Gdk::Region.
   */
  void subtract(const Region& source2);
  
  /** Sets the area of @a source1  to the exclusive-OR of the areas of @a source1 
   * and @a source2 . The resulting area is the set of pixels contained in one
   * or the other of the two sources but not in both.
   * @param source2 Another Gdk::Region.
   */
  void xor_(const Region& source2); //xor is a keyword
  
  void spans_intersect_foreach(GdkSpan* spans, int n_spans, bool sorted, GdkSpanFunc function, gpointer data);
  

};

} //namespace Gdk


namespace Gdk
{

/** @relates Gdk::Region
 * @param lhs The left-hand side
 * @param rhs The right-hand side
 * @result The result
 */
bool operator==(const Region& lhs, const Region& rhs);

/** @relates Gdk::Region
 * @param lhs The left-hand side
 * @param rhs The right-hand side
 * @result The result
 */
bool operator!=(const Region& lhs, const Region& rhs);


} // namespace Gdk


namespace Glib
{

  /** @relates Gdk::Region
   * @param object The C instance
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   */
Gdk::Region wrap(GdkRegion* object, bool take_copy = false);

} // namespace Glib

#endif /* _GDKMM_REGION_H */


Generated by  Doxygen 1.6.0   Back to index