source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/grclib/7552/bgrclib.h @ 2

Last change on this file since 2 was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 40.7 KB
Line 
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.h $
11 * $brcm_Revision: Hydra_Software_Devel/19 $
12 * $brcm_Date: 2/16/12 3:41p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/syslib/grclib/7405/bgrclib.h $
19 *
20 * Hydra_Software_Devel/19   2/16/12 3:41p nissen
21 * SW7405-5427: Adding flags for output mirroring when blitting
22 *
23 * Hydra_Software_Devel/18   7/28/10 11:53a erickson
24 * SW7405-3671: add #if GRCPACKET_SUPPORT logic
25 *
26 * Hydra_Software_Devel/17   3/10/10 2:46p nissen
27 * SW7405-3671: Added offset buffer pointers to batch packet blits.
28 *
29 * Hydra_Software_Devel/16   2/16/10 4:28p nissen
30 * SW7405-3671: Fixed warnings.
31 *
32 * Hydra_Software_Devel/15   2/9/10 4:31p nissen
33 * SW7405-3671: Updated batch blits.
34 *
35 * Hydra_Software_Devel/14   2/3/10 2:10p nissen
36 * SW7405-3671: Added batch packets.
37 *
38 * Hydra_Software_Devel/13   1/19/10 12:35p nissen
39 * SW7405-3671: Added support for sync'ing and 420 destriping.
40 *
41 * Hydra_Software_Devel/12   11/4/09 9:48a erickson
42 * SW7405-3328: add BGRClib_PorterDuffFill
43 *
44 * Hydra_Software_Devel/DirectFB_1_4_Port/1   10/30/09 2:02p robertwm
45 * SW7405-3328: Support Porter-Duff Fill Compositions.
46 *
47 * Hydra_Software_Devel/11   9/29/09 2:52p erickson
48 * SW7405-3021: add BGRClib_BlitParams.srcAlphaPremult
49 *
50 * Hydra_Software_Devel/10   8/3/09 3:30p dkaufman
51 * PR57260: No longer call BGRC_ResetState; No longer calling GRC routines
52 * if params not changed from previous call; Added BGRClib_ResetState
53 *
54 * Hydra_Software_Devel/9   4/17/09 1:37p dkaufman
55 * PR53701: Added source and destination mirroring
56 *
57 * Hydra_Software_Devel/8   4/3/09 2:37p dkaufman
58 * PR53701: Add scaling control in BGRClib_Blit with new
59 * BGRClib_BlitScalingControlParams param block
60 *
61 * Hydra_Software_Devel/7   4/3/09 7:48a dkaufman
62 * PR53701: Add colorkey selection params for colorkeying
63 *
64 * Hydra_Software_Devel/6   3/18/09 2:37p dkaufman
65 * PR47134: Changed BGRClib_Blend to BGRClib_BlendEquation; Removed
66 * deprecated brightness, contrast, etc from BGRClib_BlitParams; Factored
67 * BGRClib_BlitColorMatrixParams and BGRClib_BlitColorKeyParams out of
68 * BGRClib_BlitParams; Added BGRClib_BlitPatternParams; Changed
69 * BGRClib_Blit params to match new param blocks; Fixed
70 * _eUseCombinedAlpha: Pa = Sa + Da*(1-Sa) instead of Sa * Sa + Da*(1-Sa)
71 *
72 * Hydra_Software_Devel/5   9/14/08 11:17a dkaufman
73 * PR44067: Allow blending equation to be fully specified by application
74 *
75 * Hydra_Software_Devel/4   8/4/08 9:17a erickson
76 * PR45361: fix c89 error
77 *
78 * Hydra_Software_Devel/3   2/27/08 11:26a dkaufman
79 * PR38886: Added destConstColor to blit param block
80 *
81 * Hydra_Software_Devel/2   2/11/08 1:03p dkaufman
82 * PR38886: Corrected comments; added fields to BGRClib_BlitParams; added
83 * BGRClib_GetDefaultPaletteBlitParams
84 *
85 * Hydra_Software_Devel/1   10/18/07 12:49p vobadm
86 * PR36190:  Adding directories and files
87 *
88  *
89 ***************************************************************************/
90
91/*= Module Overview *********************************************************
92<verbatim>
93
94Overview
95
96This GRClib is a higher level interface to the GRC module and provides
97various fill and blit routines. The syslib is intended to offer a more
98convenient API to the M2MC hardware (that is, the blitter engine).
99
100
101API Summary
102
103o Initialization
104  - BGRClib_Open............Opens the syslib
105  - BGRClib_Close...........Closes the syslib
106
107o Callback specification
108  - BGRClib_SetCallback.....Sets the callback and param to be used when
109                            callback is requested
110
111o Basic operations
112  - BGRClib_Fill............Simple fill
113  - BGRClib_Copy............Simple copy of one surface to another
114
115o Porter-Duff operations
116  - BGRClib_PorterDuffBlit..Performs blit according to Porter-Duff operator
117  - BGRClib_PorterDuffFill..Performs fill according to Porter-Duff operator
118
119o Extended Fill
120  - BGRClib_BlendedFill.....Allows selection of fill channel (alpha or color) and option
121                            of blending fill color with surface and of modifying alpha
122
123o Fully flexible blit
124  - BGRClib_Blit............Blit provides various blending options, including color
125                            conversion
126
127
128Definition: STANDARD COLOR FORMAT
129o The term "standard color format" refers to a 32bit color value such that when
130  the color format of the related surface is ARGB, then the "standard color
131  format" refers to the BPXL_eA8_R8_G8_B8 format; when color format of the
132  related surface is AYCbCr, then the "standard color format" refers to the
133  format is BPXL_eA8_Y8_Cb8_Cr8. When the color format of the related surface
134  is less than a byte in size, then the high-bits of the low-byte contains the
135  constant color.
136
137Design
138
139This GRClib does not attempt to change the execution or threading model
140of the GRC module. This syslib supports both blocking (synchronous) and
141non-blocking (asychronous) usage, in the same manner that the GRC module
142provides both the BGRC_IssueStateAndWait and the BGRC_IssueState routines.
143The BGRClib_SetCallback() routine is used to set the callback is used for
144all callbacks from this syslib.
145
146All routines use Magnum types as parameters; no encapsulated types are introduced.
147
148If multiple threads are calling GRClib, then the application must serialize
149these calls.
150
151Although the GRClib attempts to provide all fill and blit operations that might
152be needed by an application, the GRClib does not "own" the GRC_Handle (which
153was created by the GRC module). The application is permitted to call the GRC
154module directly, but must complete any operations (that is, call BGRC_IssueState
155or BGRC_IssueStateAndWait) before calling any routines in the this syslib. Also,
156calls into GRC module must be serialize with the calls into GRClib.
157
158Notes
159
160If multiple M2MC blocks are used by the application, then it is the responsibility
161of the application to synchronize operations between the M2MC blocks, if
162necessary.
163
164The GRClib does not validate all of the parameters against the requested operation,
165especially in the BGRClib_Blit() routine, due to the large number of possible
166combinations supported. Accordingly, some blit requests may have unexpected results
167if passed inconsistent parameters, while others might return errors from the GRC module.
168
169Symbols
170
171  Ca: constant alpha
172  Cc: constant color
173  Sa: source pixel alpha
174  Sc: source pixel color
175  Da: destination pixel alpha
176  Dc: destination pixel color
177  Pa: output pixel alpha
178  Pc: output pixel color
179
180</verbatim>
181***************************************************************************/
182
183#ifndef BGRCLIB_H__
184#define BGRCLIB_H__
185
186#include "bstd.h"
187#include "berr.h"
188#include "bgrc.h"
189#include "bpxl.h"
190#if GRCPACKET_SUPPORT
191#include "bgrc_packet.h"
192#endif
193
194#ifdef __cplusplus
195extern "C" {
196#endif
197
198
199/*****************************************************************************
200 * Enums
201 *****************************************************************************/
202
203/*****************************************************************************
204  Summary:
205    Color Format Type
206
207  Description:
208    This enum is used to identify the color format of any constant color
209    parameters. The color format could be the standard color format (see above)
210    or it could be the same color as an associated surface (for a fill, for
211    example).
212
213  See Also:
214    BGRClib_Fill, BGRClib_BlendedFill
215 *****************************************************************************/
216typedef enum
217{
218    BGRClib_ColorFmtType_eSameAsSurf = 0,   /* The associated color parameter has the same format as
219                                               a related surface. */
220    BGRClib_ColorFmtType_eStdFormat         /* The associated color parameter has the standard color
221                                               format. (See definition, above) */
222} BGRClib_ColorFmtType;
223
224
225/*****************************************************************************
226  Summary:
227    Pending Specification
228
229  Description:
230    This specifies whether the routine should block (by using BGRC_IssueStateAndWait)
231    or not block (by using BGRC_IssueState).
232
233  See Also:
234    BGRClib_SetCallback, BGRClib_Fill, BGRClib_BlendedFill, etc
235 *****************************************************************************/
236typedef enum
237{
238    BGRClib_PendType_eBlock = 0,       /* Block until the call completes by using BGRC_IssueStateAndWait*/
239    BGRClib_PendType_eNoBlockNoCB,     /* Do not block and do not use callback registered with GRClib */
240    BGRClib_PendType_eNoBlockUseCB     /* Do not block. Use the callback registered with GRClib */
241} BGRClib_PendType;
242
243
244/*****************************************************************************
245  Summary:
246    Fill operations available to BGRClib_Blended_Fill
247
248  Description:
249    Options available for manipulating the color or alpha channel with
250    BGRClib_Blended_Fill
251
252  See Also:
253    BGRClib_Blended_Fill
254 *****************************************************************************/
255typedef enum
256{
257    BGRCLib_FillOp_eIgnore = 0,         /* Do not change the values for the channel (either color or alpha)
258                                           Pc = Sc; Pa = Sa */
259    BGRCLib_FillOp_eCopy,               /* Copy the value of the channel (color or alpha) from the constant
260                                           color to the surface: Pc = Cc; Pa = Ca */
261    BGRCLib_FillOp_eBlend               /* For color channel, blend surface color with constant color using
262                                           constant alpha. For alpha channel, combine constant alpha with source alpha.
263                                           Pc = Ca*Cc + (1-Ca)*Sc; Pa = Ca*Ca + (1-Ca)*Sa */
264} BGRCLib_FillOp;
265
266/*****************************************************************************
267  Summary:
268    PorterDuff Operations
269
270  Description:
271    This enum lists the 12 Porter-Duff operations that can be performed
272    between two surfaces.
273
274
275  See Also:
276    BGRClib_PorterDuffBlit and BGRClib_PorterDuffFill
277 *****************************************************************************/
278typedef enum
279{
280    BGRCLib_PorterDuffOp_eClear = 0,   /* Erase output  */
281    BGRCLib_PorterDuffOp_eSrc,         /* Copy source to output */
282    BGRCLib_PorterDuffOp_eDst,         /* Copy dest to output */
283    BGRCLib_PorterDuffOp_eSrcOver,     /* Source over dest */
284    BGRCLib_PorterDuffOp_eDstOver,     /* Dest over source */
285    BGRCLib_PorterDuffOp_eSrcIn,       /* Part of source within dest */
286    BGRCLib_PorterDuffOp_eDstIn,       /* Part of dest within source */
287    BGRCLib_PorterDuffOp_eSrcOut,      /* Part of source not in dest */
288    BGRCLib_PorterDuffOp_eDstOut,      /* Part of dest not in source */
289    BGRCLib_PorterDuffOp_eSrcAtop,     /* Part of source in dest and remainder is dest */
290    BGRCLib_PorterDuffOp_eDstAtop,     /* Part of dest in source and remainder is source */
291    BGRCLib_PorterDuffOp_eXor,         /* Part of src not in dest and part of dest not in source */
292
293    BGRCLib_PorterDuffOp_Count
294} BGRCLib_PorterDuffOp;
295
296/*****************************************************************************
297  Summary:
298    Color operations available in blit
299
300  Description:
301
302    Note that alpha values are always relative to the source and should be
303    between 0x00 and 0xFF. Therefore alpha of 0xFF means take all of the source
304    and of the destination. Likewise alpha of 0x00 means take none of source color,
305    all of the destination color.
306
307  See Also:
308    BGRClib_Blit
309 *****************************************************************************/
310typedef enum
311{
312    BGRCLib_BlitColorOp_eCopySource = 0,            /* Select the source color. Pc = Sc */
313    BGRCLib_BlitColorOp_eUseConstantAlpha,          /* Blend the source and dest colors using the alpha from the constant param
314                                                       Pc = Ca*Sc + (1-Ca)*Dc */
315    BGRCLib_BlitColorOp_eUseSourceAlpha,            /* Blend the source and dest colors using the alpha from the source pixels
316                                                       Pc = Sa*Sc + (1-Sa)*Dc */
317    BGRCLib_BlitColorOp_eUseDestAlpha,              /* Blend the source and dest colors using the alpha from the dest pixels
318                                                       Pc = Da*Sc + (1-Da)*Dc */
319    BGRCLib_BlitColorOp_eSelectPaletteWithColorkey, /* Combine two palettized surfaces using colorkey to select per pixel.
320                                                       Use the colorKeyLower and colorKeyUpper fields of BGRClib_BlitParams
321                                                       Pc = Sc (Note: this is the same as _eCopySource) */
322    BGRCLib_BlitColorOp_eModulate,                  /* [DEPRECATED] use _eUseSourceAlpha instead  */
323    BGRCLib_BlitColorOp_eAdd,                       /* Adds source and destination color (i.e., Pc = Sc + Dc). This can be used for
324                                                       brightening and over-saturation effects */
325    BGRCLib_BlitColorOp_eUseBlendFactors,           /* Use blend factors specified in BGRClib_BlitParams.colorBlend */
326
327    BGRCLib_BlitColorOp_Count
328} BGRCLib_BlitColorOp;
329
330
331/*****************************************************************************
332  Summary:
333    Alpha operations available in blit
334
335  Description:
336    This enum lists the operations that are available on the alpha channel.
337
338  See Also:
339    BGRClib_Blit
340 *****************************************************************************/
341typedef enum
342{
343    BGRCLib_BlitAlphaOp_eCopySource = 0,
344    BGRCLib_BlitAlphaOp_eUseConstAlpha,             /* Copy the constant parameter for the output alpha (Pa = Ca) */
345    BGRCLib_BlitAlphaOp_eUseSourceAlpha,            /* Use the source alpha for the output alpha (Pa = Sa) */
346    BGRCLib_BlitAlphaOp_eUseDestAlpha,              /* Use the dest alpha for the output alpha (Pa = Da) */
347    BGRCLib_BlitAlphaOp_eUseCombinedAlpha,          /* Combine source and dest alpha. (Pa = Sa*Sa + Da*(1-Sa) */
348    BGRCLib_BlitAlphaOp_eEmulateTransparentVideo,   /* Calculate alpha values so that video window, when placed behind the
349                                                       graphics window, appears to be in front of the graphics, with an
350                                                       alpha of Ca. (Pa = 1 - (1-Sa)*Ca) */
351    BGRCLib_BlitAlphaOp_eModulate,                  /* [DEPRECATED] use _eUseSourceAlpha instead */
352    BGRCLib_BlitAlphaOp_eAdd,                       /* Adds source and destionation alpha (Pa = Sa + Da) */
353    BGRCLib_BlitAlphaOp_eUseBlendFactors,           /* Use blend factors specified in BGRClib_BlitParams.alphaBlend */
354
355    BGRCLib_BlitAlphaOp_Count
356} BGRCLib_BlitAlphaOp;
357
358/*****************************************************************************
359 * Structures
360 *****************************************************************************/
361
362/*****************************************************************************
363  Summary:
364    Rectangle type
365
366  Description:
367    Rectangle.
368
369  See Also:
370    BGRClib_Open
371 *****************************************************************************/
372typedef struct
373{
374    int32_t top;
375    int32_t left;
376    int32_t bottom;
377    int32_t right;
378
379} BRect;
380
381/*****************************************************************************
382  Summary:
383    GRC Blending Equation
384
385  Description:
386    This structure exposes the blending equation used by the GRC during blits.
387
388  See Also:
389    BGRClib_Blit
390 *****************************************************************************/
391typedef struct
392{
393    /* Blend: a*b +/- b*c +/- e*/
394    BGRC_Blend_Source a;
395    BGRC_Blend_Source b;
396    bool              subcd;
397    BGRC_Blend_Source c;
398    BGRC_Blend_Source d;
399    bool              sube;
400    BGRC_Blend_Source e;
401} BGRClib_BlendEquation;
402
403/*****************************************************************************
404  Summary:
405    Param block for blit routine
406
407  Description:
408    The param block provides all of the parameters for the generic blit function.
409
410  See Also:
411    BGRClib_Blit
412 *****************************************************************************/
413typedef struct
414{
415    BSUR_Surface_Handle*    srcSurfaceList;  /*  [in] A surface handle list. May be NULL */
416    uint32_t                srcSurfaceCnt;
417    const BRect*            srcRectList;     /*  [in] Source area of blit. NULL indicates entire surface. */
418    uint32_t                srcRectCnt;
419
420    BSUR_Surface_Handle*    dstSurfaceList;  /*  [in] A surface handle. May be NULL */
421    uint32_t                dstSurfaceCnt;
422    const BRect*            dstRectList;     /*  [in] Destination area of blit. NULL indicates entire surface. */
423    uint32_t                dstRectCnt;
424
425    BSUR_Surface_Handle*    outSurfaceList;  /*  [in] A surface handle. Required. */
426    uint32_t                outSurfaceCnt;
427    const BRect*            outRectList;     /*  [in] Output area of blit. NULL indicates entire surface. */
428    uint32_t                outRectCnt;
429
430    BGRCLib_BlitColorOp     colorOp;         /*  [in] Selection of color blending equation */
431    BGRCLib_BlitAlphaOp     alphaOp;         /*  [in] Selection of alpha blending equation */
432    BGRClib_BlendEquation   colorBlend;      /*  [in] Color blending equation (see bgrc.h:BGRC_Blend_SetColorBlend). Used when colorOp==_eUseBlendFactor.
433                                                 [out] Otherwise, this data is popoluted with color equation used according to the colorOp */
434    BGRClib_BlendEquation   alphaBlend;      /*  [in] Alpha blending equation (see bgrc.h:BGRC_Blend_SetAlphaBlend). Used when alphaOp==_eUseBlendFactor.
435                                                 [out] Otherwise, this data is popoluted with alpha equation used according to the alphaOp */
436
437    uint32_t                constantColor;   /*  [in] Constant alpha and color. Only standard color format supported. Used by some operations */
438    uint32_t                destContColor;   /*  [in] Destination constant alpha and color */
439
440    BGRC_Output_ColorKeySelection colorKeySelect; /* [in] Select which block provides pixels to output.
441                                                      For operations which compute new pixel values, the blend block should be used.
442                                                      For operations with palette surfaces, the source is typically the block to be used;
443                                                      unless destination colorkeys is enabled, then the destination block should be used. */
444
445    /* Filter to use for scaling */
446    BGRC_FilterCoeffs       horzFilter;      /* [in] See BGRC_FilterCoeffs and BGRC_Source_SetFilterCoeffs in bgrc.h */
447    BGRC_FilterCoeffs       vertFilter;      /* [in] See BGRC_FilterCoeffs and BGRC_Source_SetFilterCoeffs in bgrc.h */
448
449    /* Blit Reversal Flags */
450    bool                    mirrorSrcVertically;
451    bool                    mirrorSrcHorizontally;
452    bool                    mirrorDstVertically;
453    bool                    mirrorDstHorizontally;
454    bool                    mirrorOutVertically;
455    bool                    mirrorOutHorizontally;
456
457    bool                    srcAlphaPremult;    /* Enable/Disable Source Alpha Premultiplication */
458
459} BGRClib_BlitParams;
460
461
462/*****************************************************************************
463  Summary:
464    Color Conversion Matrix Param block for blit routine
465
466  Description:
467    The param block provides optional color conversion matrix parameters for
468    the generic blit function.
469
470  See Also:
471    BGRClib_Blit
472 *****************************************************************************/
473typedef struct
474{
475    /* Source Color Conversion Matrix */
476    int32_t*                conversionMatrix;/* Color conversion matrix. NULL indicates no matrix provided. */
477    uint32_t                matrixShift;     /* Matrix shift value. See BGRC_Source_SetColorMatrix5x4() for more info */
478
479} BGRClib_BlitMatrixParams;
480
481/*****************************************************************************
482  Summary:
483    Color key Param block for blit routine
484
485  Description:
486    The param block provides optional color key parameters for the generic
487    blit function.
488
489  See Also:
490    BGRClib_Blit
491 *****************************************************************************/
492typedef struct
493{
494
495    bool                    enableColorKey;  /*  [in] Enable colorkeying on the source surface */
496    uint32_t                colorKeyLower;   /*  [in] Lower colorkey value. Only standard color format supported. */
497    uint32_t                colorKeyUpper;   /*  [in] Upper colorkey value. Only standard color format supported. */
498    uint32_t                colorKeyMask;    /*  [in] Mask to use when comparing color key to source color */
499    uint32_t                colorKeyReplace; /*  [in] Replacement color */
500    uint32_t                colorKeyRplMask; /*  [in] Mask for replacement color */
501
502    bool                    enableDstColorKey;  /*  [in] Enable colorkeying on the source surface */
503    uint32_t                dstColorKeyLower;   /*  [in] Lower colorkey value. Only standard color format supported. */
504    uint32_t                dstColorKeyUpper;   /*  [in] Upper colorkey value. Only standard color format supported. */
505    uint32_t                dstColorKeyMask;    /*  [in] Mask to use when comparing color key to source color */
506    uint32_t                dstColorKeyReplace; /*  [in] Replacement color */
507    uint32_t                dstColorKeyRplMask; /*  [in] Mask for replacement color */
508
509    BGRC_Output_ColorKeySelection   cksOnlySrcColorKeyed;
510    BGRC_Output_ColorKeySelection   cksOnlyDstColorKeyed;
511    BGRC_Output_ColorKeySelection   cksBothSrcDstColorKeyed;
512
513} BGRClib_BlitColorKeyParams;
514
515/*****************************************************************************
516  Summary:
517    Pattern (raster operations) Param block for blit routine
518
519  Description:
520    The param block provides all of the parameters for the generic blit function.
521
522  See Also:
523    BGRClib_Blit
524 *****************************************************************************/
525typedef struct
526{
527        uint8_t  ropVector;       /* [in] 8 bit ROP vector. */
528        uint8_t* pattern;         /* [in] 8x8 bit ROP pattern. */
529        uint32_t backColor;       /* [in] ROP background color. */
530        uint32_t foreColor;       /* [in] ROP foreground color. */
531
532} BGRClib_BlitPatternParams;
533
534/*****************************************************************************
535  Summary:
536    Additional Scaling Control Param block for blit routine
537
538  Description:
539    The param block provides additional scaling control parameters for the
540    generic blit function.
541
542  See Also:
543    BGRClib_Blit
544    BGRC_Source_SetFilterPhaseAdjustment
545    BGRC_Source_SetFixedScaleFactor
546 *****************************************************************************/
547typedef struct
548{
549        /* See BGRC_Source_SetFilterPhaseAdjustment */
550    bool     setFilterPhaseAdj;         /* [in] true: Set the filter phase adjustment */
551        int32_t  iHorizontalPhase;          /* [in] Horizontal initial phase. */
552        int32_t  iVerticalPhase;            /* [in] Vertical initial phase. */
553        uint32_t ulPhaseFixedPointShift;    /* [in] Fixed-point shift, in bits, to allow for fractional values. */
554
555        /* BGRC_Source_SetFixedScaleFactor */
556    bool     setFixedScaleFactor;       /* [in] true: Set the fixed scale factor */
557        uint32_t ulHorizontalNumerator;     /* [in] Horizontal/Source numerator */
558        uint32_t ulHorizontalDenominator;   /* [in] Horizontal/Source denominator */
559        uint32_t ulVerticalNumerator;       /* [in] Vertical/Output numerator */
560        uint32_t ulVerticalDenominator;     /* [in] Vertical/Output denominator */
561
562} BGRClib_BlitScalingControlParams;
563
564/*****************************************************************************
565  Summary:
566    Handle for BGRClib module
567
568  Description:
569    The BGRClib_Handle, once opened, represents the state of the BGRClib
570    module.
571
572  See Also:
573    BGRClib_Open
574 *****************************************************************************/
575typedef struct BGRClib_P_Data_tag* BGRClib_Handle;
576
577
578/*****************************************************************************
579 * Public API
580 *****************************************************************************/
581
582
583/*****************************************************************************
584  Summary:
585    Initialize the BGRClib module
586
587  Description:
588    This module intializes the BGRClib module.
589
590  Returns:
591    BERR_SUCCESS              - The handle was successfully created.
592    BERR_INVALID_PARAMETER    - One of the supplied parameters was invalid,
593                                possibly NULL.
594    BERR_OUT_OF_SYSTEM_MEMORY - Memory allocation failed.
595
596  See Also:
597    BGRClib_Close
598 *****************************************************************************/
599BERR_Code BGRClib_Open(
600    BGRClib_Handle*  pgrclibHandle, /* [out] A pointer to an allocated BGRClib_Handle */
601    BGRC_Handle      grcHandle      /*  [in] An initialized BGRC module handle. */
602#if GRCPACKET_SUPPORT
603    ,
604    BGRC_PacketContext_Handle packetContext
605#endif
606);
607
608
609/*****************************************************************************
610  Summary:
611    Close a BGRClib_Handle.
612
613  Description:
614    This function frees the BGRClib_Handle structure and all associated data.
615
616 *****************************************************************************/
617void BGRClib_Close(
618    BGRClib_Handle grclibHandle /* [in] A valid BGRClib_Handle object */
619);
620
621
622/*****************************************************************************
623  Summary:
624    Reset the state.
625
626  Description:
627    This function resets the state of the GRC module and resets all
628    state info being tracked by GRClib.
629
630    This MUST be called any time GRC is used outside of GRClib
631
632 *****************************************************************************/
633BERR_Code BGRClib_ResetState(
634    BGRClib_Handle grclibHandle /* [in] A valid BGRClib_Handle object */
635);
636
637#if !GRCPACKET_SUPPORT
638/*****************************************************************************
639  Summary:
640    Specify callback params.
641
642  Description:
643    This function sets the callback params for all callbacks.
644
645 *****************************************************************************/
646void BGRClib_SetCallback(
647    BGRClib_Handle grclibHandle,    /* [in] A valid BGRClib_Handle object */
648    BGRC_Callback  callback_isr,    /* [in] Pointer to completion callback. */
649    void*          callback_data
650);
651#endif
652
653#if GRCPACKET_SUPPORT
654BERR_Code BGRClib_Sync(
655        BGRClib_Handle grclib
656);
657
658BERR_Code BGRClib_Idle(
659        BGRClib_Handle grclib,
660        bool *pIdle
661);
662
663BERR_Code BGRClib_Memset32(
664        BGRClib_Handle grclib,
665        uint32_t offset,
666        uint32_t data,
667        uint32_t count,
668        BGRClib_PendType pendtype
669);
670
671BERR_Code BGRClib_Destripe_Blit(
672        BGRClib_Handle grclib,
673        BSUR_Surface_Handle outSurface,
674        const BRect *pOutRect,
675        uint32_t lumaOffset,
676        uint32_t chromaOffset,
677        uint32_t pitch,
678        uint32_t width,
679        uint32_t height,
680        uint32_t stripeWidth,
681        uint32_t lumaStripeHeight,
682        uint32_t chromaStripeHeight,
683        const int32_t colorMatrix[],
684        uint32_t matrixShift,
685        BGRClib_PendType pendtype
686);
687
688BERR_Code BGRClib_Batch_Blit(
689        BGRClib_Handle grclib,
690        BSUR_Surface_Handle outSurface,
691        const uint32_t *pOutOffsets,
692        const uint16_t *pOutPoints,
693        const uint16_t *pOutSizes,
694        BSUR_Surface_Handle srcSurface,
695        const uint32_t *pSrcOffsets,
696        const uint16_t *pSrcPoints,
697        const uint16_t *pSrcSizes,
698        BSUR_Surface_Handle dstSurface,
699        const uint32_t *pDstOffsets,
700        const uint16_t *pDstPoints,
701        const uint32_t *pColors,
702        uint32_t count,
703        uint32_t *index,
704        BGRClib_PendType pendtype
705);
706#endif
707
708/*****************************************************************************
709  Summary:
710    Fill a rectangular area of a surface
711
712  Description:
713    This routine fills an area of a surface with the specified color. The
714    color may be in the standard color format (see definitions, above) or
715    may match the format of the surface.
716
717  Returns:
718    BERR_SUCCESS                 - The surface fill completed.
719    BERR_INVALID_PARAMETER       - One of the supplied parameters was invalid,
720                                   possibly NULL.
721    BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out
722
723  See Also:
724    BGRClib_ColorFmtType
725 *****************************************************************************/
726BERR_Code BGRClib_Fill(
727    BGRClib_Handle          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
728    BSUR_Surface_Handle     surface,         /*  [in] A surface handle */
729    uint32_t                constantcolor,   /*  [in] Color, either in color format of the surface */
730                                             /*       or in the standard color format */
731    BGRClib_ColorFmtType    fmtType,         /*  [in] Helps identify the format of the color param.  */
732                                             /*       standard color format (see definitions, above) */
733    const BRect*            pRect,           /*  [in] Pointer to a rect specifying the part of a */
734                                             /*       surface to fill, or NULL to fill the entire surface */
735    BGRClib_PendType        pendtype         /*  [in] Specifies if operation should pend (i.e., use */
736                                             /*       BGRC_IssueStateAndWait), or should return immediately */
737                                             /*       (i.e., use BGRC_IssueState) */
738
739);
740
741
742/*****************************************************************************
743  Summary:
744    Copy one surface to another
745
746  Description:
747    This routine copies an area of the source surface an area of the output
748    surface. No color space conversion or color keying is performed. If the
749    source surface is palette-based and the output surface is not
750    paletted-based, then the palette entries in the source pixels will be
751    converted to colors in the output pixels
752
753  Returns:
754    BERR_SUCCESS                 - The surface fill completed.
755    BERR_INVALID_PARAMETER       - One of the supplied parameters was invalid,
756                                   possibly NULL.
757    BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out
758
759  See Also:
760
761 *****************************************************************************/
762BERR_Code BGRClib_Copy(
763    BGRClib_Handle          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
764    BSUR_Surface_Handle     srcSurface,      /*  [in] A surface handle */
765    const BRect*            pSrcRect,        /*  [in] Pointer to a rect specifying the part of a */
766                                             /*       surface to fill, or NULL to fill the entire surface */
767    BSUR_Surface_Handle     outSurface,      /*  [in] A surface handle */
768    const BRect*            pOutRect,        /*  [in] Pointer to a rect specifying the part of a */
769                                             /*       surface to fill, or NULL to fill the entire surface */
770    BGRClib_PendType        pendtype         /*  [in] Specifies if operation should pend or not */
771
772);
773
774
775/*****************************************************************************
776  Summary:
777    Fill, tint or otherwise modify the pixels of an
778    area of a surface using a constant value
779
780  Description:
781    This routine modifies the color channels and/or the alpha channel of the
782    pixels of a surface using a constant value
783
784  Returns:
785    BERR_SUCCESS                 - The surface fill completed.
786    BERR_INVALID_PARAMETER       - One of the supplied parameters was invalid,
787                                   possibly NULL.
788    BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out
789
790  See Also:
791
792 *****************************************************************************/
793BERR_Code BGRClib_Blended_Fill(
794    BGRClib_Handle          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
795    BSUR_Surface_Handle     surface,         /*  [in] A surface handle */
796    uint32_t                constantColor,   /*  [in] Color, either in C3C2C3C1 format */
797                                             /*       or the specified format */
798    BGRClib_ColorFmtType    fmtType,         /*  [in] Helps identify the format of the color param.  */
799                                             /*       standard color format (see definitions, above) */
800    const BRect*            pRect,           /*  [in] Pointer to a rect specifying the part of a */
801                                             /*       surface to fill, or NULL to fill the entire surface */
802    BGRCLib_FillOp          colorOp,         /*  [in] Color operation */
803    BGRCLib_FillOp          alphaOp,         /*  [in] Alpha operation */
804    BGRClib_PendType        pendtype         /*  [in] Specifies if operation should pend or not */
805);
806
807
808/*****************************************************************************
809  Summary:
810    Fill, tint or otherwise modify the pixels of an
811    area of a surface using a constant value and Porter-Duff composition rules.
812
813  Description:
814    This routine modifies the color channels and/or the alpha channel of the
815    pixels of a surface using a constant value and Porter-Duff composition rules.
816
817  Returns:
818    BERR_SUCCESS                 - The surface fill completed.
819    BERR_INVALID_PARAMETER       - One of the supplied parameters was invalid,
820                                   possibly NULL.
821    BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out
822
823  See Also:
824
825 *****************************************************************************/
826BERR_Code BGRClib_PorterDuffFill(
827    BGRClib_Handle          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
828    BGRCLib_PorterDuffOp    pdOp,            /*  [in] A Porter-Duff operation */
829    BSUR_Surface_Handle     surface,         /*  [in] A surface handle */
830    uint32_t                constantColor,   /*  [in] Color, either in C3C2C3C1 format */
831                                             /*       or the specified format */
832    BGRClib_ColorFmtType    fmtType,         /*  [in] Helps identify the format of the color param.  */
833                                             /*       standard color format (see definitions, above) */
834    const BRect*            pRect,           /*  [in] Pointer to a rect specifying the part of a */
835                                             /*       surface to fill, or NULL to fill the entire surface */
836    BGRClib_PendType        pendtype         /*  [in] Specifies if operation should pend or not */
837);
838
839
840/*****************************************************************************
841  Summary:
842    Combine two surfaces into a third using Porter-Duff composition rules
843
844  Description:
845    This routine combines an area of the source surface and an area of the
846    destination surface into an area of the output surface using Porter-Duff
847    composition rules. No color space conversion or color keying is performed.
848
849    If the source surface is palette-based and the output surface is not
850    paletted-based, then the palette entries in the source pixels will be
851    converted to colors in the output pixels
852
853  Returns:
854    BERR_SUCCESS                 - The surface fill completed.
855    BERR_INVALID_PARAMETER       - One of the supplied parameters was invalid,
856                                   possibly NULL.
857    BGRC_ERR_M2MC_DEVICE_IS_HUNG - M2MC device timed-out
858
859  See Also:
860
861 *****************************************************************************/
862BERR_Code BGRClib_PorterDuffBlit(
863    BGRClib_Handle          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
864    BGRCLib_PorterDuffOp    pdOp,            /*  [in] A Porter-Duff operation */
865
866    BSUR_Surface_Handle     srcSurface,      /*  [in] A surface handle */
867    const BRect*            pSrcRect,        /*  [in] Pointer to a rect specifying the part of a */
868                                             /*       surface to fill, or NULL to fill the entire surface */
869    BSUR_Surface_Handle     dstSurface,      /*  [in] A surface handle */
870    const BRect*            pDstRect,        /*  [in] Pointer to a rect specifying the part of a */
871                                             /*       surface to fill, or NULL to fill the entire surface */
872    BSUR_Surface_Handle     outSurface,      /*  [in] A surface handle */
873    const BRect*            pOutRect,        /*  [in] Pointer to a rect specifying the part of a */
874                                             /*       surface to fill, or NULL to fill the entire surface */
875    BGRClib_PendType        pendtype         /*  [in] Specifies if operation should pend or not */
876
877);
878
879
880/*****************************************************************************
881  Summary:
882    Populate param block with default values
883
884  Description:
885    Set-up the blit param block for typical values for performing a blit
886    on non-palette surfaces
887
888  See Also:
889    BGRClib_Blit
890    BGRClib_GetDefaultPaletteBlitParams
891 *****************************************************************************/
892void BGRClib_GetDefaultBlitParams(
893    BGRClib_BlitParams *params
894);
895
896
897/*****************************************************************************
898  Summary:
899    Populate param block with default values for Palette blits
900
901  Description:
902    Set-up the blit param block for typical values for performaing a blit on
903    palette surfaces. The important differences are that a point sample filter
904    is used and the source block is selected instead of the blend block.
905
906  See Also:
907    BGRClib_Blit
908    BGRClib_GetDefaultBlitParams
909 *****************************************************************************/
910void BGRClib_GetDefaultPaletteBlitParams(
911    BGRClib_BlitParams *params
912);
913
914
915/*****************************************************************************
916  Summary:
917    Populate colorkey param block with default values
918
919  Description:
920    Set-up the colorkey blit param block for typical values for performing a
921    colorkey operation. The main purpose of this is to set-up the
922    colorkey selection parameters.
923
924  See Also:
925    BGRClib_Blit
926 *****************************************************************************/
927void BGRClib_GetDefaultColorKeyParams(
928    BGRClib_BlitColorKeyParams *colorkeyparams
929);
930
931
932/*****************************************************************************
933  Summary:
934    Populate scaling control param block with default values
935
936  Description:
937    Set-up the scaling control param block for initial values.
938
939  See Also:
940    BGRClib_Blit
941 *****************************************************************************/
942void BGRClib_GetDefaultScalingControlParams(
943    BGRClib_BlitScalingControlParams *scalingparams
944);
945
946/*****************************************************************************
947  Summary:
948    Get color blend factors
949
950  Description:
951    Gets blend factors according to BGRCLib_BlitColorOp
952
953  See Also:
954    BGRClib_Blit
955 *****************************************************************************/
956BERR_Code BGRClib_GetColorBlendFactors(
957    BGRCLib_BlitColorOp colorOp,
958    BGRClib_BlendEquation* factors);
959
960
961/*****************************************************************************
962  Summary:
963    Get alpha blend factors
964
965  Description:
966    Gets blends factors according to BGRCLib_BlitAlphaOp
967
968  See Also:
969    BGRClib_Blit
970 *****************************************************************************/
971BERR_Code BGRClib_GetAlphaBlendFactors(
972    BGRCLib_BlitAlphaOp alphaOp,
973    BGRClib_BlendEquation* factors);
974
975
976/*****************************************************************************
977  Summary:
978    Get Porter-Duff blend factors
979
980  Description:
981    Gets blend factors used for Porter-Duff blits
982
983  See Also:
984    BGRClib_Blit
985 *****************************************************************************/
986BERR_Code BGRClib_GetPorterDuffBlendFactors(
987    BGRCLib_PorterDuffOp pdOp,
988    BGRClib_BlendEquation* colorFactors,
989    BGRClib_BlendEquation* alphaFactors);
990
991
992/*****************************************************************************
993  Summary:
994    Blit operation
995
996  Description:
997
998
999  See Also:
1000    BGRClib_Blit
1001 *****************************************************************************/
1002BERR_Code BGRClib_Blit(
1003    BGRClib_Handle                          grclibHandle,    /*  [in] A valid BGRClib_Handle object */
1004    const BGRClib_BlitParams*               params,          /*  [in] General blit parameters */
1005    const BGRClib_BlitColorKeyParams*       colorkeyParams,  /*  [in] Optional colorkey parameters. Use NULL if not using colorkeying */
1006    const BGRClib_BlitMatrixParams*         matrixParams,    /*  [in] Optional color conversion matrix parameters. Use NULL if not using color matrix */
1007    const BGRClib_BlitPatternParams*        patternParams,   /*  [in] Optional (ROP) pattern parameters. Use NULL if not using pattern block */
1008    const BGRClib_BlitScalingControlParams* scalingParams,   /*  [in] Optional scaling control parameters. Use NULL for default scaling behavior. */
1009    BGRClib_PendType                        pendtype         /*  [in] Specifies if operation should pend or not */
1010);
1011
1012
1013
1014#ifdef __cplusplus
1015}
1016#endif
1017
1018#endif /* BGRCLIB_H__ */
Note: See TracBrowser for help on using the repository browser.