diff options
Diffstat (limited to 'ppapi/cpp/image_data.h')
-rw-r--r-- | ppapi/cpp/image_data.h | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/ppapi/cpp/image_data.h b/ppapi/cpp/image_data.h index 682174d..b472a85 100644 --- a/ppapi/cpp/image_data.h +++ b/ppapi/cpp/image_data.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,7 +21,8 @@ class Plugin; class ImageData : public Resource { public: - /// Default constructor for creating an is_null() ImageData object. + /// Default constructor for creating an is_null() <code>ImageData</code> + /// object. ImageData(); /// A special structure used by the constructor that does not increment the @@ -34,75 +35,60 @@ class ImageData : public Resource { /// @param[in] resource A PP_Resource corresponding to image data. ImageData(PassRef, PP_Resource resource); - /// A constructor accepting a reference to an ImageData to increment the - /// reference count of the underlying Image resource. This constructor - /// produces an ImageData object that shares the underlying Image resource - /// with <code>other</code>. + /// The copy constructor for <code>ImageData</code>. This constructor + /// produces an <code>ImageData</code> object that shares the underlying + /// <code>Image</code> resource with <code>other</code>. /// /// @param[in] other A pointer to an image data. ImageData(const ImageData& other); - /// A constructor that allocates a new ImageData in the browser with the - /// provided parameters. - /// The resulting object will be is_null() if the allocation failed. + /// A constructor that allocates a new <code>ImageData</code> in the browser + /// with the provided parameters. The resulting object will be is_null() if + /// the allocation failed. /// - /// @param[in] instance A PP_Instance indentifying one instance of a module. - /// @param[in] format The desired image format. + /// @param[in] instance A <code>PP_Instance</code> indentifying one instance + /// of a module. + /// + /// @param[in] format A PP_ImageDataFormat containing desired image format. /// PP_ImageDataFormat is an enumeration of the different types of - /// image data formats. - /// - /// The third part of each enumeration value describes the memory layout from - /// the lowest address to the highest. For example, BGRA means the B component - /// is stored in the lowest address, no matter what endianness the platform is - /// using. - /// - /// The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the - /// red, green and blue color components of the pixel data supplied to an - /// image data should be pre-multiplied by their alpha value. For example: - /// starting with floating point color components, here is how to convert - /// them to 8-bit premultiplied components for image data: - /// ...components of a pixel, floats ranging from 0 to 1... - /// float red = 1.0f; - /// float green = 0.50f; - /// float blue = 0.0f; - /// float alpha = 0.75f; - /// ...components for image data are 8-bit values ranging from 0 to 255... - /// uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); - /// uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); - /// uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); - /// uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f); - /// Note the resulting pre-multiplied red, green and blue components should - /// not be greater than the alpha value. - /// @param[in] size A pointer to a PP_Size containing the image size. - /// @param[in] init_to_zero A PP_Bool to determine transparency at creation. - /// Set the init_to_zero flag if you want the bitmap initialized to - /// transparent during the creation process. If this flag is not set, the - /// current contents of the bitmap will be undefined, and the plugin should - /// be sure to set all the pixels. + /// image data formats. Refer to the + /// <a href="/chrome/nativeclient/docs/reference/pepperc/ + /// ppb__image__data_8h.html"><code>ppb_image_data.h</code></a> for further + /// information. + /// + /// @param[in] size A pointer to a <code>Size</code> containing the image + /// size. + /// + /// @param[in] init_to_zero A bool used to determine transparency at + /// creation. Set the <code>init_to_zero</code> flag if you want the bitmap + /// initialized to transparent during the creation process. If this flag is + /// not set, the current contents of the bitmap will be undefined, and the + /// module should be sure to set all the pixels. ImageData(Instance* instance, PP_ImageDataFormat format, const Size& size, bool init_to_zero); - /// This function decrements the reference count of this ImageData and - /// increments the reference count of the <code>other</code> ImageData. - /// This ImageData shares the underlying image resource with - /// <code>other</code>. + /// This function decrements the reference count of this + /// <code>ImageData</code> and increments the reference count of the + /// <code>other</code> <code>ImageData</code>. This <code>ImageData</code> + /// shares the underlying image resource with <code>other</code>. /// /// @param[in] other An other image data. + /// /// @return A new image data context. ImageData& operator=(const ImageData& other); - /// This function determines the browser's preferred format for images. - /// Using this format guarantees no extra conversions will occur when + /// GetNativeImageDataFormat() determines the browser's preferred format for + /// images. Using this format guarantees no extra conversions will occur when /// painting. /// - /// @return PP_ImageDataFormat containing the preferred format. + /// @return <code>PP_ImageDataFormat</code> containing the preferred format. static PP_ImageDataFormat GetNativeImageDataFormat(); /// A getter function for returning the current format for images. /// - /// @return PP_ImageDataFormat containing the preferred format. + /// @return <code>PP_ImageDataFormat</code> containing the preferred format. PP_ImageDataFormat format() const { return desc_.format; } /// A getter function for returning the image size. @@ -123,16 +109,18 @@ class ImageData : public Resource { /// This function is used retrieve the address of the given pixel for 32-bit /// pixel formats. /// - /// @param[in] coord A Point representing the x and y coordinates for a - /// specific pixel. + /// @param[in] coord A <code>Point</code> representing the x and y + /// coordinates for a specific pixel. + /// /// @return The address for the pixel. const uint32_t* GetAddr32(const Point& coord) const; /// This function is used retrieve the address of the given pixel for 32-bit /// pixel formats. /// - /// @param[in] coord A Point representing the x and y coordinates for a - /// specific pixel. + /// @param[in] coord A <code>Point</code> representing the x and y + /// coordinates for a specific pixel. + /// /// @return The address for the pixel. uint32_t* GetAddr32(const Point& coord); |