102f4aeb0Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?>
202f4aeb0Sopenharmony_ci<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
302f4aeb0Sopenharmony_ci                            "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
402f4aeb0Sopenharmony_ci<refentry xml:base="" id="eglCreateWindowSurface">
502f4aeb0Sopenharmony_ci    <refentryinfo>
602f4aeb0Sopenharmony_ci         <copyright>
702f4aeb0Sopenharmony_ci             <year>2003-2014</year>
802f4aeb0Sopenharmony_ci             <holder>The Khronos Group Inc.</holder>
902f4aeb0Sopenharmony_ci         </copyright>
1002f4aeb0Sopenharmony_ci    </refentryinfo>
1102f4aeb0Sopenharmony_ci    <refmeta>
1202f4aeb0Sopenharmony_ci        <refentrytitle>eglCreateWindowSurface</refentrytitle>
1302f4aeb0Sopenharmony_ci        <manvolnum>3G</manvolnum>
1402f4aeb0Sopenharmony_ci    </refmeta>
1502f4aeb0Sopenharmony_ci    <refnamediv>
1602f4aeb0Sopenharmony_ci        <refname>eglCreateWindowSurface</refname>
1702f4aeb0Sopenharmony_ci        <refpurpose>
1802f4aeb0Sopenharmony_ci            create a new <acronym>EGL</acronym> window surface
1902f4aeb0Sopenharmony_ci        </refpurpose>
2002f4aeb0Sopenharmony_ci    </refnamediv>
2102f4aeb0Sopenharmony_ci    <refsynopsisdiv>
2202f4aeb0Sopenharmony_ci        <title>C Specification</title>
2302f4aeb0Sopenharmony_ci        <funcsynopsis>
2402f4aeb0Sopenharmony_ci            <funcprototype>
2502f4aeb0Sopenharmony_ci                <funcdef>EGLSurface <function>eglCreateWindowSurface</function></funcdef>
2602f4aeb0Sopenharmony_ci                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
2702f4aeb0Sopenharmony_ci                <paramdef>EGLConfig <parameter>config</parameter></paramdef>
2802f4aeb0Sopenharmony_ci                <paramdef>NativeWindowType <parameter>native_window</parameter></paramdef>
2902f4aeb0Sopenharmony_ci                <paramdef>EGLint const * <parameter>attrib_list</parameter></paramdef>
3002f4aeb0Sopenharmony_ci            </funcprototype>
3102f4aeb0Sopenharmony_ci        </funcsynopsis>
3202f4aeb0Sopenharmony_ci    </refsynopsisdiv>
3302f4aeb0Sopenharmony_ci    <refsect1 id="parameters"><title>Parameters</title>
3402f4aeb0Sopenharmony_ci        <variablelist>
3502f4aeb0Sopenharmony_ci            <varlistentry>
3602f4aeb0Sopenharmony_ci                <term><parameter>display</parameter></term>
3702f4aeb0Sopenharmony_ci                <listitem><para>Specifies the EGL display connection.</para></listitem>
3802f4aeb0Sopenharmony_ci            </varlistentry>
3902f4aeb0Sopenharmony_ci            <varlistentry>
4002f4aeb0Sopenharmony_ci                <term><parameter>config</parameter></term>
4102f4aeb0Sopenharmony_ci                <listitem>
4202f4aeb0Sopenharmony_ci                    <para>Specifies the EGL frame buffer configuration that defines the
4302f4aeb0Sopenharmony_ci                    frame buffer resource available to the surface.</para>
4402f4aeb0Sopenharmony_ci                </listitem>
4502f4aeb0Sopenharmony_ci            </varlistentry>
4602f4aeb0Sopenharmony_ci            <varlistentry>
4702f4aeb0Sopenharmony_ci                <term><parameter>native_window</parameter></term>
4802f4aeb0Sopenharmony_ci                <listitem><para>Specifies the native window.</para></listitem>
4902f4aeb0Sopenharmony_ci            </varlistentry>
5002f4aeb0Sopenharmony_ci            <varlistentry>
5102f4aeb0Sopenharmony_ci                <term><parameter>attrib_list</parameter></term>
5202f4aeb0Sopenharmony_ci                <listitem><para>
5302f4aeb0Sopenharmony_ci                    Specifies window surface attributes.
5402f4aeb0Sopenharmony_ci                    May be <constant>NULL</constant> or empty
5502f4aeb0Sopenharmony_ci                    (first attribute is <constant>EGL_NONE</constant>).
5602f4aeb0Sopenharmony_ci                </para></listitem>
5702f4aeb0Sopenharmony_ci            </varlistentry>
5802f4aeb0Sopenharmony_ci        </variablelist>
5902f4aeb0Sopenharmony_ci    </refsect1>
6002f4aeb0Sopenharmony_ci    <refsect1 id="description"><title>Description</title>
6102f4aeb0Sopenharmony_ci        <para>
6202f4aeb0Sopenharmony_ci            <function>eglCreateWindowSurface</function> creates an EGL
6302f4aeb0Sopenharmony_ci            window surface and returns its handle. If
6402f4aeb0Sopenharmony_ci            <function>eglCreateWindowSurface</function> fails to create
6502f4aeb0Sopenharmony_ci            a window surface, <constant>EGL_NO_SURFACE</constant> is
6602f4aeb0Sopenharmony_ci            returned.
6702f4aeb0Sopenharmony_ci        </para>
6802f4aeb0Sopenharmony_ci        <para>
6902f4aeb0Sopenharmony_ci            Surface attributes are specified as a list of
7002f4aeb0Sopenharmony_ci            attribute-value pairs, terminated with
7102f4aeb0Sopenharmony_ci            <constant>EGL_NONE</constant>. Accepted attributes
7202f4aeb0Sopenharmony_ci            are:
7302f4aeb0Sopenharmony_ci        </para>
7402f4aeb0Sopenharmony_ci        <variablelist>
7502f4aeb0Sopenharmony_ci            <varlistentry>
7602f4aeb0Sopenharmony_ci                <term><constant>EGL_RENDER_BUFFER</constant></term>
7702f4aeb0Sopenharmony_ci                <listitem>
7802f4aeb0Sopenharmony_ci                <para>
7902f4aeb0Sopenharmony_ci                    Specifies which buffer should be used for client API
8002f4aeb0Sopenharmony_ci                    rendering to the window. If its value is
8102f4aeb0Sopenharmony_ci                    <constant>EGL_SINGLE_BUFFER</constant>, then client
8202f4aeb0Sopenharmony_ci                    APIs should render directly into the visible window.
8302f4aeb0Sopenharmony_ci                    If its value is
8402f4aeb0Sopenharmony_ci                    <constant>EGL_BACK_BUFFER</constant>, then client
8502f4aeb0Sopenharmony_ci                    APIs should render into the back buffer. The default
8602f4aeb0Sopenharmony_ci                    value of <constant>EGL_RENDER_BUFFER</constant> is
8702f4aeb0Sopenharmony_ci                    <constant>EGL_BACK_BUFFER</constant>.
8802f4aeb0Sopenharmony_ci                </para>
8902f4aeb0Sopenharmony_ci                <para>
9002f4aeb0Sopenharmony_ci                    Client APIs may not be able to respect the requested
9102f4aeb0Sopenharmony_ci                    rendering buffer. To determine the actual buffer
9202f4aeb0Sopenharmony_ci                    being rendered to by a context, call
9302f4aeb0Sopenharmony_ci                    <citerefentry><refentrytitle>eglQueryContext</refentrytitle></citerefentry>.
9402f4aeb0Sopenharmony_ci                </para>
9502f4aeb0Sopenharmony_ci                </listitem>
9602f4aeb0Sopenharmony_ci            </varlistentry>
9702f4aeb0Sopenharmony_ci            <varlistentry>
9802f4aeb0Sopenharmony_ci                <term><constant>EGL_VG_ALPHA_FORMAT</constant></term>
9902f4aeb0Sopenharmony_ci                <listitem>
10002f4aeb0Sopenharmony_ci                <para>
10102f4aeb0Sopenharmony_ci                    Specifies how alpha values are interpreted by OpenVG
10202f4aeb0Sopenharmony_ci                    when rendering to the surface. If its value is
10302f4aeb0Sopenharmony_ci                    <constant>EGL_VG_ALPHA_FORMAT_NONPRE</constant>,
10402f4aeb0Sopenharmony_ci                    then alpha values are not premultipled. If its value
10502f4aeb0Sopenharmony_ci                    is <constant>EGL_VG_ALPHA_FORMAT_PRE</constant>,
10602f4aeb0Sopenharmony_ci                    then alpha values are premultiplied. The default
10702f4aeb0Sopenharmony_ci                    value of <constant>EGL_VG_ALPHA_FORMAT</constant> is
10802f4aeb0Sopenharmony_ci                    <constant>EGL_VG_ALPHA_FORMAT_NONPRE</constant>.
10902f4aeb0Sopenharmony_ci                </para>
11002f4aeb0Sopenharmony_ci                </listitem>
11102f4aeb0Sopenharmony_ci            </varlistentry>
11202f4aeb0Sopenharmony_ci            <varlistentry>
11302f4aeb0Sopenharmony_ci                <term><constant>EGL_VG_COLORSPACE</constant></term>
11402f4aeb0Sopenharmony_ci                <listitem>
11502f4aeb0Sopenharmony_ci                <para>
11602f4aeb0Sopenharmony_ci                    Specifies the color space used by OpenVG when
11702f4aeb0Sopenharmony_ci                    rendering to the surface. If its value is
11802f4aeb0Sopenharmony_ci                    <constant>EGL_VG_COLORSPACE_sRGB</constant>, then a
11902f4aeb0Sopenharmony_ci                    non-linear, perceptually uniform color space is
12002f4aeb0Sopenharmony_ci                    assumed, with a corresponding
12102f4aeb0Sopenharmony_ci                    <type>VGImageFormat</type> of form
12202f4aeb0Sopenharmony_ci                    <constant>VG_s*</constant>. If its value is
12302f4aeb0Sopenharmony_ci                    <constant>EGL_VG_COLORSPACE_LINEAR</constant>, then
12402f4aeb0Sopenharmony_ci                    a linear color space is assumed, with a
12502f4aeb0Sopenharmony_ci                    corresponding <type>VGImageFormat</type> of form
12602f4aeb0Sopenharmony_ci                    <constant>VG_l*</constant>. The default value of
12702f4aeb0Sopenharmony_ci                    <constant>EGL_VG_COLORSPACE</constant> is
12802f4aeb0Sopenharmony_ci                    <constant>EGL_VG_COLORSPACE_sRGB</constant>.
12902f4aeb0Sopenharmony_ci                </para>
13002f4aeb0Sopenharmony_ci                </listitem>
13102f4aeb0Sopenharmony_ci            </varlistentry>
13202f4aeb0Sopenharmony_ci        </variablelist>
13302f4aeb0Sopenharmony_ci        <para>
13402f4aeb0Sopenharmony_ci            Any EGL rendering context that was created with respect to
13502f4aeb0Sopenharmony_ci            <parameter>config</parameter> can be used to render into the
13602f4aeb0Sopenharmony_ci            surface. Use
13702f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>
13802f4aeb0Sopenharmony_ci            to attach an EGL rendering context to the surface.
13902f4aeb0Sopenharmony_ci        </para>
14002f4aeb0Sopenharmony_ci        <para>
14102f4aeb0Sopenharmony_ci            Use
14202f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
14302f4aeb0Sopenharmony_ci            to retrieve the ID of <parameter>config</parameter>.
14402f4aeb0Sopenharmony_ci        </para>
14502f4aeb0Sopenharmony_ci        <para>
14602f4aeb0Sopenharmony_ci            Use
14702f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>
14802f4aeb0Sopenharmony_ci            to destroy the surface.
14902f4aeb0Sopenharmony_ci        </para>
15002f4aeb0Sopenharmony_ci    </refsect1>
15102f4aeb0Sopenharmony_ci    <refsect1 id="notes"><title>Notes</title>
15202f4aeb0Sopenharmony_ci        <para>
15302f4aeb0Sopenharmony_ci            Attributes <constant>EGL_RENDER_BUFFER</constant>,
15402f4aeb0Sopenharmony_ci            <constant>EGL_VG_ALPHA_FORMAT</constant>, and
15502f4aeb0Sopenharmony_ci            <constant>EGL_VG_COLORSPACE</constant>, and the
15602f4aeb0Sopenharmony_ci            corresponding attribute values, are supported only if the
15702f4aeb0Sopenharmony_ci            EGL version is 1.2 or greater.
15802f4aeb0Sopenharmony_ci        </para>
15902f4aeb0Sopenharmony_ci        <!-- Might want to mention aliasing of EGL_VG_* -> EGL_* that occurred in EGL 1.3 -->
16002f4aeb0Sopenharmony_ci        <para>
16102f4aeb0Sopenharmony_ci            The <constant>EGL_VG_ALPHA_FORMAT</constant> and
16202f4aeb0Sopenharmony_ci            <constant>EGL_VG_COLORSPACE</constant> attributes are used
16302f4aeb0Sopenharmony_ci            only by OpenVG. EGL itself, and other client APIs such as
16402f4aeb0Sopenharmony_ci            OpenGL and OpenGL ES , do not distinguish multiple
16502f4aeb0Sopenharmony_ci            colorspace models. Refer to section 11.2 of the OpenVG 1.0
16602f4aeb0Sopenharmony_ci            specification for more information. The native window
16702f4aeb0Sopenharmony_ci            system's use and interpretation of alpha values is outside
16802f4aeb0Sopenharmony_ci            the scope of EGL, although the preferred behavior is for the
16902f4aeb0Sopenharmony_ci            window system to ignore the value of
17002f4aeb0Sopenharmony_ci            <constant>EGL_VG_ALPHA_FORMAT</constant> when compositing
17102f4aeb0Sopenharmony_ci            window surfaces.
17202f4aeb0Sopenharmony_ci        </para>
17302f4aeb0Sopenharmony_ci    </refsect1>
17402f4aeb0Sopenharmony_ci    <refsect1 id="errors"><title>Errors</title>
17502f4aeb0Sopenharmony_ci        <para>
17602f4aeb0Sopenharmony_ci            <constant>EGL_NO_SURFACE</constant> is returned if creation of
17702f4aeb0Sopenharmony_ci            the context fails.
17802f4aeb0Sopenharmony_ci        </para>
17902f4aeb0Sopenharmony_ci        <para>
18002f4aeb0Sopenharmony_ci            <constant>EGL_BAD_DISPLAY</constant> is generated if
18102f4aeb0Sopenharmony_ci            <parameter>display</parameter> is not an EGL display connection.
18202f4aeb0Sopenharmony_ci        </para>
18302f4aeb0Sopenharmony_ci        <para>
18402f4aeb0Sopenharmony_ci            <constant>EGL_NOT_INITIALIZED</constant> is generated if
18502f4aeb0Sopenharmony_ci            <parameter>display</parameter> has not been initialized.
18602f4aeb0Sopenharmony_ci        </para>
18702f4aeb0Sopenharmony_ci        <para>
18802f4aeb0Sopenharmony_ci            <constant>EGL_BAD_CONFIG</constant> is generated if
18902f4aeb0Sopenharmony_ci            <parameter>config</parameter> is not an EGL frame buffer configuration.
19002f4aeb0Sopenharmony_ci        </para>
19102f4aeb0Sopenharmony_ci        <para>
19202f4aeb0Sopenharmony_ci            <constant>EGL_BAD_NATIVE_WINDOW</constant> may be generated if
19302f4aeb0Sopenharmony_ci            <parameter>native_window</parameter> is not a valid native window.
19402f4aeb0Sopenharmony_ci        </para>
19502f4aeb0Sopenharmony_ci        <para>
19602f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ATTRIBUTE</constant> is generated if
19702f4aeb0Sopenharmony_ci            <parameter>attrib_list</parameter> contains an invalid window attribute
19802f4aeb0Sopenharmony_ci            or if an attribute value is not recognized or is out of range.
19902f4aeb0Sopenharmony_ci        </para>
20002f4aeb0Sopenharmony_ci        <para>
20102f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ALLOC</constant> is generated if there are not
20202f4aeb0Sopenharmony_ci            enough resources to allocate the new surface.
20302f4aeb0Sopenharmony_ci        </para>
20402f4aeb0Sopenharmony_ci        <para>
20502f4aeb0Sopenharmony_ci            <constant>EGL_BAD_MATCH</constant> is generated if the attributes of
20602f4aeb0Sopenharmony_ci            <parameter>native_window</parameter> do not correspond to
20702f4aeb0Sopenharmony_ci            <parameter>config</parameter> or if
20802f4aeb0Sopenharmony_ci            <parameter>config</parameter> does not support rendering to windows
20902f4aeb0Sopenharmony_ci            (the <constant>EGL_SURFACE_TYPE</constant> attribute does not contain
21002f4aeb0Sopenharmony_ci            <constant>EGL_WINDOW_BIT</constant>).
21102f4aeb0Sopenharmony_ci        </para>
21202f4aeb0Sopenharmony_ci        <para>
21302f4aeb0Sopenharmony_ci            <constant>EGL_BAD_MATCH</constant> is generated if
21402f4aeb0Sopenharmony_ci            <parameter>config</parameter> does not support the specified
21502f4aeb0Sopenharmony_ci            OpenVG alpha format attribute (the value of
21602f4aeb0Sopenharmony_ci            <constant>EGL_VG_ALPHA_FORMAT</constant> is
21702f4aeb0Sopenharmony_ci            <constant>EGL_VG_ALPHA_FORMAT_PRE</constant> and the
21802f4aeb0Sopenharmony_ci            <constant>EGL_VG_ALPHA_FORMAT_PRE_BIT</constant> is not set
21902f4aeb0Sopenharmony_ci            in the <constant>EGL_SURFACE_TYPE</constant> attribute of
22002f4aeb0Sopenharmony_ci            <parameter>config</parameter>) or colorspace attribute (the
22102f4aeb0Sopenharmony_ci            value of <constant>EGL_VG_COLORSPACE</constant> is
22202f4aeb0Sopenharmony_ci            <constant>EGL_VG_COLORSPACE_LINEAR</constant> and the
22302f4aeb0Sopenharmony_ci            <constant>EGL_VG_COLORSPACE_LINEAR_IT</constant> is not set
22402f4aeb0Sopenharmony_ci            in the <constant>EGL_SURFACE_TYPE</constant> attribute of
22502f4aeb0Sopenharmony_ci            <parameter>config</parameter>).
22602f4aeb0Sopenharmony_ci        </para>
22702f4aeb0Sopenharmony_ci    </refsect1>
22802f4aeb0Sopenharmony_ci    <refsect1 id="seealso"><title>See Also</title>
22902f4aeb0Sopenharmony_ci        <para>
23002f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>,
23102f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglChooseConfig</refentrytitle></citerefentry>,
23202f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetConfigs</refentrytitle></citerefentry>,
23302f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>,
23402f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
23502f4aeb0Sopenharmony_ci        </para>
23602f4aeb0Sopenharmony_ci    </refsect1>
23702f4aeb0Sopenharmony_ci    <refsect3 id="Copyright"><title></title>
23802f4aeb0Sopenharmony_ci        <!-- Content included from copyright.inc.xsl -->
23902f4aeb0Sopenharmony_ci        <imageobject>
24002f4aeb0Sopenharmony_ci                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
24102f4aeb0Sopenharmony_ci        </imageobject>
24202f4aeb0Sopenharmony_ci        <para />
24302f4aeb0Sopenharmony_ci    </refsect3>
24402f4aeb0Sopenharmony_ci</refentry>
245