コード例 #1
0
 /**
  * PaintImageData() enqueues a paint of the given image into the context.
  * This function has no effect until you call Flush() As a result, what
  * counts is the contents of the bitmap when you call Flush(), not when
  * you call this function.
  *
  * The provided image will be placed at <code>top_left</code> from the top
  *  left of the context's internal backing store. Then the pixels contained
  * in <code>src_rect</code> will be copied into the backing store. This
  * means that the rectangle being painted will be at <code>src_rect</code>
  * offset by <code>top_left</code>.
  *
  * The <code>src_rect</code> is specified in the coordinate system of the
  * image being painted, not the context. For the common case of copying the
  * entire image, you may specify an empty <code>src_rect</code>.
  *
  * The painted area of the source bitmap must fall entirely within the
  * context. Attempting to paint outside of the context will result in an
  * error. However, the source bitmap may fall outside the context, as long
  * as the <code>src_rect</code> subset of it falls entirely within the
  * context.
  *
  * There are two methods most modules will use for painting. The first
  * method is to generate a new <code>ImageData</code> and then paint it. In
  * this case, you'll set the location of your painting to
  * <code>top_left</code> and set <code>src_rect</code> to <code>NULL</code>.
  * The second is that you're generating small invalid regions out of a larger
  * bitmap representing your entire instance. In this case, you would set the
  * location of your image to (0,0) and then set <code>src_rect</code> to the
  * pixels you changed.
  *
  * @param[in] resource The 2D Graphics resource.
  * @param[in] image The <code>ImageData</code> to be painted.
  * @param[in] top_left A <code>Point</code> representing the
  * <code>top_left</code> location where the <code>ImageData</code> will be
  * painted.
  * @param[in] src_rect The rectangular area where the <code>ImageData</code>
  * will be painted.
  */
 public static void PaintImageData(PPResource graphics_2d,
                                   PPResource image_data,
                                   PPPoint top_left,
                                   PPRect src_rect)
 {
     _PaintImageData(graphics_2d, image_data, top_left, src_rect);
 }
コード例 #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is PPRect))
            {
                return(false);
            }

            PPRect comp = (PPRect)obj;

            return((comp.X == this.X) &&
                   (comp.Y == this.Y) &&
                   (comp.Width == this.Width) &&
                   (comp.Height == this.Height));
        }
コード例 #3
0
 /**
  * GetRect() retrieves the rectangle of the module instance associated
  * with a view changed notification relative to the upper-left of the browser
  * viewport. This position changes when the page is scrolled.
  *
  * The returned rectangle may not be inside the visible portion of the
  * viewport if the module instance is scrolled off the page. Therefore, the
  * position may be negative or larger than the size of the page. The size will
  * always reflect the size of the module were it to be scrolled entirely into
  * view.
  *
  * In general, most modules will not need to worry about the position of the
  * module instance in the viewport, and only need to use the size.
  *
  * @param resource A <code>PP_Resource</code> corresponding to a
  * <code>PPB_View</code> resource.
  *
  * @param rect A <code>PP_Rect</code> receiving the rectangle on success.
  *
  * @return Returns <code>PP_TRUE</code> if the resource was valid and the
  * viewport rectangle was filled in, <code>PP_FALSE</code> if not.
  */
 public static PPBool GetRect(PPResource resource, out PPRect rect)
 {
     return(_GetRect(resource, out rect));
 }
コード例 #4
0
 extern static PPBool _GetRect(PPResource resource, out PPRect rect);
コード例 #5
0
 /**
  * GetClipRect() returns the clip rectangle relative to the upper-left corner
  * of the module instance. This rectangle indicates the portions of the module
  * instance that are scrolled into view.
  *
  * If the module instance is scrolled off the view, the return value will be
  * (0, 0, 0, 0). This clip rectangle does <i>not</i> take into account page
  * visibility. Therefore, if the module instance is scrolled into view, but
  * the page itself is on a tab that is not visible, the return rectangle will
  * contain the visible rectangle as though the page were visible. Refer to
  * IsPageVisible() and IsVisible() if you want to account for page
  * visibility.
  *
  * Most applications will not need to worry about the clip rectangle. The
  * recommended behavior is to do full updates if the module instance is
  * visible, as determined by IsVisible(), and do no updates if it is not
  * visible.
  *
  * However, if the cost for computing pixels is very high for your
  * application, or the pages you're targeting frequently have very large
  * module instances with small visible portions, you may wish to optimize
  * further. In this case, the clip rectangle will tell you which parts of
  * the module to update.
  *
  * Note that painting of the page and sending of view changed updates
  * happens asynchronously. This means when the user scrolls, for example,
  * it is likely that the previous backing store of the module instance will
  * be used for the first paint, and will be updated later when your
  * application generates new content with the new clip. This may cause
  * flickering at the boundaries when scrolling. If you do choose to do
  * partial updates, you may want to think about what color the invisible
  * portions of your backing store contain (be it transparent or some
  * background color) or to paint a certain region outside the clip to reduce
  * the visual distraction when this happens.
  *
  * @param resource A <code>PP_Resource</code> corresponding to a
  * <code>PPB_View</code> resource.
  *
  * @param clip Output argument receiving the clip rect on success.
  *
  * @return Returns <code>PP_TRUE</code> if the resource was valid and the
  * clip rect was filled in, <code>PP_FALSE</code> if not.
  */
 public static PPBool GetClipRect(PPResource resource, out PPRect clip)
 {
     return(_GetClipRect(resource, out clip));
 }
