Alpha Blending in Memory Contexts

bridged with qdn.public.qnxrtp.photon
Post Reply
Stuart Harding

Alpha Blending in Memory Contexts

Post by Stuart Harding » Mon Sep 15, 2003 5:35 am

Hi everyone.

I'm having trouble with alpha blending while drawing to a memory
context. The alpha belnding works when drawing to a raw widget, but
when I switch to a memory context, the alpha blending seems not to work.
A snippet of the code follows. Any suggestions?

Thanks,
Stuart Harding

void myRawDraw( PtWidget_t *widget, PhTile_t *damage ) {
PhPoint_t centre1 = {50,50};
PhPoint_t radius1 = {30,30};
PhPoint_t centre2 = {50,60};
PhPoint_t radius2 = {30,30};
PhPoint_t zero_point = {0,0};
PhImage_t *image;
PmMemoryContext_t *mc;
PhDim_t dimensions = {100, 100};
PhPoint_t translation = {0, 0};

PtSuperClassDraw( PtBasic, widget, damage );

image = PhCreateImage(NULL, 100, 100,
Pg_IMAGE_DIRECT_888, NULL, 0 ,0);

mc = PmMemCreateMC(image, &dimensions, &translation);
PmMemStart(mc);

PgSetFillColor(Pg_RED);
PgDrawEllipse(&centre1, &radius1, Pg_DRAW_FILL);

PgSetAlphaBlend(NULL, 0xb0);
PgAlphaOn();
PgSetFillColor(Pg_YELLOW);
PgDrawEllipse(&centre2, &radius2, Pg_DRAW_FILL);
PgAlphaOff();

PmMemFlush( mc, image ); // get the image
PmMemStop( mc );
// now all drawing goes to the default drawing context
PmMemReleaseMC( mc );

PgDrawPhImage(&zero_point, image, NULL);
}

Post Reply

Return to “qdn.public.qnxrtp.photon”