Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - blend_pixels: (3 Items)
   
blend_pixels  
Hi, All

When I read the ddk , I am little confused by the comments.

void (*blend_pixels)(
        disp_draw_context_t *ctx,
        int x[],
        int y[],
        uint8_t alpha[],
        int npixels );

Pixels are drawn at the coordinates specified by the x and y arrays, using the corresponding values in the alpha array 
as coverage values. The coverage values specify the intensity of the pixel (0xFF is full intensity, 0x00 is no 
intensity) when it is finally written to the destination. If alpha blending is enabled, the coverage value is moderated 
with the source alpha value. Otherwise, the final pixel value is written to the destination with the following blend 
operation:

Pdst - (Pv × coverage) + Pdst × (1 - coverage)


Pdst is from the dst surface.

But What is Pv from?

There is no parameters in functions, and no obvious member in context.


Thanks!
Ivan

RE: blend_pixels  
Hi Ivan,

FYI, there are two, you are looking at the context blend function, but the core blend function is defined as:

void (*blend_pixels)(disp_draw_context_t *ctx, disp_color_t color,
	int x[], int y[], uint8_t alpha[], int npixels);


Anyways, in the context blend function, you obtain the source pixel value (Pv) for the foreground colour:

ctx->fgcolor

-Derek

-----Original Message-----
From: ivan chen [mailto:community-noreply@qnx.com] 
Sent: Wednesday, July 14, 2010 12:32 AM
To: advanced-graphics
Subject: blend_pixels

Hi, All

When I read the ddk , I am little confused by the comments.

void (*blend_pixels)(
        disp_draw_context_t *ctx,
        int x[],
        int y[],
        uint8_t alpha[],
        int npixels );

Pixels are drawn at the coordinates specified by the x and y arrays, using the corresponding values in the alpha array 
as coverage values. The coverage values specify the intensity of the pixel (0xFF is full intensity, 0x00 is no 
intensity) when it is finally written to the destination. If alpha blending is enabled, the coverage value is moderated 
with the source alpha value. Otherwise, the final pixel value is written to the destination with the following blend 
operation:

Pdst - (Pv × coverage) + Pdst × (1 - coverage)


Pdst is from the dst surface.

But What is Pv from?

There is no parameters in functions, and no obvious member in context.


Thanks!
Ivan





_______________________________________________

Advanced Graphics
http://community.qnx.com/sf/go/post59373
Re: RE: blend_pixels  
Derek:

Thanks for your reply! I understand it.

Best regards
Ivan