예제 #1
0
 /**
  * SetLayerTransform() sets a transformation factor that will be applied for
  * the current graphics context displayed on the output device.  If both
  * SetScale and SetLayerTransform will be used, they are going to get combined
  * for the final result.
  *
  * This function has no effect until you call Flush().
  *
  * @param[in] scale The scale to be applied.
  * @param[in] origin The origin of the scale.
  * @param[in] translate The translation to be applied.
  *
  * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code>
  * if the resource is invalid or the scale factor is 0 or less.
  */
 public static PPBool SetLayerTransform(PPResource resource,
                                        float scale,
                                        PPPoint origin,
                                        PPPoint translate)
 {
     return(_SetLayerTransform(resource, scale, origin, translate));
 }
예제 #2
0
 /**
  * Sets the given mouse cursor. The mouse cursor will be in effect whenever
  * the mouse is over the given instance until it is set again by another
  * call. Note that you can hide the mouse cursor by setting it to the
  * <code>PP_MOUSECURSOR_TYPE_NONE</code> type.
  *
  * This function allows setting both system defined mouse cursors and
  * custom cursors. To set a system-defined cursor, pass the type you want
  * and set the custom image to 0 and the hot spot to NULL. To set a custom
  * cursor, set the type to <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and
  * specify your image and hot spot.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying the instance
  * that the mouse cursor will affect.
  *
  * @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type of
  * mouse cursor to show.
  *
  * @param[in] image A <code>PPB_ImageData</code> resource identifying the
  * custom image to set when the type is
  * <code>PP_MOUSECURSOR_TYPE_CUSTOM</code>. The image must be less than 32
  * pixels in each direction and must be of the system's native image format.
  * When you are specifying a predefined cursor, this parameter must be 0.
  *
  * @param[in] hot_spot When setting a custom cursor, this identifies the
  * pixel position within the given image of the "hot spot" of the cursor.
  * When specifying a stock cursor, this parameter is ignored.
  *
  * @return PP_TRUE on success, or PP_FALSE if the instance or cursor type
  * is invalid, or if the image is too large.
  */
 public static PPBool SetCursor(PPInstance instance,
                                PPMouseCursorType type,
                                PPResource image,
                                PPPoint hot_spot)
 {
     return(_SetCursor(instance, type, image, hot_spot));
 }
예제 #3
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);
 }
예제 #4
0
        public void Swap(ref PPPoint other)
        {
            int tempX = X;
            int tempY = Y;

            X       = other.X;
            Y       = other.Y;
            other.X = tempX;
            other.Y = tempY;
        }
예제 #5
0
        public override bool Equals(object obj)
        {
            if (!(obj is PPPoint))
            {
                return(false);
            }
            PPPoint comp = (PPPoint)obj;

            // Note value types can't have derived classes, so we don't need
            // to check the types of the objects here.
            return(comp.X == this.X && comp.Y == this.Y);
        }
예제 #6
0
 public PPRect(PPPoint origin, PPSize size)
     : this(origin.X, origin.Y, size.Width, size.Height)
 {
 }
예제 #7
0
 extern static PPBool _SetCursor(PPInstance instance,
                                 PPMouseCursorType type,
                                 PPResource image,
                                 PPPoint hot_spot);
예제 #8
0
 public PPFloatPoint(PPPoint other)
 {
     x = other.X;
     y = other.Y;
 }
예제 #9
0
 /// <summary>
 /// This function is used retrieve the address of the given pixel for 32-bit
 /// pixel formats.
 /// </summary>
 /// <param name="coord">A <code>PPPoint</code> representing the x and y
 /// coordinates for a specific pixel.
 /// </param>
 /// <returns>The IntPtr for the pixel.</returns>
 public IntPtr GetAddr32(PPPoint coord)
 {
     // If we add more image format types that aren't 32-bit, we'd want to check
     // here and fail.
     return(imageDataPtr + coord.Y * Stride + coord.X * 4);
 }
예제 #10
0
 /// <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);
 }
예제 #11
0
 extern static PPBool _SetLayerTransform(PPResource resource,
                                         float scale,
                                         PPPoint origin,
                                         PPPoint translate);
예제 #12
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);
 }
예제 #13
0
 extern static PPBool _GetScrollOffset(PPResource resource,
                                       out PPPoint offset);
예제 #14
0
 extern static void _PaintImageData(PPResource graphics_2d,
                                    PPResource image_data,
                                    PPPoint top_left,
                                    PPRect src_rect);
예제 #15
0
 /// <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. This version of
 /// PaintImageData paints the entire image. Refer to the other version of
 /// this function to paint only part of the area.
 ///
 /// 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.
 ///
 /// 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 module's image.
 /// </summary>
 /// <param name="image"></param>
 /// <param name="top_left"></param>
 public void PaintImageData(ImageData image,
                            PPPoint top_left)
 {
     PPBGraphics2D.PaintImageData(this, image, top_left, new PPRect(Size));
 }
예제 #16
0
 public bool SetLayerTransform(float scale,
                               PPPoint origin,
                               PPPoint translate)
 {
     return(PPBGraphics2D.SetLayerTransform(this, scale, origin, translate) == PPBool.True ? true : false);
 }
예제 #17
0
 /// <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);
 }
예제 #18
0
 /**
  * GetScrollOffset returns the scroll offset of the window containing the
  * plugin.
  *
  * @param[in] resource A <code>PP_Resource</code> corresponding to a
  * <code>PPB_View</code> resource.
  *
  * @param[out] offset A <code>PP_Point</code> which will be set to the value
  * of the scroll offset in CSS pixels.
  *
  * @return Returns <code>PP_TRUE</code> if the resource was valid and the
  * offset was filled in, <code>PP_FALSE</code> if not.
  */
 public static PPBool GetScrollOffset(PPResource resource,
                                      out PPPoint offset)
 {
     return(_GetScrollOffset(resource, out offset));
 }
예제 #19
0
 extern static void _Scroll(PPResource graphics_2d,
                            PPRect clip_rect,
                            PPPoint amount);