⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generic.c

📁 DirectFB-1.0.1可用于linux的嵌入式GUI
💻 C
📖 第 1 页 / 共 5 页
字号:
     }}static void Cop_toK_Aop_24( GenefxState *gfxs ){     int   w   = gfxs->length;     u8   *D   = gfxs->Aop[0];     u8    Dkr = (gfxs->Dkey & 0xff0000) >> 16;     u8    Dkg = (gfxs->Dkey & 0x00ff00) >>  8;     u8    Dkb = (gfxs->Dkey & 0x0000ff);     while (w--) {          if (D[0] == Dkb && D[1] == Dkg && D[2] == Dkr) {               D[0] = gfxs->color.b;               D[1] = gfxs->color.g;               D[2] = gfxs->color.r;          }          D += 3;     }}static void Cop_toK_Aop_yuv422( GenefxState *gfxs ){     int    l;     int    w     = gfxs->length;     u16   *D     = gfxs->Aop[0];     u32    Cop   = gfxs->Cop;     u32    Dkey  = gfxs->Dkey;     if ((long)D & 2) {#ifdef WORDS_BIGENDIAN          if (*D == (Dkey & 0xffff))               *D = Cop & 0xffff;#else          if (*D == (Dkey >> 16))               *D = Cop >> 16;#endif          D++;          w--;     }     for (l = w>>1; l--;) {          if (*((u32*)D) == Dkey)               *((u32*)D) = Cop;          D += 2;     }     if (w & 1) {#ifdef WORDS_BIGENDIAN          if (*D == (Dkey >> 16))               *D = Cop >> 16;#else          if (*D == (Dkey & 0xffff))               *D = Cop & 0xffff;#endif     }}static void Cop_toK_Aop_alut44( GenefxState *gfxs ){     int    w    = gfxs->length;     u8    *D    = gfxs->Aop[0];     u32    Cop  = gfxs->Cop;     u32    Dkey = gfxs->Dkey;     while (w--) {          if (Dkey == (*D & 0x0F))               *D = Cop;          D++;     }}static GenefxFunc Cop_toK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {     Cop_toK_Aop_15,          /* DSPF_ARGB1555 */     Cop_toK_Aop_16,          /* DSPF_RGB16 */     Cop_toK_Aop_24,          /* DSPF_RGB24 */     Cop_toK_Aop_32,          /* DSPF_RGB32 */     Cop_toK_Aop_32,          /* DSPF_ARGB */     Cop_toK_Aop_8,           /* DSPF_A8 */     Cop_toK_Aop_yuv422,      /* DSPF_YUY2 */     Cop_toK_Aop_8,           /* DSPF_RGB332 */     Cop_toK_Aop_yuv422,      /* DSPF_UYVY */     NULL,                    /* DSPF_I420 */     NULL,                    /* DSPF_YV12 */     Cop_toK_Aop_8,           /* DSPF_LUT8 */     Cop_toK_Aop_alut44,      /* DSPF_ALUT44 */     Cop_toK_Aop_32,          /* DSPF_AiRGB */     NULL,                    /* DSPF_A1 */     NULL,                    /* DSPF_NV12 */     NULL,                    /* DSPF_NV16 */     Cop_toK_Aop_14,          /* DSPF_ARGB2554 */     Cop_toK_Aop_12,          /* DSPF_ARGB4444 */     NULL,                    /* DSPF_NV21 */     Cop_toK_Aop_32,          /* DSPF_AYUV */     NULL,                    /* DSPF_A4 */     Cop_toK_Aop_18,          /* DSPF_ARGB1666 */     Cop_toK_Aop_18,          /* DSPF_ARGB6666 */     Cop_toK_Aop_18,          /* DSPF_RGB18 */     NULL,                    /* DSPF_LUT2 */     Cop_toK_Aop_12,          /* DSPF_RGB444 */     Cop_toK_Aop_15,          /* DSPF_RGB555 */};/********************************* Bop_PFI_to_Aop_PFI *************************/static void Bop_4_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length>>1 );}static void Bop_8_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );}static void Bop_16_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*2 );}static void Bop_24_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*3 );}static void Bop_32_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*4 );}static void Bop_i420_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );      if (gfxs->AopY & 1) {          direct_memmove( gfxs->Aop[1], gfxs->Bop[1], gfxs->length>>1 );          direct_memmove( gfxs->Aop[2], gfxs->Bop[2], gfxs->length>>1 );     }}             static void Bop_NV_to_Aop( GenefxState *gfxs ){     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1)          direct_memmove( gfxs->Aop[1], gfxs->Bop[1], gfxs->length&~1 );}static GenefxFunc Bop_PFI_to_Aop_PFI[DFB_NUM_PIXELFORMATS] = {     Bop_16_to_Aop,      /* DSPF_ARGB1555 */     Bop_16_to_Aop,      /* DSPF_RGB16 */     Bop_24_to_Aop,      /* DSPF_RGB24 */     Bop_32_to_Aop,      /* DSPF_RGB32 */     Bop_32_to_Aop,      /* DSPF_ARGB */     Bop_8_to_Aop,       /* DSPF_A8 */     Bop_16_to_Aop,      /* DSPF_YUY2 */     Bop_8_to_Aop,       /* DSPF_RGB332 */     Bop_16_to_Aop,      /* DSPF_UYVY */     Bop_i420_to_Aop,    /* DSPF_I420 */     Bop_i420_to_Aop,    /* DSPF_YV12 */     Bop_8_to_Aop,       /* DSPF_LUT8 */     Bop_8_to_Aop,       /* DSPF_ALUT44 */     Bop_32_to_Aop,      /* DSPF_AiRGB */     NULL,               /* DSPF_A1 */     Bop_NV_to_Aop,      /* DSPF_NV12 */     Bop_NV_to_Aop,      /* DSPF_NV16 */     Bop_16_to_Aop,      /* DSPF_ARGB2554 */     Bop_16_to_Aop,      /* DSPF_ARGB4444 */     Bop_NV_to_Aop,      /* DSPF_NV21 */     Bop_32_to_Aop,      /* DSPF_AYUV */     Bop_4_to_Aop,       /* DSPF_A4 */     Bop_24_to_Aop,      /* DSPF_ARGB1666 */     Bop_24_to_Aop,      /* DSPF_ARGB6666 */     Bop_24_to_Aop,      /* DSPF_RGB18 */     NULL,               /* DSPF_LUT2 */     Bop_16_to_Aop,      /* DSPF_RGB444 */     Bop_16_to_Aop,      /* DSPF_RGB555 */};/********************************* Bop_PFI_Kto_Aop_PFI ************************/static void Bop_rgb18_Kto_Aop( GenefxState *gfxs ){     int    w     = gfxs->length;     u8    *D     = gfxs->Aop[0];     u8    *S     = gfxs->Bop[0];     u32    Skey  = gfxs->Skey;     int    Ostep = gfxs->Ostep;     if (Ostep < 0) {          D += (gfxs->length - 1) * 3;          S += (gfxs->length - 1) * 3;     }     while (w--) {          u8 s0 = S[0];          u8 s1 = S[1];          u8 s2 = S[2];          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {               D[0] = s0;               D[1] = s1;               D[2] = s2;          }          S += Ostep * 3;          D += Ostep * 3;     }}static void Bop_rgb24_Kto_Aop( GenefxState *gfxs ){     int    w     = gfxs->length;     u8    *D     = gfxs->Aop[0];     u8    *S     = gfxs->Bop[0];     u32    Skey  = gfxs->Skey;     int    Ostep = gfxs->Ostep;     if (Ostep < 0) {          D += (gfxs->length - 1) * 3;          S += (gfxs->length - 1) * 3;     }     while (w--) {          u8 b = *S;          u8 g = *(S+1);          u8 r = *(S+2);          if (Skey != (u32)(r<<16 | g<<8 | b)) {               *D     = b;               *(D+1) = g;               *(D+2) = r;          }          S += Ostep * 3;          D += Ostep * 3;     }}static void Bop_a8_Kto_Aop( GenefxState *gfxs ){     /* no color to key */     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );}static void Bop_yuv422_Kto_Aop( GenefxState *gfxs ){     int    l;     int    w     = gfxs->length;     u16   *D     = gfxs->Aop[0];     u16   *S     = gfxs->Bop[0];     u32    Skey  = gfxs->Skey;     int    Ostep = gfxs->Ostep;     if (Ostep < 0) {          D += gfxs->length - 1;          S += gfxs->length - 1;     }     if ((long)D & 2) {          u16 s = *S;#ifdef WORDS_BIGENDIAN          if (s != (Skey >> 16))               *D = s;#else          if (s != (Skey & 0xffff))               *D = s;#endif          S += Ostep;          D += Ostep;          w--;     }     if (Ostep < 0) {         S--;         D--;     }     for (l = w>>1; l--;) {          u32 s = *((u32*)S);          if (s != Skey)               *((u32*)D) = s;          S += Ostep << 1;          D += Ostep << 1;     }     if (w & 1) {          u16 s = *S;#ifdef WORDS_BIGENDIAN          if (s != (Skey & 0xffff))               *D = s;#else          if (s != (Skey >> 16))               *D = s;#endif     }}/* change the last value to adjust the size of the device (1-4) */#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 4 )#define SET_PIXEL( D, S )               \     do {                               \          register u32 s = S;           \                                        \          if (s != Skey)                \               D = s;                   \     } while (0)static void Bop_8_Kto_Aop( GenefxState *gfxs ){     int    i;     int    w     = gfxs->length;     u8    *D     = gfxs->Aop[0];     u8    *S     = gfxs->Bop[0];     u32    Skey  = gfxs->Skey;     if (gfxs->Ostep > 0) {          SET_PIXEL_DUFFS_DEVICE( D, S, w );     }     else {          for (i=w-1; i>=0; i--)               if (S[i] != Skey)                    D[i] = S[i];     }}#undef SET_PIXEL_DUFFS_DEVICE#undef SET_PIXELstatic void Bop_alut44_Kto_Aop( GenefxState *gfxs ){     int    w     = gfxs->length;     u8    *D     = gfxs->Aop[0];     u8    *S     = gfxs->Bop[0];     u32    Skey  = gfxs->Skey;     int    Ostep = gfxs->Ostep;     if (Ostep < 0) {          D += gfxs->length - 1;          S += gfxs->length - 1;     }     while (w--) {          u8 spixel = *S;          if ((spixel & 0x0F) != Skey)               *D = spixel;          S += Ostep;          D += Ostep;     }}static GenefxFunc Bop_PFI_Kto_Aop_PFI[DFB_NUM_PIXELFORMATS] = {     Bop_15_Kto_Aop,          /* DSPF_ARGB1555 */     Bop_16_Kto_Aop,          /* DSPF_RGB16 */     Bop_rgb24_Kto_Aop,       /* DSPF_RGB24 */     Bop_32_Kto_Aop,          /* DSPF_RGB32 */     Bop_32_Kto_Aop,          /* DSPF_ARGB */     Bop_a8_Kto_Aop,          /* DSPF_A8 */     Bop_yuv422_Kto_Aop,      /* DSPF_YUY2 */     Bop_8_Kto_Aop,           /* DSPF_RGB332 */     Bop_yuv422_Kto_Aop,      /* DSPF_UYVY */     NULL,                    /* DSPF_I420 */     NULL,                    /* DSPF_YV12 */     Bop_8_Kto_Aop,           /* DSPF_LUT8 */     Bop_alut44_Kto_Aop,      /* DSPF_ALUT44 */     Bop_32_Kto_Aop,          /* DSPF_AiRGB */     NULL,                    /* DSPF_A1 */     NULL,                    /* DSPF_NV12 */     NULL,                    /* DSPF_NV16 */     Bop_14_Kto_Aop,          /* DSPF_ARGB2554 */     Bop_12_Kto_Aop,          /* DSPF_ARGB4444 */     NULL,                    /* DSPF_NV21 */     Bop_32_Kto_Aop,          /* DSPF_AYUV */     NULL,                    /* DSPF_A4 */     Bop_rgb18_Kto_Aop,       /* DSPF_ARGB1666 */     Bop_rgb18_Kto_Aop,       /* DSPF_ARGB6666 */     Bop_rgb18_Kto_Aop,       /* DSPF_RGB18 */     NULL,                    /* DSPF_LUT2 */     Bop_12_Kto_Aop,          /* DSPF_RGB444 */     Bop_15_Kto_Aop,          /* DSPF_RGB555 */};/********************************* Bop_PFI_toK_Aop_PFI ************************/static void Bop_rgb18_toK_Aop( GenefxState *gfxs ){     int    w     = gfxs->length;     u8    *D     = gfxs->Aop[0];     u8    *S     = gfxs->Bop[0];     u32    Dkey  = gfxs->Dkey;     while (w--) {          if (Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {               D[0] = S[0];               D[1] = S[1];               D[2] = S[2];          }          S +=  3;          D +=  3;     }}static void Bop_rgb24_toK_Aop( GenefxState *gfxs ){      int   w    = gfxs->length;      u8   *S    = gfxs->Bop[0];      u8   *D    = gfxs->Aop[0];      u8    Dkr  = (gfxs->Dkey & 0xff0000) >> 16;      u8    Dkg  = (gfxs->Dkey & 0x00ff00) >>  8;      u8    Dkb  = (gfxs->Dkey & 0x0000ff);      while (w--) {           if (D[0] == Dkb && D[1] == Dkg && D[2] == Dkr) {               D[0] = S[0];               D[1] = S[1];               D[2] = S[2];          }          S += 3;          D += 3;     }}static void Bop_yuv422_toK_Aop( GenefxState *gfxs ){     int    l;     int    w     = gfxs->length;     u16   *S     = gfxs->Bop[0];     u16   *D     = gfxs->Aop[0];     u32    Dkey  = gfxs->Dkey;     int    Ostep = gfxs->Ostep;     if (Ostep < 0) {          D += gfxs->length - 1;          S += gfxs->length - 1;     }     if ((long)D & 2) {#ifdef WORDS_BIGENDIAN          if (*D == (Dkey & 0xffff))               *D = *S;#else          if (*D == (Dkey >> 16))               *D = *S;#endif          D += Ostep;          S += Ostep;          w--;     }     if (Ostep < 0) {          S--;          D--;     }     for (l = w>>1; l--;) {          if (*D == Dkey)               *D = *S;          D += Ostep << 1;          S += Ostep << 1;     }     if (w & 1) {#ifdef WORDS_BIGENDIAN          if (*D == (Dkey >> 16))               *D = *S;#else          if (*D == (Dkey & 0xffff))               *D = *S;#endif     }}static void Bop_rgb332_toK_Aop( GenefxState *gfxs ){      int   w    = gfxs->length;      u8   *S    = gfxs->Bop[0];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -