Ejemplo n.º 1
0
bool N64BlenderT::Blend2Cycle(UINT32* fr, UINT32* fg, UINT32* fb, int dith, int adseed, int partialreject, int special_bsel0, int special_bsel1, rdp_span_aux *userdata, const rdp_poly_state& object)
{
	if (!object.OtherModes.alpha_cvg_select)
	{
		DitherA(&userdata->PixelColor.i.a, adseed);
	}

	DitherA(&userdata->ShadeColor.i.a, adseed);

	if (!AlphaCompare(userdata->PixelColor.i.a, userdata, object))
	{
		return false;
	}

	if (object.OtherModes.antialias_en ? (!userdata->CurrentPixCvg) : (!userdata->CurrentCvgBit))
	{
		return false;
	}

	userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[0];

	INT32 r, g, b;
	BlendEquationCycle0(&r, &g, &b, special_bsel0, userdata, object);

	userdata->BlendedPixelColor.i.r = r;
	userdata->BlendedPixelColor.i.g = g;
	userdata->BlendedPixelColor.i.b = b;
	userdata->BlendedPixelColor.i.a = userdata->PixelColor.i.a;

	bool dontblend = (partialreject && userdata->PixelColor.i.a >= 0xff);
	if (!userdata->BlendEnable || dontblend)
	{
		r = *userdata->ColorInputs.blender1a_r[1];
		g = *userdata->ColorInputs.blender1a_g[1];
		b = *userdata->ColorInputs.blender1a_b[1];
	}
	else
	{
		userdata->InvPixelColor.i.a = 0xff - *userdata->ColorInputs.blender1b_a[1];
		BlendEquationCycle1(&r, &g, &b, special_bsel1, userdata, object);
	}

	if (object.OtherModes.rgb_dither_sel < 3)
	{
		DitherRGB(&r, &g, &b, dith);
	}

	*fr = r;
	*fg = g;
	*fb = b;

	return true;
}
Ejemplo n.º 2
0
static void cdj_block()
{
    int i,byteoff,j;
    int cntc,cntm,cnty,cc,mm,yy;
    UCHAR cbuf[1024],mbuf[1024],ybuf[1024],v;
    LPUCHAR p,pc,pm,py,pk;
    LPDC lpdc=&SysDc;

    if(fDither) DitherRGB(lpdc);    // dither RGB to CMYK

    for (i=lpdc->top;i<lpdc->bottom && i<printer->ypixel;i++)
    {
       if(fDither && i<=MaxRastY)
       {
         byteoff =(i-lpdc->top)*RastWidthByte;
         cc = mm = yy = RastWidthByte;
         pc = rasts[0]+byteoff;
         pm = rasts[1]+byteoff;
         py = rasts[2]+byteoff;
         pk = rasts[3]+byteoff;
         for (j=0;j<cc;j++) {
             v = pk[j];
             pc[j] |= v;
             pm[j] |= v;
             py[j] |= v;
         }
         p = rasts[0]+byteoff;
         while (cc>0&&p[cc-1]==0) cc--;
         if (cc>0) cntc = RLEcompress((ULONG *)p,(ULONG *)(p+cc),cbuf);
         else cntc=0;

         p = rasts[1]+byteoff;
         while (mm>0&&p[mm-1]==0) mm--;
         if (mm>0) {
               cntm = RLEcompress((ULONG *)p,(ULONG *)(p+mm),mbuf);
         }
         else cntm=0;

         p = rasts[2]+byteoff;
         while (yy>0&&p[yy-1]==0) yy--;
         if (yy>0) {
                cnty = RLEcompress((ULONG *)p,(ULONG *)(p+yy),ybuf);
         }

         else cnty=0;
         if (cc==0&&mm==0&&yy==0) {
             blanklines++;
             continue;
         }

         for(;blanklines;blanklines--) {
              fputs("\033*bW",prnstr);
         }

         fprintf(prnstr, "\033*b%dV", cntc);     //cyan
         fwrite(cbuf,1,cntc,prnstr);

         fprintf(prnstr, "\033*b%dV", cntm);    //magenta
         fwrite(mbuf,1,cntm,prnstr);

         fprintf(prnstr, "\033*b%dW", cnty);     //yellow
         fwrite(ybuf,1,cnty,prnstr);
      } else blanklines++;
    } /*--- i ---*/

   /*-----------------
    for(;blanklines;blanklines--) {
              fputs("\033*bW",prnstr);
    }
    -------*/
    memset(rasts[4],0xff,RastSize);        // clear RGB buffer
} /* cdj_block */