| 1 |
/* |
| 2 |
* Copyright (C) 2024 Biswapriyo Nath |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2.1 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifdef __WIDL__ |
| 20 |
#pragma winrt ns_prefix |
| 21 |
#endif |
| 22 |
|
| 23 |
import "inspectable.idl"; |
| 24 |
import "asyncinfo.idl"; |
| 25 |
import "eventtoken.idl"; |
| 26 |
import "windowscontracts.idl"; |
| 27 |
import "windows.foundation.idl"; |
| 28 |
import "windows.graphics.directx.direct3d11.idl"; |
| 29 |
import "windows.storage.streams.idl"; |
| 30 |
|
| 31 |
namespace Windows.Graphics.Imaging { |
| 32 |
typedef enum BitmapAlphaMode BitmapAlphaMode; |
| 33 |
typedef enum BitmapBufferAccessMode BitmapBufferAccessMode; |
| 34 |
typedef enum BitmapPixelFormat BitmapPixelFormat; |
| 35 |
typedef struct BitmapBounds BitmapBounds; |
| 36 |
typedef struct BitmapPlaneDescription BitmapPlaneDescription; |
| 37 |
typedef struct BitmapSize BitmapSize; |
| 38 |
|
| 39 |
interface IBitmapBuffer; |
| 40 |
interface ISoftwareBitmap; |
| 41 |
interface ISoftwareBitmapFactory; |
| 42 |
interface ISoftwareBitmapStatics; |
| 43 |
|
| 44 |
runtimeclass BitmapBuffer; |
| 45 |
runtimeclass SoftwareBitmap; |
| 46 |
|
| 47 |
declare { |
| 48 |
interface Windows.Foundation.Collections.IIterable<Windows.Graphics.Imaging.BitmapPixelFormat>; |
| 49 |
interface Windows.Foundation.Collections.IIterable<Windows.Graphics.Imaging.SoftwareBitmap *>; |
| 50 |
interface Windows.Foundation.Collections.IIterator<Windows.Graphics.Imaging.BitmapPixelFormat>; |
| 51 |
interface Windows.Foundation.Collections.IIterator<Windows.Graphics.Imaging.SoftwareBitmap *>; |
| 52 |
interface Windows.Foundation.Collections.IVectorView<Windows.Graphics.Imaging.BitmapPixelFormat>; |
| 53 |
interface Windows.Foundation.IAsyncOperation<Windows.Graphics.Imaging.SoftwareBitmap *>; |
| 54 |
interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Graphics.Imaging.SoftwareBitmap *>; |
| 55 |
interface Windows.Foundation.IReference<Windows.Graphics.Imaging.BitmapBounds>; |
| 56 |
} |
| 57 |
|
| 58 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 59 |
enum BitmapAlphaMode |
| 60 |
{ |
| 61 |
Premultiplied = 0, |
| 62 |
Straight = 1, |
| 63 |
Ignore = 2, |
| 64 |
}; |
| 65 |
|
| 66 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 67 |
enum BitmapBufferAccessMode |
| 68 |
{ |
| 69 |
Read = 0, |
| 70 |
ReadWrite = 1, |
| 71 |
Write = 2, |
| 72 |
}; |
| 73 |
|
| 74 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 75 |
enum BitmapPixelFormat |
| 76 |
{ |
| 77 |
Unknown = 0, |
| 78 |
Rgba16 = 12, |
| 79 |
Rgba8 = 30, |
| 80 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 81 |
Gray16 = 57, |
| 82 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 83 |
Gray8 = 62, |
| 84 |
Bgra8 = 87, |
| 85 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 86 |
Nv12 = 103, |
| 87 |
[contract(Windows.Foundation.UniversalApiContract, 6.0)] |
| 88 |
P010 = 104, |
| 89 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 90 |
Yuy2 = 107, |
| 91 |
}; |
| 92 |
|
| 93 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 94 |
struct BitmapBounds |
| 95 |
{ |
| 96 |
UINT32 X; |
| 97 |
UINT32 Y; |
| 98 |
UINT32 Width; |
| 99 |
UINT32 Height; |
| 100 |
}; |
| 101 |
|
| 102 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 103 |
struct BitmapPlaneDescription |
| 104 |
{ |
| 105 |
INT32 StartIndex; |
| 106 |
INT32 Width; |
| 107 |
INT32 Height; |
| 108 |
INT32 Stride; |
| 109 |
}; |
| 110 |
|
| 111 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] |
| 112 |
struct BitmapSize |
| 113 |
{ |
| 114 |
UINT32 Width; |
| 115 |
UINT32 Height; |
| 116 |
}; |
| 117 |
|
| 118 |
[ |
| 119 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 120 |
exclusiveto(Windows.Graphics.Imaging.BitmapBuffer), |
| 121 |
uuid(a53e04c4-399c-438c-b28f-a63a6b83d1a1) |
| 122 |
] |
| 123 |
interface IBitmapBuffer : IInspectable |
| 124 |
requires Windows.Foundation.IMemoryBuffer, Windows.Foundation.IClosable |
| 125 |
{ |
| 126 |
HRESULT GetPlaneCount([out, retval] INT32 *value); |
| 127 |
HRESULT GetPlaneDescription([in] INT32 index, [out, retval] Windows.Graphics.Imaging.BitmapPlaneDescription *value); |
| 128 |
} |
| 129 |
|
| 130 |
[ |
| 131 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 132 |
exclusiveto(Windows.Graphics.Imaging.SoftwareBitmap), |
| 133 |
uuid(689e0708-7eef-483f-963f-da938818e073) |
| 134 |
] |
| 135 |
interface ISoftwareBitmap : IInspectable |
| 136 |
requires Windows.Foundation.IClosable |
| 137 |
{ |
| 138 |
[propget] HRESULT BitmapPixelFormat([out, retval] Windows.Graphics.Imaging.BitmapPixelFormat *value); |
| 139 |
[propget] HRESULT BitmapAlphaMode([out, retval] Windows.Graphics.Imaging.BitmapAlphaMode *value); |
| 140 |
[propget] HRESULT PixelWidth([out, retval] INT32 *value); |
| 141 |
[propget] HRESULT PixelHeight([out, retval] INT32 *value); |
| 142 |
[propget] HRESULT IsReadOnly([out, retval] boolean *value); |
| 143 |
[propput] HRESULT DpiX([in] DOUBLE value); |
| 144 |
[propget] HRESULT DpiX([out, retval] DOUBLE *value); |
| 145 |
[propput] HRESULT DpiY([in] DOUBLE value); |
| 146 |
[propget] HRESULT DpiY([out, retval] DOUBLE *value); |
| 147 |
HRESULT LockBuffer([in] Windows.Graphics.Imaging.BitmapBufferAccessMode mode, |
| 148 |
[out, retval] Windows.Graphics.Imaging.BitmapBuffer **value); |
| 149 |
HRESULT CopyTo([in] Windows.Graphics.Imaging.SoftwareBitmap *bitmap); |
| 150 |
HRESULT CopyFromBuffer([in] Windows.Storage.Streams.IBuffer *buffer); |
| 151 |
HRESULT CopyToBuffer([in] Windows.Storage.Streams.IBuffer *buffer); |
| 152 |
HRESULT GetReadOnlyView([out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 153 |
} |
| 154 |
|
| 155 |
[ |
| 156 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 157 |
exclusiveto(Windows.Graphics.Imaging.SoftwareBitmap), |
| 158 |
uuid(c99feb69-2d62-4d47-a6b3-4fdb6a07fdf8) |
| 159 |
] |
| 160 |
interface ISoftwareBitmapFactory : IInspectable |
| 161 |
{ |
| 162 |
HRESULT Create( |
| 163 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 164 |
[in] INT32 width, |
| 165 |
[in] INT32 height, |
| 166 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 167 |
HRESULT CreateWithAlpha( |
| 168 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 169 |
[in] INT32 width, |
| 170 |
[in] INT32 height, |
| 171 |
[in] Windows.Graphics.Imaging.BitmapAlphaMode alpha, |
| 172 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 173 |
} |
| 174 |
|
| 175 |
[ |
| 176 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 177 |
exclusiveto(Windows.Graphics.Imaging.SoftwareBitmap), |
| 178 |
uuid(df0385db-672f-4a9d-806e-c2442f343e86) |
| 179 |
] |
| 180 |
interface ISoftwareBitmapStatics : IInspectable |
| 181 |
{ |
| 182 |
HRESULT Copy( |
| 183 |
[in] Windows.Graphics.Imaging.SoftwareBitmap *source, |
| 184 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 185 |
[overload("Convert")] |
| 186 |
HRESULT Convert( |
| 187 |
[in] Windows.Graphics.Imaging.SoftwareBitmap *source, |
| 188 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 189 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 190 |
[overload("Convert")] |
| 191 |
HRESULT ConvertWithAlpha( |
| 192 |
[in] Windows.Graphics.Imaging.SoftwareBitmap *source, |
| 193 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 194 |
[in] Windows.Graphics.Imaging.BitmapAlphaMode alpha, |
| 195 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 196 |
[overload("CreateCopyFromBuffer")] |
| 197 |
HRESULT CreateCopyFromBuffer( |
| 198 |
[in] Windows.Storage.Streams.IBuffer *source, |
| 199 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 200 |
[in] INT32 width, |
| 201 |
[in] INT32 height, |
| 202 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 203 |
[overload("CreateCopyFromBuffer")] |
| 204 |
HRESULT CreateCopyWithAlphaFromBuffer( |
| 205 |
[in] Windows.Storage.Streams.IBuffer *source, |
| 206 |
[in] Windows.Graphics.Imaging.BitmapPixelFormat format, |
| 207 |
[in] INT32 width, |
| 208 |
[in] INT32 height, |
| 209 |
[in] Windows.Graphics.Imaging.BitmapAlphaMode alpha, |
| 210 |
[out, retval] Windows.Graphics.Imaging.SoftwareBitmap **value); |
| 211 |
[overload("CreateCopyFromSurfaceAsync")] |
| 212 |
HRESULT CreateCopyFromSurfaceAsync( |
| 213 |
[in] Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface *surface, |
| 214 |
[out, retval] Windows.Foundation.IAsyncOperation<Windows.Graphics.Imaging.SoftwareBitmap *> **value); |
| 215 |
[overload("CreateCopyFromSurfaceAsync")] |
| 216 |
HRESULT CreateCopyWithAlphaFromSurfaceAsync( |
| 217 |
[in] Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface *surface, |
| 218 |
[in] Windows.Graphics.Imaging.BitmapAlphaMode alpha, |
| 219 |
[out, retval] Windows.Foundation.IAsyncOperation<Windows.Graphics.Imaging.SoftwareBitmap *> **value); |
| 220 |
} |
| 221 |
|
| 222 |
[ |
| 223 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 224 |
marshaling_behavior(agile), |
| 225 |
threading(both) |
| 226 |
] |
| 227 |
runtimeclass BitmapBuffer |
| 228 |
{ |
| 229 |
[default] interface Windows.Graphics.Imaging.IBitmapBuffer; |
| 230 |
interface Windows.Foundation.IMemoryBuffer; |
| 231 |
interface Windows.Foundation.IClosable; |
| 232 |
} |
| 233 |
|
| 234 |
[ |
| 235 |
activatable(Windows.Graphics.Imaging.ISoftwareBitmapFactory, Windows.Foundation.UniversalApiContract, 1.0), |
| 236 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 237 |
marshaling_behavior(agile), |
| 238 |
static(Windows.Graphics.Imaging.ISoftwareBitmapStatics, Windows.Foundation.UniversalApiContract, 1.0), |
| 239 |
threading(both) |
| 240 |
] |
| 241 |
runtimeclass SoftwareBitmap |
| 242 |
{ |
| 243 |
[default] interface Windows.Graphics.Imaging.ISoftwareBitmap; |
| 244 |
interface Windows.Foundation.IClosable; |
| 245 |
} |
| 246 |
} |