| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bgrclib_packet.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/8 $ |
|---|
| 12 | * $brcm_Date: 2/16/12 3:50p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/syslib/grclib/7405/bgrclib_packet.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/8 2/16/12 3:50p nissen |
|---|
| 21 | * SW7405-5427: Adding flags for output mirroring when blitting |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/7 12/8/11 10:57a erickson |
|---|
| 24 | * SW7425-1921: note that BGRC_Output_ColorKeySelection is unused, but |
|---|
| 25 | * extend BGRClib_BlitColorKeyParams for completeness |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/6 7/21/11 5:27p erickson |
|---|
| 28 | * SW7420-1974: add separate dest and source constantColor |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/5 7/1/11 4:04p erickson |
|---|
| 31 | * SW7420-1974: remove unused param |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/4 5/31/11 1:16p erickson |
|---|
| 34 | * SW7420-1200: remove unused functions, add missing const, clean up |
|---|
| 35 | * comments |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/3 5/24/11 4:09p erickson |
|---|
| 38 | * SW7346-149: remove unused functions |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/2 5/24/11 3:14p erickson |
|---|
| 41 | * SW7420-1200: refactor grclib for optimal nexus use |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/1 5/23/11 4:50p erickson |
|---|
| 44 | * SW7420-1200: refactor grclib for optimal nexus use |
|---|
| 45 | * |
|---|
| 46 | ***************************************************************************/ |
|---|
| 47 | |
|---|
| 48 | /*= Module Overview ********************************************************* |
|---|
| 49 | <verbatim> |
|---|
| 50 | |
|---|
| 51 | Overview |
|---|
| 52 | |
|---|
| 53 | This version of GRClib is intended to convert nexus graphics2d non-packet function calls |
|---|
| 54 | into GRC packets. |
|---|
| 55 | |
|---|
| 56 | It is only for internal use and is not backward compatible with previous non-packet based GRClib |
|---|
| 57 | API's. |
|---|
| 58 | |
|---|
| 59 | The API does not use magnum's BSUR or BPXL types. Instead, conversion is done from nexus handles and types |
|---|
| 60 | directly to BM2MC packet types. |
|---|
| 61 | |
|---|
| 62 | BRect is asserted to be the same as NEXUS_Rect. |
|---|
| 63 | |
|---|
| 64 | Remove all functions that nexus does not use. |
|---|
| 65 | |
|---|
| 66 | Pixel format conversion for fills must be done in nexus. |
|---|
| 67 | |
|---|
| 68 | All calls are non-blocking |
|---|
| 69 | ***************************************************************************/ |
|---|
| 70 | |
|---|
| 71 | #ifndef BGRCLIB_H__ |
|---|
| 72 | #define BGRCLIB_H__ |
|---|
| 73 | |
|---|
| 74 | #include "bstd.h" |
|---|
| 75 | #include "berr.h" |
|---|
| 76 | #include "bgrc.h" |
|---|
| 77 | #include "bgrc_packet.h" |
|---|
| 78 | |
|---|
| 79 | #ifdef __cplusplus |
|---|
| 80 | extern "C" { |
|---|
| 81 | #endif |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | /***************************************************************************** |
|---|
| 85 | * Enums |
|---|
| 86 | *****************************************************************************/ |
|---|
| 87 | |
|---|
| 88 | /***************************************************************************** |
|---|
| 89 | Summary: |
|---|
| 90 | Fill operations available to BGRClib_Blended_Fill |
|---|
| 91 | |
|---|
| 92 | Description: |
|---|
| 93 | Options available for manipulating the color or alpha channel with |
|---|
| 94 | BGRClib_Blended_Fill |
|---|
| 95 | |
|---|
| 96 | See Also: |
|---|
| 97 | BGRClib_Blended_Fill |
|---|
| 98 | *****************************************************************************/ |
|---|
| 99 | typedef enum |
|---|
| 100 | { |
|---|
| 101 | BGRCLib_FillOp_eIgnore = 0, /* Do not change the values for the channel (either color or alpha) |
|---|
| 102 | Pc = Sc; Pa = Sa */ |
|---|
| 103 | BGRCLib_FillOp_eCopy, /* Copy the value of the channel (color or alpha) from the constant |
|---|
| 104 | color to the surface: Pc = Cc; Pa = Ca */ |
|---|
| 105 | BGRCLib_FillOp_eBlend /* For color channel, blend surface color with constant color using |
|---|
| 106 | constant alpha. For alpha channel, combine constant alpha with source alpha. |
|---|
| 107 | Pc = Ca*Cc + (1-Ca)*Sc; Pa = Ca*Ca + (1-Ca)*Sa */ |
|---|
| 108 | } BGRCLib_FillOp; |
|---|
| 109 | |
|---|
| 110 | /***************************************************************************** |
|---|
| 111 | Summary: |
|---|
| 112 | PorterDuff Operations |
|---|
| 113 | |
|---|
| 114 | Description: |
|---|
| 115 | This enum lists the 12 Porter-Duff operations that can be performed |
|---|
| 116 | between two surfaces. |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | See Also: |
|---|
| 120 | BGRClib_PorterDuffBlit and BGRClib_PorterDuffFill |
|---|
| 121 | *****************************************************************************/ |
|---|
| 122 | typedef enum |
|---|
| 123 | { |
|---|
| 124 | BGRCLib_PorterDuffOp_eClear = 0, /* Erase output */ |
|---|
| 125 | BGRCLib_PorterDuffOp_eSrc, /* Copy source to output */ |
|---|
| 126 | BGRCLib_PorterDuffOp_eDst, /* Copy dest to output */ |
|---|
| 127 | BGRCLib_PorterDuffOp_eSrcOver, /* Source over dest */ |
|---|
| 128 | BGRCLib_PorterDuffOp_eDstOver, /* Dest over source */ |
|---|
| 129 | BGRCLib_PorterDuffOp_eSrcIn, /* Part of source within dest */ |
|---|
| 130 | BGRCLib_PorterDuffOp_eDstIn, /* Part of dest within source */ |
|---|
| 131 | BGRCLib_PorterDuffOp_eSrcOut, /* Part of source not in dest */ |
|---|
| 132 | BGRCLib_PorterDuffOp_eDstOut, /* Part of dest not in source */ |
|---|
| 133 | BGRCLib_PorterDuffOp_eSrcAtop, /* Part of source in dest and remainder is dest */ |
|---|
| 134 | BGRCLib_PorterDuffOp_eDstAtop, /* Part of dest in source and remainder is source */ |
|---|
| 135 | BGRCLib_PorterDuffOp_eXor, /* Part of src not in dest and part of dest not in source */ |
|---|
| 136 | |
|---|
| 137 | BGRCLib_PorterDuffOp_Count |
|---|
| 138 | } BGRCLib_PorterDuffOp; |
|---|
| 139 | |
|---|
| 140 | /***************************************************************************** |
|---|
| 141 | Summary: |
|---|
| 142 | Color operations available in blit |
|---|
| 143 | |
|---|
| 144 | Description: |
|---|
| 145 | |
|---|
| 146 | Note that alpha values are always relative to the source and should be |
|---|
| 147 | between 0x00 and 0xFF. Therefore alpha of 0xFF means take all of the source |
|---|
| 148 | and of the destination. Likewise alpha of 0x00 means take none of source color, |
|---|
| 149 | all of the destination color. |
|---|
| 150 | |
|---|
| 151 | See Also: |
|---|
| 152 | BGRClib_Blit |
|---|
| 153 | *****************************************************************************/ |
|---|
| 154 | typedef enum |
|---|
| 155 | { |
|---|
| 156 | BGRCLib_BlitColorOp_eCopySource = 0, /* Select the source color. Pc = Sc */ |
|---|
| 157 | BGRCLib_BlitColorOp_eUseConstantAlpha, /* Blend the source and dest colors using the alpha from the constant param |
|---|
| 158 | Pc = Ca*Sc + (1-Ca)*Dc */ |
|---|
| 159 | BGRCLib_BlitColorOp_eUseSourceAlpha, /* Blend the source and dest colors using the alpha from the source pixels |
|---|
| 160 | Pc = Sa*Sc + (1-Sa)*Dc */ |
|---|
| 161 | BGRCLib_BlitColorOp_eUseDestAlpha, /* Blend the source and dest colors using the alpha from the dest pixels |
|---|
| 162 | Pc = Da*Sc + (1-Da)*Dc */ |
|---|
| 163 | BGRCLib_BlitColorOp_eSelectPaletteWithColorkey, /* Combine two palettized surfaces using colorkey to select per pixel. |
|---|
| 164 | Use the colorKeyLower and colorKeyUpper fields of BGRClib_BlitParams |
|---|
| 165 | Pc = Sc (Note: this is the same as _eCopySource) */ |
|---|
| 166 | BGRCLib_BlitColorOp_eModulate, /* [DEPRECATED] use _eUseSourceAlpha instead */ |
|---|
| 167 | BGRCLib_BlitColorOp_eAdd, /* Adds source and destination color (i.e., Pc = Sc + Dc). This can be used for |
|---|
| 168 | brightening and over-saturation effects */ |
|---|
| 169 | BGRCLib_BlitColorOp_eUseBlendFactors, /* Use blend factors specified in BGRClib_BlitParams.colorBlend */ |
|---|
| 170 | |
|---|
| 171 | BGRCLib_BlitColorOp_Count |
|---|
| 172 | } BGRCLib_BlitColorOp; |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | /***************************************************************************** |
|---|
| 176 | Summary: |
|---|
| 177 | Alpha operations available in blit |
|---|
| 178 | |
|---|
| 179 | Description: |
|---|
| 180 | This enum lists the operations that are available on the alpha channel. |
|---|
| 181 | |
|---|
| 182 | See Also: |
|---|
| 183 | BGRClib_Blit |
|---|
| 184 | *****************************************************************************/ |
|---|
| 185 | typedef enum |
|---|
| 186 | { |
|---|
| 187 | BGRCLib_BlitAlphaOp_eCopySource = 0, /* Use the source alpha for the output alpha (Pa = Sa) */ |
|---|
| 188 | BGRCLib_BlitAlphaOp_eUseConstAlpha, /* Copy the constant parameter for the output alpha (Pa = Ca) */ |
|---|
| 189 | BGRCLib_BlitAlphaOp_eUseDestAlpha, /* Use the dest alpha for the output alpha (Pa = Da) */ |
|---|
| 190 | BGRCLib_BlitAlphaOp_eUseCombinedAlpha, /* Combine source and dest alpha. (Pa = Sa*Sa + Da*(1-Sa) */ |
|---|
| 191 | BGRCLib_BlitAlphaOp_eEmulateTransparentVideo, /* Calculate alpha values so that video window, when placed behind the |
|---|
| 192 | graphics window, appears to be in front of the graphics, with an |
|---|
| 193 | alpha of Ca. (Pa = 1 - (1-Sa)*Ca) */ |
|---|
| 194 | BGRCLib_BlitAlphaOp_eModulate, /* [DEPRECATED] use _eUseSourceAlpha instead */ |
|---|
| 195 | BGRCLib_BlitAlphaOp_eAdd, /* Adds source and destionation alpha (Pa = Sa + Da) */ |
|---|
| 196 | BGRCLib_BlitAlphaOp_eUseBlendFactors, /* Use blend factors specified in BGRClib_BlitParams.alphaBlend */ |
|---|
| 197 | |
|---|
| 198 | BGRCLib_BlitAlphaOp_Count |
|---|
| 199 | } BGRCLib_BlitAlphaOp; |
|---|
| 200 | |
|---|
| 201 | /***************************************************************************** |
|---|
| 202 | * Structures |
|---|
| 203 | *****************************************************************************/ |
|---|
| 204 | |
|---|
| 205 | /***************************************************************************** |
|---|
| 206 | Summary: |
|---|
| 207 | Rectangle type which matches NEXUS_Rect |
|---|
| 208 | *****************************************************************************/ |
|---|
| 209 | typedef struct |
|---|
| 210 | { |
|---|
| 211 | int16_t x; |
|---|
| 212 | int16_t y; |
|---|
| 213 | uint16_t width; |
|---|
| 214 | uint16_t height; |
|---|
| 215 | } BRect; |
|---|
| 216 | |
|---|
| 217 | /***************************************************************************** |
|---|
| 218 | Summary: |
|---|
| 219 | GRC Blending Equation |
|---|
| 220 | |
|---|
| 221 | Description: |
|---|
| 222 | This structure exposes the blending equation used by the GRC during blits. |
|---|
| 223 | |
|---|
| 224 | See Also: |
|---|
| 225 | BGRClib_Blit |
|---|
| 226 | *****************************************************************************/ |
|---|
| 227 | typedef struct |
|---|
| 228 | { |
|---|
| 229 | /* Blend: a*b +/- b*c +/- e*/ |
|---|
| 230 | BGRC_Blend_Source a; |
|---|
| 231 | BGRC_Blend_Source b; |
|---|
| 232 | bool subcd; |
|---|
| 233 | BGRC_Blend_Source c; |
|---|
| 234 | BGRC_Blend_Source d; |
|---|
| 235 | bool sube; |
|---|
| 236 | BGRC_Blend_Source e; |
|---|
| 237 | } BGRClib_BlendEquation; |
|---|
| 238 | |
|---|
| 239 | /***************************************************************************** |
|---|
| 240 | Summary: |
|---|
| 241 | Param block for blit routine |
|---|
| 242 | |
|---|
| 243 | Description: |
|---|
| 244 | The param block provides all of the parameters for the generic blit function. |
|---|
| 245 | |
|---|
| 246 | See Also: |
|---|
| 247 | BGRClib_Blit |
|---|
| 248 | *****************************************************************************/ |
|---|
| 249 | typedef struct |
|---|
| 250 | { |
|---|
| 251 | BM2MC_PACKET_Plane* srcSurface; /* A surface handle list. May be NULL */ |
|---|
| 252 | const BRect* srcRect; /* Source area of blit. NULL indicates entire surface. */ |
|---|
| 253 | unsigned srcPaletteOffset; |
|---|
| 254 | BM2MC_PACKET_Plane* dstSurface; /* A surface handle. May be NULL */ |
|---|
| 255 | const BRect* dstRect; /* Destination area of blit. NULL indicates entire surface. */ |
|---|
| 256 | BM2MC_PACKET_Plane* outSurface; /* A surface handle. Required. */ |
|---|
| 257 | const BRect* outRect; /* Output area of blit. NULL indicates entire surface. */ |
|---|
| 258 | |
|---|
| 259 | BGRCLib_BlitColorOp colorOp; /* Selection of color blending equation */ |
|---|
| 260 | BGRCLib_BlitAlphaOp alphaOp; /* Selection of alpha blending equation */ |
|---|
| 261 | BGRClib_BlendEquation colorBlend; /* Color blending equation (see bgrc.h:BGRC_Blend_SetColorBlend). Used when colorOp==_eUseBlendFactor. |
|---|
| 262 | Otherwise, this data is populated with color equation used according to the colorOp */ |
|---|
| 263 | BGRClib_BlendEquation alphaBlend; /* Alpha blending equation (see bgrc.h:BGRC_Blend_SetAlphaBlend). Used when alphaOp==_eUseBlendFactor. |
|---|
| 264 | Otherwise, this data is populated with alpha equation used according to the alphaOp */ |
|---|
| 265 | |
|---|
| 266 | uint32_t constantColor; /* BLEND Constant alpha and color. Only standard color format supported. Used by some operations */ |
|---|
| 267 | uint32_t destConstantColor; /* DEST Constant alpha and color. Only standard color format supported. Used by some operations */ |
|---|
| 268 | uint32_t sourceConstantColor; /* SOURCE Constant alpha and color. Only standard color format supported. Used by some operations */ |
|---|
| 269 | |
|---|
| 270 | BGRC_Output_ColorKeySelection colorKeySelect; /* Select which block provides pixels to output. |
|---|
| 271 | For operations which compute new pixel values, the blend block should be used. |
|---|
| 272 | For operations with palette surfaces, the source is typically the block to be used; |
|---|
| 273 | unless destination colorkeys is enabled, then the destination block should be used. */ |
|---|
| 274 | |
|---|
| 275 | /* Filter to use for scaling */ |
|---|
| 276 | BGRC_FilterCoeffs horzFilter; /* See BGRC_FilterCoeffs and BGRC_Source_SetFilterCoeffs in bgrc.h */ |
|---|
| 277 | BGRC_FilterCoeffs vertFilter; /* See BGRC_FilterCoeffs and BGRC_Source_SetFilterCoeffs in bgrc.h */ |
|---|
| 278 | |
|---|
| 279 | /* Blit Reversal Flags */ |
|---|
| 280 | bool mirrorSrcVertically; |
|---|
| 281 | bool mirrorSrcHorizontally; |
|---|
| 282 | bool mirrorDstVertically; |
|---|
| 283 | bool mirrorDstHorizontally; |
|---|
| 284 | bool mirrorOutVertically; |
|---|
| 285 | bool mirrorOutHorizontally; |
|---|
| 286 | |
|---|
| 287 | bool srcAlphaPremult; /* Enable/Disable Source Alpha Premultiplication */ |
|---|
| 288 | |
|---|
| 289 | } BGRClib_BlitParams; |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | /***************************************************************************** |
|---|
| 293 | Summary: |
|---|
| 294 | Color Conversion Matrix Param block for blit routine |
|---|
| 295 | |
|---|
| 296 | Description: |
|---|
| 297 | The param block provides optional color conversion matrix parameters for |
|---|
| 298 | the generic blit function. |
|---|
| 299 | |
|---|
| 300 | See Also: |
|---|
| 301 | BGRClib_Blit |
|---|
| 302 | *****************************************************************************/ |
|---|
| 303 | typedef struct |
|---|
| 304 | { |
|---|
| 305 | /* Source Color Conversion Matrix */ |
|---|
| 306 | int32_t* conversionMatrix;/* Color conversion matrix. NULL indicates no matrix provided. */ |
|---|
| 307 | uint32_t matrixShift; /* Matrix shift value. See BGRC_Source_SetColorMatrix5x4() for more info */ |
|---|
| 308 | |
|---|
| 309 | } BGRClib_BlitMatrixParams; |
|---|
| 310 | |
|---|
| 311 | /***************************************************************************** |
|---|
| 312 | Summary: |
|---|
| 313 | Color key Param block for blit routine |
|---|
| 314 | |
|---|
| 315 | Description: |
|---|
| 316 | The param block provides optional color key parameters for the generic |
|---|
| 317 | blit function. |
|---|
| 318 | |
|---|
| 319 | See Also: |
|---|
| 320 | BGRClib_Blit |
|---|
| 321 | *****************************************************************************/ |
|---|
| 322 | typedef struct |
|---|
| 323 | { |
|---|
| 324 | |
|---|
| 325 | bool enableColorKey; /* Enable colorkeying on the source surface */ |
|---|
| 326 | uint32_t colorKeyLower; /* Lower colorkey value. Only standard color format supported. */ |
|---|
| 327 | uint32_t colorKeyUpper; /* Upper colorkey value. Only standard color format supported. */ |
|---|
| 328 | uint32_t colorKeyMask; /* Mask to use when comparing color key to source color */ |
|---|
| 329 | uint32_t colorKeyReplace; /* Replacement color */ |
|---|
| 330 | uint32_t colorKeyRplMask; /* Mask for replacement color */ |
|---|
| 331 | |
|---|
| 332 | bool enableDstColorKey; /* Enable colorkeying on the source surface */ |
|---|
| 333 | uint32_t dstColorKeyLower; /* Lower colorkey value. Only standard color format supported. */ |
|---|
| 334 | uint32_t dstColorKeyUpper; /* Upper colorkey value. Only standard color format supported. */ |
|---|
| 335 | uint32_t dstColorKeyMask; /* Mask to use when comparing color key to source color */ |
|---|
| 336 | uint32_t dstColorKeyReplace; /* Replacement color */ |
|---|
| 337 | uint32_t dstColorKeyRplMask; /* Mask for replacement color */ |
|---|
| 338 | |
|---|
| 339 | BGRC_Output_ColorKeySelection cksOnlySrcColorKeyed; |
|---|
| 340 | BGRC_Output_ColorKeySelection cksOnlyDstColorKeyed; |
|---|
| 341 | BGRC_Output_ColorKeySelection cksBothSrcDstColorKeyed; |
|---|
| 342 | BGRC_Output_ColorKeySelection cksNeitherSrcDstColorKeyed; |
|---|
| 343 | |
|---|
| 344 | } BGRClib_BlitColorKeyParams; |
|---|
| 345 | |
|---|
| 346 | /***************************************************************************** |
|---|
| 347 | Summary: |
|---|
| 348 | Pattern (raster operations) Param block for blit routine |
|---|
| 349 | |
|---|
| 350 | Description: |
|---|
| 351 | The param block provides all of the parameters for the generic blit function. |
|---|
| 352 | |
|---|
| 353 | See Also: |
|---|
| 354 | BGRClib_Blit |
|---|
| 355 | *****************************************************************************/ |
|---|
| 356 | typedef struct |
|---|
| 357 | { |
|---|
| 358 | uint8_t ropVector; /* 8 bit ROP vector. */ |
|---|
| 359 | uint8_t* pattern; /* 8x8 bit ROP pattern. */ |
|---|
| 360 | uint32_t backColor; /* ROP background color. */ |
|---|
| 361 | uint32_t foreColor; /* ROP foreground color. */ |
|---|
| 362 | |
|---|
| 363 | } BGRClib_BlitPatternParams; |
|---|
| 364 | |
|---|
| 365 | /***************************************************************************** |
|---|
| 366 | Summary: |
|---|
| 367 | Additional Scaling Control Param block for blit routine |
|---|
| 368 | |
|---|
| 369 | Description: |
|---|
| 370 | The param block provides additional scaling control parameters for the |
|---|
| 371 | generic blit function. |
|---|
| 372 | |
|---|
| 373 | See Also: |
|---|
| 374 | BGRClib_Blit |
|---|
| 375 | BGRC_Source_SetFilterPhaseAdjustment |
|---|
| 376 | BGRC_Source_SetFixedScaleFactor |
|---|
| 377 | *****************************************************************************/ |
|---|
| 378 | typedef struct |
|---|
| 379 | { |
|---|
| 380 | /* See BGRC_Source_SetFilterPhaseAdjustment */ |
|---|
| 381 | bool setFilterPhaseAdj; /* true: Set the filter phase adjustment */ |
|---|
| 382 | int32_t iHorizontalPhase; /* Horizontal initial phase. */ |
|---|
| 383 | int32_t iVerticalPhase; /* Vertical initial phase. */ |
|---|
| 384 | uint32_t ulPhaseFixedPointShift; /* Fixed-point shift, in bits, to allow for fractional values. */ |
|---|
| 385 | |
|---|
| 386 | /* BGRC_Source_SetFixedScaleFactor */ |
|---|
| 387 | bool setFixedScaleFactor; /* true: Set the fixed scale factor */ |
|---|
| 388 | uint32_t ulHorizontalNumerator; /* Horizontal/Source numerator */ |
|---|
| 389 | uint32_t ulHorizontalDenominator; /* Horizontal/Source denominator */ |
|---|
| 390 | uint32_t ulVerticalNumerator; /* Vertical/Output numerator */ |
|---|
| 391 | uint32_t ulVerticalDenominator; /* Vertical/Output denominator */ |
|---|
| 392 | |
|---|
| 393 | } BGRClib_BlitScalingControlParams; |
|---|
| 394 | |
|---|
| 395 | /***************************************************************************** |
|---|
| 396 | Summary: |
|---|
| 397 | Handle for BGRClib module |
|---|
| 398 | |
|---|
| 399 | Description: |
|---|
| 400 | The BGRClib_Handle, once opened, represents the state of the BGRClib |
|---|
| 401 | module. |
|---|
| 402 | |
|---|
| 403 | See Also: |
|---|
| 404 | BGRClib_Open |
|---|
| 405 | *****************************************************************************/ |
|---|
| 406 | typedef struct BGRClib_P_Data_tag* BGRClib_Handle; |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | /***************************************************************************** |
|---|
| 410 | * Public API |
|---|
| 411 | *****************************************************************************/ |
|---|
| 412 | |
|---|
| 413 | |
|---|
| 414 | /***************************************************************************** |
|---|
| 415 | Summary: |
|---|
| 416 | Initialize the BGRClib module |
|---|
| 417 | |
|---|
| 418 | Description: |
|---|
| 419 | This module intializes the BGRClib module. |
|---|
| 420 | |
|---|
| 421 | Returns: |
|---|
| 422 | BERR_SUCCESS - The handle was successfully created. |
|---|
| 423 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 424 | possibly NULL. |
|---|
| 425 | BERR_OUT_OF_SYSTEM_MEMORY - Memory allocation failed. |
|---|
| 426 | |
|---|
| 427 | See Also: |
|---|
| 428 | BGRClib_Close |
|---|
| 429 | *****************************************************************************/ |
|---|
| 430 | BERR_Code BGRClib_Open( |
|---|
| 431 | BGRClib_Handle* pgrclibHandle, /* [out] A pointer to an allocated BGRClib_Handle */ |
|---|
| 432 | BGRC_Handle grcHandle, /* An initialized BGRC module handle. */ |
|---|
| 433 | BGRC_PacketContext_Handle packetContext |
|---|
| 434 | ); |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | /***************************************************************************** |
|---|
| 438 | Summary: |
|---|
| 439 | Close a BGRClib_Handle. |
|---|
| 440 | |
|---|
| 441 | Description: |
|---|
| 442 | This function frees the BGRClib_Handle structure and all associated data. |
|---|
| 443 | |
|---|
| 444 | *****************************************************************************/ |
|---|
| 445 | void BGRClib_Close( |
|---|
| 446 | BGRClib_Handle grclibHandle /* A valid BGRClib_Handle object */ |
|---|
| 447 | ); |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | BERR_Code BGRClib_Memset32( |
|---|
| 451 | BGRClib_Handle grclib, |
|---|
| 452 | uint32_t offset, |
|---|
| 453 | uint32_t data, |
|---|
| 454 | uint32_t count |
|---|
| 455 | ); |
|---|
| 456 | |
|---|
| 457 | BERR_Code BGRClib_Destripe_Blit( |
|---|
| 458 | BGRClib_Handle grclib, |
|---|
| 459 | const BM2MC_PACKET_Plane *pOutSurface, |
|---|
| 460 | const BRect *pOutRect, |
|---|
| 461 | uint32_t lumaOffset, |
|---|
| 462 | uint32_t chromaOffset, |
|---|
| 463 | uint32_t pitch, |
|---|
| 464 | uint32_t width, |
|---|
| 465 | uint32_t height, |
|---|
| 466 | uint32_t stripeWidth, |
|---|
| 467 | uint32_t lumaStripeHeight, |
|---|
| 468 | uint32_t chromaStripeHeight, |
|---|
| 469 | const int32_t colorMatrix[], |
|---|
| 470 | uint32_t matrixShift |
|---|
| 471 | ); |
|---|
| 472 | |
|---|
| 473 | /***************************************************************************** |
|---|
| 474 | Summary: |
|---|
| 475 | Fill a rectangular area of a surface |
|---|
| 476 | |
|---|
| 477 | Description: |
|---|
| 478 | This routine fills an area of a surface with the specified color. The |
|---|
| 479 | color may be in the standard color format (see definitions, above) or |
|---|
| 480 | may match the format of the surface. |
|---|
| 481 | |
|---|
| 482 | Returns: |
|---|
| 483 | BERR_SUCCESS - The surface fill completed. |
|---|
| 484 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 485 | possibly NULL. |
|---|
| 486 | BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out |
|---|
| 487 | *****************************************************************************/ |
|---|
| 488 | BERR_Code BGRClib_Fill( |
|---|
| 489 | BGRClib_Handle grclibHandle, /* A valid BGRClib_Handle object */ |
|---|
| 490 | const BM2MC_PACKET_Plane *pSurface, |
|---|
| 491 | uint32_t constantcolor, /* Color, either in color format of the surface */ |
|---|
| 492 | /* or in the standard color format */ |
|---|
| 493 | const BRect* pRect /* Pointer to a rect specifying the part of a */ |
|---|
| 494 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 495 | ); |
|---|
| 496 | |
|---|
| 497 | /***************************************************************************** |
|---|
| 498 | Summary: |
|---|
| 499 | Fill, tint or otherwise modify the pixels of an |
|---|
| 500 | area of a surface using a constant value |
|---|
| 501 | |
|---|
| 502 | Description: |
|---|
| 503 | This routine modifies the color channels and/or the alpha channel of the |
|---|
| 504 | pixels of a surface using a constant value |
|---|
| 505 | |
|---|
| 506 | Returns: |
|---|
| 507 | BERR_SUCCESS - The surface fill completed. |
|---|
| 508 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 509 | possibly NULL. |
|---|
| 510 | BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out |
|---|
| 511 | |
|---|
| 512 | See Also: |
|---|
| 513 | |
|---|
| 514 | *****************************************************************************/ |
|---|
| 515 | BERR_Code BGRClib_Blended_Fill( |
|---|
| 516 | BGRClib_Handle grclibHandle, /* A valid BGRClib_Handle object */ |
|---|
| 517 | const BM2MC_PACKET_Plane *pSurface, |
|---|
| 518 | uint32_t constantColor, /* Color, either in C3C2C3C1 format */ |
|---|
| 519 | /* or the specified format */ |
|---|
| 520 | const BRect* pRect, /* Pointer to a rect specifying the part of a */ |
|---|
| 521 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 522 | BGRCLib_FillOp colorOp, /* Color operation */ |
|---|
| 523 | BGRCLib_FillOp alphaOp /* Alpha operation */ |
|---|
| 524 | ); |
|---|
| 525 | |
|---|
| 526 | |
|---|
| 527 | /***************************************************************************** |
|---|
| 528 | Summary: |
|---|
| 529 | Fill, tint or otherwise modify the pixels of an |
|---|
| 530 | area of a surface using a constant value and Porter-Duff composition rules. |
|---|
| 531 | |
|---|
| 532 | Description: |
|---|
| 533 | This routine modifies the color channels and/or the alpha channel of the |
|---|
| 534 | pixels of a surface using a constant value and Porter-Duff composition rules. |
|---|
| 535 | |
|---|
| 536 | Returns: |
|---|
| 537 | BERR_SUCCESS - The surface fill completed. |
|---|
| 538 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 539 | possibly NULL. |
|---|
| 540 | BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out |
|---|
| 541 | |
|---|
| 542 | See Also: |
|---|
| 543 | |
|---|
| 544 | *****************************************************************************/ |
|---|
| 545 | BERR_Code BGRClib_PorterDuffFill( |
|---|
| 546 | BGRClib_Handle grclibHandle, /* A valid BGRClib_Handle object */ |
|---|
| 547 | BGRCLib_PorterDuffOp pdOp, /* A Porter-Duff operation */ |
|---|
| 548 | const BM2MC_PACKET_Plane *pSurface, |
|---|
| 549 | uint32_t constantColor, /* Color, either in C3C2C3C1 format */ |
|---|
| 550 | /* or the specified format */ |
|---|
| 551 | const BRect* pRect /* Pointer to a rect specifying the part of a */ |
|---|
| 552 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 553 | ); |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | /***************************************************************************** |
|---|
| 557 | Summary: |
|---|
| 558 | Combine two surfaces into a third using Porter-Duff composition rules |
|---|
| 559 | |
|---|
| 560 | Description: |
|---|
| 561 | This routine combines an area of the source surface and an area of the |
|---|
| 562 | destination surface into an area of the output surface using Porter-Duff |
|---|
| 563 | composition rules. No color space conversion or color keying is performed. |
|---|
| 564 | |
|---|
| 565 | If the source surface is palette-based and the output surface is not |
|---|
| 566 | paletted-based, then the palette entries in the source pixels will be |
|---|
| 567 | converted to colors in the output pixels |
|---|
| 568 | |
|---|
| 569 | Returns: |
|---|
| 570 | BERR_SUCCESS - The surface fill completed. |
|---|
| 571 | BERR_INVALID_PARAMETER - One of the supplied parameters was invalid, |
|---|
| 572 | possibly NULL. |
|---|
| 573 | BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out |
|---|
| 574 | |
|---|
| 575 | See Also: |
|---|
| 576 | |
|---|
| 577 | *****************************************************************************/ |
|---|
| 578 | BERR_Code BGRClib_PorterDuffBlit( |
|---|
| 579 | BGRClib_Handle grclibHandle, /* A valid BGRClib_Handle object */ |
|---|
| 580 | BGRCLib_PorterDuffOp pdOp, /* A Porter-Duff operation */ |
|---|
| 581 | |
|---|
| 582 | const BM2MC_PACKET_Plane *pSrcSurface, |
|---|
| 583 | const BRect* pSrcRect, /* Pointer to a rect specifying the part of a */ |
|---|
| 584 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 585 | unsigned paletteOffset, |
|---|
| 586 | const BM2MC_PACKET_Plane *pDstSurface, |
|---|
| 587 | const BRect* pDstRect, /* Pointer to a rect specifying the part of a */ |
|---|
| 588 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 589 | const BM2MC_PACKET_Plane *pOutSurface, |
|---|
| 590 | const BRect* pOutRect /* Pointer to a rect specifying the part of a */ |
|---|
| 591 | /* surface to fill, or NULL to fill the entire surface */ |
|---|
| 592 | ); |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | /***************************************************************************** |
|---|
| 596 | Summary: |
|---|
| 597 | Populate param block with default values |
|---|
| 598 | |
|---|
| 599 | Description: |
|---|
| 600 | Set-up the blit param block for typical values for performing a blit |
|---|
| 601 | on non-palette surfaces |
|---|
| 602 | |
|---|
| 603 | See Also: |
|---|
| 604 | BGRClib_Blit |
|---|
| 605 | BGRClib_GetDefaultPaletteBlitParams |
|---|
| 606 | *****************************************************************************/ |
|---|
| 607 | void BGRClib_GetDefaultBlitParams( |
|---|
| 608 | BGRClib_BlitParams *params |
|---|
| 609 | ); |
|---|
| 610 | |
|---|
| 611 | |
|---|
| 612 | /***************************************************************************** |
|---|
| 613 | Summary: |
|---|
| 614 | Populate param block with default values for Palette blits |
|---|
| 615 | |
|---|
| 616 | Description: |
|---|
| 617 | Set-up the blit param block for typical values for performaing a blit on |
|---|
| 618 | palette surfaces. The important differences are that a point sample filter |
|---|
| 619 | is used and the source block is selected instead of the blend block. |
|---|
| 620 | |
|---|
| 621 | See Also: |
|---|
| 622 | BGRClib_Blit |
|---|
| 623 | BGRClib_GetDefaultBlitParams |
|---|
| 624 | *****************************************************************************/ |
|---|
| 625 | void BGRClib_GetDefaultPaletteBlitParams( |
|---|
| 626 | BGRClib_BlitParams *params |
|---|
| 627 | ); |
|---|
| 628 | |
|---|
| 629 | |
|---|
| 630 | /***************************************************************************** |
|---|
| 631 | Summary: |
|---|
| 632 | Populate colorkey param block with default values |
|---|
| 633 | |
|---|
| 634 | Description: |
|---|
| 635 | Set-up the colorkey blit param block for typical values for performing a |
|---|
| 636 | colorkey operation. The main purpose of this is to set-up the |
|---|
| 637 | colorkey selection parameters. |
|---|
| 638 | |
|---|
| 639 | See Also: |
|---|
| 640 | BGRClib_Blit |
|---|
| 641 | *****************************************************************************/ |
|---|
| 642 | void BGRClib_GetDefaultColorKeyParams( |
|---|
| 643 | BGRClib_BlitColorKeyParams *colorkeyparams |
|---|
| 644 | ); |
|---|
| 645 | |
|---|
| 646 | |
|---|
| 647 | /***************************************************************************** |
|---|
| 648 | Summary: |
|---|
| 649 | Populate scaling control param block with default values |
|---|
| 650 | |
|---|
| 651 | Description: |
|---|
| 652 | Set-up the scaling control param block for initial values. |
|---|
| 653 | |
|---|
| 654 | See Also: |
|---|
| 655 | BGRClib_Blit |
|---|
| 656 | *****************************************************************************/ |
|---|
| 657 | void BGRClib_GetDefaultScalingControlParams( |
|---|
| 658 | BGRClib_BlitScalingControlParams *scalingparams |
|---|
| 659 | ); |
|---|
| 660 | |
|---|
| 661 | /***************************************************************************** |
|---|
| 662 | Summary: |
|---|
| 663 | Blit operation |
|---|
| 664 | |
|---|
| 665 | Description: |
|---|
| 666 | |
|---|
| 667 | |
|---|
| 668 | See Also: |
|---|
| 669 | BGRClib_Blit |
|---|
| 670 | *****************************************************************************/ |
|---|
| 671 | BERR_Code BGRClib_Blit( |
|---|
| 672 | BGRClib_Handle grclibHandle, /* A valid BGRClib_Handle object */ |
|---|
| 673 | const BGRClib_BlitParams* params, /* General blit parameters */ |
|---|
| 674 | const BGRClib_BlitColorKeyParams* colorkeyParams, /* Optional colorkey parameters. Use NULL if not using colorkeying */ |
|---|
| 675 | const BGRClib_BlitMatrixParams* matrixParams, /* Optional color conversion matrix parameters. Use NULL if not using color matrix */ |
|---|
| 676 | const BGRClib_BlitPatternParams* patternParams, /* Optional (ROP) pattern parameters. Use NULL if not using pattern block */ |
|---|
| 677 | const BGRClib_BlitScalingControlParams* scalingParams /* Optional scaling control parameters. Use NULL for default scaling behavior. */ |
|---|
| 678 | ); |
|---|
| 679 | |
|---|
| 680 | #ifdef __cplusplus |
|---|
| 681 | } |
|---|
| 682 | #endif |
|---|
| 683 | |
|---|
| 684 | #endif /* BGRCLIB_H__ */ |
|---|