1 /* Copyright 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */
5 #ifndef PPAPI_SIMPLE_PS_CONTEXT_2D_H_
6 #define PPAPI_SIMPLE_PS_CONTEXT_2D_H_
8 #include "ppapi/c/pp_resource.h"
9 #include "ppapi/c/ppb_graphics_2d.h"
10 #include "ppapi/c/ppb_image_data.h"
12 #include "ppapi_simple/ps_event.h"
14 #include "sdk_util/macros.h"
24 PP_ImageDataFormat format
;
25 PP_Resource graphic_2d
;
33 * Allocate or free a 2D context object which the library can use to perform
34 * various PPAPI operations on the developer's behalf, such as processing view
35 * change events, swapping buffers, etc...
37 PSContext2D_t
* PSContext2DAllocate(PP_ImageDataFormat format
);
38 void PSContext2DFree(PSContext2D_t
* ctx
);
41 * PSContext2DGetNativeFormat
43 * Query the native system image format.
45 PP_ImageDataFormat
PSContext2DGetNativeImageDataFormat();
48 * PSContext2DHandleEvent
50 * Updates the context such as allocating, freeing, or sizing graphics and
51 * image resources in response to events.
53 int PSContext2DHandleEvent(PSContext2D_t
* ctx
, PSEvent
* event
);
56 * PSContext2DGetBuffer
58 * Points the data member of the context to the raw pixels of the image for
59 * writing to the screen. The image will become visible after a swap.
61 int PSContext2DGetBuffer(PSContext2D_t
* ctx
);
64 * PSContext2DSwapBuffer
66 * Swaps out the currently visible graphics with the data stored in the image
67 * buffer making it visible. The old image resource will no longer be
68 * available after this call.
70 int PSContext2DSwapBuffer(PSContext2D_t
* ctx
);
74 #endif /* PPAPI_SIMPLE_PS_CONTEXT_2D_H_ */