コード例 #6
0
 extern static PPBool _GetClipRect(PPResource resource, out PPRect clip);
コード例 #7
0
 /**
  * Scroll() enqueues a scroll of the context's backing store. This
  * function has no effect until you call Flush(). The data within the
  * provided clipping rectangle will be shifted by (dx, dy) pixels.
  *
  * This function will result in some exposed region which will have undefined
  * contents. The module should call PaintImageData() on these exposed regions
  * to give the correct contents.
  *
  * The scroll can be larger than the area of the clipping rectangle, which
  * means the current image will be scrolled out of the rectangle. This
  * scenario is not an error but will result in a no-op.
  *
  * @param[in] graphics_2d The 2D Graphics resource.
  * @param[in] clip The clipping rectangle.
  * @param[in] amount The amount the area in the clipping rectangle will
  * shifted.
  */
 public static void Scroll(PPResource graphics_2d,
                           PPRect clip_rect,
                           PPPoint amount)
 {
     _Scroll(graphics_2d, clip_rect, amount);
 }
コード例 #8
0
 extern static void _Scroll(PPResource graphics_2d,
                            PPRect clip_rect,
                            PPPoint amount);
コード例 #9
0
 extern static void _PaintImageData(PPResource graphics_2d,
                                    PPResource image_data,
                                    PPPoint top_left,
                                    PPRect src_rect);
コード例 #10
0
ファイル: Graphics2D.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// Scroll() enqueues a scroll of the context's backing store. This
 /// function has no effect until you call Flush(). The data within the
 /// provided clipping rectangle will be shifted by (dx, dy) pixels.
 ///
 /// This function will result in some exposed region which will have
 /// undefined contents. The module should call PaintImageData() on
 /// these exposed regions to give the correct contents.
 ///
 /// The scroll can be larger than the area of the clipping rectangle, which
 /// means the current image will be scrolled out of the rectangle. This
 /// scenario is not an error but will result in a no-op.
 /// </summary>
 /// <param name="clip">The clipping rectangle.</param>
 /// <param name="amount">The amount the area in the clipping rectangle will be shifted.</param>
 public void Scroll(PPRect clip, PPPoint amount)
 {
     PPBGraphics2D.Scroll(this, clip, amount);
 }
コード例 #11
0
ファイル: Graphics2D.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// PaintImageData() enqueues a paint command of the given image into
 /// the context. This command has no effect until you call Flush(). As a
 /// result, what counts is the contents of the bitmap when you call Flush(),
 /// not when you call this function.
 ///
 /// The provided image will be placed at <code>top_left</code> from the top
 /// left of the context's internal backing store. Then the pixels contained
 /// in <code>src_rect</code> will be copied into the backing store. This
 /// means that the rectangle being painted will be at <code>src_rect</code>
 /// offset by <code>top_left</code>.
 ///
 /// The <code>src_rect</code> is specified in the coordinate system of the
 /// image being painted, not the context. For the common case of copying the
 /// entire image, you may specify an empty <code>src_rect</code>.
 ///
 /// The painted area of the source bitmap must fall entirely within the
 /// context. Attempting to paint outside of the context will result in an
 /// error. However, the source bitmap may fall outside the context, as long
 /// as the <code>src_rect</code> subset of it falls entirely within the
 /// context.
 ///
 /// There are two methods most modules will use for painting. The first
 /// method is to generate a new <code>ImageData</code> and then paint it. In
 /// this case, you'll set the location of your painting to
 /// <code>topLeft</code> and set <code>srcRect</code> to <code>NULL</code>.
 /// The second is that you're generating small invalid regions out of a larger
 /// bitmap representing your entire module. In this case, you would set the
 /// location of your image to (0,0) and then set <code>srcRect</code> to the
 /// pixels you changed.
 /// </summary>
 /// <param name="image">The <code>ImageData</code> to be painted.</param>
 /// <param name="topLeft">A <code>Point</code> representing the
 /// <code>topLeft</code> location where the <code>ImageData</code> will be
 /// painted.
 /// </param>
 /// <param name="srcRect">The rectangular area where the <code>ImageData</code>
 /// will be painted.</param>
 public void PaintImageData(ImageData image,
                            PPPoint topLeft, PPRect srcRect)
 {
     PPBGraphics2D.PaintImageData(this, image, topLeft, srcRect);
 }