OSDN Git Service

ソースの文字コードと改行コードを修正
[coroid/inqubus.git] / vhook / comment / shadow.c
index ae54544..c859d80 100644 (file)
-#include <SDL/SDL.h>\r
-#include "surf_util.h"\r
-#include "shadow.h"\r
-\r
-/*\89e\82È\82µ*/\r
-SDL_Surface* noShadow(SDL_Surface* surf,int is_black,int is_fix_size){\r
-       return surf;\r
-}\r
-/*\89E\89º*/\r
-#define SHADOW_SIZE 3\r
-\r
-SDL_Surface* likeNicoNico(SDL_Surface* surf,int is_black,int is_fix_size){\r
-       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
-       int slide = SHADOW_SIZE;\r
-       if(is_fix_size){\r
-               slide <<= 1;\r
-       }\r
-       int w = surf->w;\r
-       int h = surf->h;\r
-       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
-                                                                                               w+(slide<<1),\r
-                                                                                               h+(slide<<1),\r
-                                                                                               32,\r
-                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
-                                                                                                   0xff000000,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x000000ff\r
-                                                                                               #else\r
-                                                                                                   0x000000ff,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0xff000000\r
-                                                                                               #endif\r
-                                                                                       );\r
-       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
-                                                                                               w+(slide<<1),\r
-                                                                                               h+(slide<<1),\r
-                                                                                               32,\r
-                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
-                                                                                                   0xff000000,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x000000ff\r
-                                                                                               #else\r
-                                                                                                   0x000000ff,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0xff000000\r
-                                                                                               #endif\r
-                                                                                       );\r
-       SDL_Rect rect = {slide,slide};\r
-       SDL_SetAlpha(surf,0,0xff);\r
-       SDL_BlitSurface(surf,NULL,shadow,&rect);\r
-       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
-       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
-               setRGB(shadow,0xffffffff);\r
-       }else{\r
-               setRGB(shadow,0);\r
-       }\r
-       SDL_SetAlpha(shadow,0,0xff);\r
-       SDL_BlitSurface(shadow,NULL,shadow2,NULL);\r
-       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);\r
-       int x,y,z;\r
-       int nw = shadow->w;\r
-       int nh = shadow->h;\r
-       int *pix;\r
-       int *pix2;\r
-       int pitch = shadow->pitch;\r
-       int bps = shadow->format->BytesPerPixel;\r
-       Uint32 Amask = shadow->format->Amask;\r
-       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);\r
-       Uint32 Ashift = shadow->format->Ashift;\r
-       Uint32 Aloss = shadow->format->Aloss;\r
-       SDL_LockSurface(shadow);\r
-       SDL_LockSurface(shadow2);\r
-       //\82±\82±\82Í\8bô\90\94\82É\82·\82é\82±\82Æ\81B\r
-       int zmax = 10;\r
-       if(is_fix_size){\r
-               zmax = 16;\r
-       }\r
-       SDL_Surface* tmp;\r
-       for(z=0;z<zmax;z++){\r
-               char *pixels = (char*)shadow->pixels;\r
-               char *pixels2 = (char*)shadow2->pixels;\r
-               for(y=0;y<nh;y++){\r
-                       pix = (int*)(&pixels[pitch * y]);\r
-                       pix2 = (int*)(&pixels2[pitch * y]);\r
-                       for(x=0;x<nw;x++){\r
-                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));\r
-                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));\r
-                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));\r
-                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));\r
-                               int my = *pix2;\r
-                               int new_alpha = (((((my & Amask) >> Ashift) << Aloss) +(((right & Amask) >> Ashift) << Aloss)+(((left & Amask) >> Ashift) << Aloss)+(((up & Amask) >> Ashift) << Aloss)+(((down & Amask) >> Ashift) << Aloss)) / 5) & 0xff;\r
-                               new_alpha = (new_alpha * 18) >> 4;\r
-                               if(new_alpha > 0xff){\r
-                                       new_alpha = 0xff;\r
-                               }\r
-                               *pix2 &= Mask;\r
-                               *pix2 |= ((new_alpha >> Aloss) << Ashift) & Amask;\r
-                               pix = (int*)(((char*)pix)+bps);\r
-                               pix2 = (int*)(((char*)pix2)+bps);\r
-                       }\r
-               }\r
-               tmp = shadow2;\r
-               shadow2 = shadow;\r
-               shadow = tmp;\r
-       }\r
-       SDL_UnlockSurface(shadow);\r
-       SDL_UnlockSurface(shadow2);\r
-       shadowBlitSurface(surf,NULL,shadow,&rect);\r
-       SDL_FreeSurface(surf);\r
-       SDL_FreeSurface(shadow2);\r
-       return shadow;\r
-}\r
-\r
-/*\89E\89º*/\r
-#define SHADOW_SLIDE 2\r
-SDL_Surface* likeNovel(SDL_Surface* surf,int is_black,int is_fix_size){\r
-       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
-       int slide = SHADOW_SLIDE;\r
-       if(is_fix_size){\r
-               slide <<= 1;\r
-       }\r
-       /*\8d\95\82Ì\97p\88Ó*/\r
-       SDL_Surface* black = SDL_CreateRGBSurface(      SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
-                                                                                               surf->w+slide,\r
-                                                                                               surf->h+slide,\r
-                                                                                               32,\r
-                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
-                                                                                                   0xff000000,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x000000ff\r
-                                                                                               #else\r
-                                                                                                   0x000000ff,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0xff000000\r
-                                                                                               #endif\r
-                                                                                               );\r
-       SDL_Rect rect = {slide,slide};\r
-       SDL_SetAlpha(surf,0,0xff);//\88ê\89ñalpha\8d\87\90¬\82ð\90Ø\82é\r
-       SDL_BlitSurface(surf,NULL,black,&rect);\r
-       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
-       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
-               setRGB(black,0xffffffff);\r
-       }else{\r
-               setRGB(black,0);\r
-       }\r
-       setAlpha(black,0.6f);\r
-       shadowBlitSurface(surf,NULL,black,NULL);\r
-       SDL_FreeSurface(surf);\r
-       return black;\r
-}\r
-\r
-//\8eU\82ç\82·\82Ì\82Å\82Í\82È\82­\81A\88Í\82Á\82Ä\82µ\82Ü\82¤\81B\r
-SDL_Surface* likeOld(SDL_Surface* surf,int is_black,int is_fix_size){\r
-       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
-       int slide = SHADOW_SIZE;\r
-       if(is_fix_size){\r
-               slide <<= 1;\r
-       }\r
-       int w = surf->w;\r
-       int h = surf->h;\r
-       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
-                                                                                               w+(slide<<1),\r
-                                                                                               h+(slide<<1),\r
-                                                                                               32,\r
-                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
-                                                                                                   0xff000000,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x000000ff\r
-                                                                                               #else\r
-                                                                                                   0x000000ff,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0xff000000\r
-                                                                                               #endif\r
-                                                                                       );\r
-       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
-                                                                                               w+(slide<<1),\r
-                                                                                               h+(slide<<1),\r
-                                                                                               32,\r
-                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
-                                                                                                   0xff000000,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x000000ff\r
-                                                                                               #else\r
-                                                                                                   0x000000ff,\r
-                                                                                                   0x0000ff00,\r
-                                                                                                   0x00ff0000,\r
-                                                                                                   0xff000000\r
-                                                                                               #endif\r
-                                                                                       );\r
-       SDL_Rect rect = {slide,slide};\r
-       SDL_SetAlpha(surf,0,0xff);\r
-       SDL_BlitSurface(surf,NULL,shadow,&rect);\r
-       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
-       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
-               setRGB(shadow,0xffffffff);\r
-       }else{\r
-               setRGB(shadow,0);\r
-       }\r
-       SDL_SetAlpha(shadow,0,0xff);\r
-       SDL_BlitSurface(shadow,NULL,shadow2,NULL);\r
-       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);\r
-       int x,y,z;\r
-       int nw = shadow->w;\r
-       int nh = shadow->h;\r
-       int *pix;\r
-       int *pix2;\r
-       int pitch = shadow->pitch;\r
-       int bps = shadow->format->BytesPerPixel;\r
-       Uint32 Amask = shadow->format->Amask;\r
-       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);\r
-       Uint32 Ashift = shadow->format->Ashift;\r
-       Uint32 Aloss = shadow->format->Aloss;\r
-       SDL_Surface* tmp;\r
-       SDL_LockSurface(shadow);\r
-       SDL_LockSurface(shadow2);\r
-       int zmax = 1;\r
-       if(is_fix_size){\r
-               zmax = 2;\r
-       }\r
-       for(z=0;z<zmax;z++){\r
-               char *pixels = (char*)shadow->pixels;\r
-               char *pixels2 = (char*)shadow2->pixels;\r
-               for(y=0;y<nh;y++){\r
-                       pix = (int*)(&pixels[pitch * y]);\r
-                       pix2 = (int*)(&pixels2[pitch * y]);\r
-                       for(x=0;x<nw;x++){\r
-                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));\r
-                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));\r
-                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));\r
-                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));\r
-                               int my = *pix2;\r
-                               //\8eü\82è\82ª\8bó\94\92\82Å\82È\82¢\r
-                               if(((right | left | up | down | my) & Amask) != 0){\r
-                                       *pix2 &= Mask;\r
-                                       *pix2 |= (((0xff/(z+1)) >> Aloss) << Ashift) & Amask;\r
-                               }\r
-                               pix = (int*)(((char*)pix)+bps);\r
-                               pix2 = (int*)(((char*)pix2)+bps);\r
-                       }\r
-               }\r
-               tmp = shadow2;\r
-               shadow2 = shadow;\r
-               shadow = tmp;\r
-       }\r
-       SDL_UnlockSurface(shadow);\r
-       SDL_UnlockSurface(shadow2);\r
-       shadowBlitSurface(surf,NULL,shadow,&rect);\r
-       SDL_FreeSurface(surf);\r
-       SDL_FreeSurface(shadow2);\r
-       return shadow;\r
-}\r
-\r
-\r
-//\92è\8b`\r
-SDL_Surface* (*ShadowFunc[SHADOW_MAX])(SDL_Surface* surf,int is_black,int is_fix_size) = {\r
-       noShadow,\r
-       likeNicoNico,\r
-       likeNovel,\r
-       likeOld\r
-};\r
+#include <SDL/SDL.h>
+#include "surf_util.h"
+#include "shadow.h"
+
+/*影なし*/
+SDL_Surface* noShadow(SDL_Surface* surf,int is_black,int is_fix_size){
+       return surf;
+}
+/*右下*/
+#define SHADOW_SIZE 3
+
+SDL_Surface* likeNicoNico(SDL_Surface* surf,int is_black,int is_fix_size){
+       /*スライド幅の確定*/
+       int slide = SHADOW_SIZE;
+       if(is_fix_size){
+               slide <<= 1;
+       }
+       int w = surf->w;
+       int h = surf->h;
+       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,
+                                                                                               w+(slide<<1),
+                                                                                               h+(slide<<1),
+                                                                                               32,
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+                                                                                                   0xff000000,
+                                                                                                   0x00ff0000,
+                                                                                                   0x0000ff00,
+                                                                                                   0x000000ff
+                                                                                               #else
+                                                                                                   0x000000ff,
+                                                                                                   0x0000ff00,
+                                                                                                   0x00ff0000,
+                                                                                                   0xff000000
+                                                                                               #endif
+                                                                                       );
+       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,
+                                                                                               w+(slide<<1),
+                                                                                               h+(slide<<1),
+                                                                                               32,
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+                                                                                                   0xff000000,
+                                                                                                   0x00ff0000,
+                                                                                                   0x0000ff00,
+                                                                                                   0x000000ff
+                                                                                               #else
+                                                                                                   0x000000ff,
+                                                                                                   0x0000ff00,
+                                                                                                   0x00ff0000,
+                                                                                                   0xff000000
+                                                                                               #endif
+                                                                                       );
+       SDL_Rect rect = {slide,slide};
+       SDL_SetAlpha(surf,0,0xff);
+       SDL_BlitSurface(surf,NULL,shadow,&rect);
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);
+       if(is_black){//黒であれば、周りをしろで囲む
+               setRGB(shadow,0xffffffff);
+       }else{
+               setRGB(shadow,0);
+       }
+       SDL_SetAlpha(shadow,0,0xff);
+       SDL_BlitSurface(shadow,NULL,shadow2,NULL);
+       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);
+       int x,y,z;
+       int nw = shadow->w;
+       int nh = shadow->h;
+       int *pix;
+       int *pix2;
+       int pitch = shadow->pitch;
+       int bps = shadow->format->BytesPerPixel;
+       Uint32 Amask = shadow->format->Amask;
+       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);
+       Uint32 Ashift = shadow->format->Ashift;
+       Uint32 Aloss = shadow->format->Aloss;
+       SDL_LockSurface(shadow);
+       SDL_LockSurface(shadow2);
+       //ここは偶数にすること。
+       int zmax = 10;
+       if(is_fix_size){
+               zmax = 16;
+       }
+       SDL_Surface* tmp;
+       for(z=0;z<zmax;z++){
+               char *pixels = (char*)shadow->pixels;
+               char *pixels2 = (char*)shadow2->pixels;
+               for(y=0;y<nh;y++){
+                       pix = (int*)(&pixels[pitch * y]);
+                       pix2 = (int*)(&pixels2[pitch * y]);
+                       for(x=0;x<nw;x++){
+                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));
+                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));
+                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));
+                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));
+                               int my = *pix2;
+                               int new_alpha = (((((my & Amask) >> Ashift) << Aloss) +(((right & Amask) >> Ashift) << Aloss)+(((left & Amask) >> Ashift) << Aloss)+(((up & Amask) >> Ashift) << Aloss)+(((down & Amask) >> Ashift) << Aloss)) / 5) & 0xff;
+                               new_alpha = (new_alpha * 18) >> 4;
+                               if(new_alpha > 0xff){
+                                       new_alpha = 0xff;
+                               }
+                               *pix2 &= Mask;
+                               *pix2 |= ((new_alpha >> Aloss) << Ashift) & Amask;
+                               pix = (int*)(((char*)pix)+bps);
+                               pix2 = (int*)(((char*)pix2)+bps);
+                       }
+               }
+               tmp = shadow2;
+               shadow2 = shadow;
+               shadow = tmp;
+       }
+       SDL_UnlockSurface(shadow);
+       SDL_UnlockSurface(shadow2);
+       shadowBlitSurface(surf,NULL,shadow,&rect);
+       SDL_FreeSurface(surf);
+       SDL_FreeSurface(shadow2);
+       return shadow;
+}
+
+/*右下*/
+#define SHADOW_SLIDE 2
+SDL_Surface* likeNovel(SDL_Surface* surf,int is_black,int is_fix_size){
+       /*スライド幅の確定*/
+       int slide = SHADOW_SLIDE;
+       if(is_fix_size){
+               slide <<= 1;
+       }
+       /*黒の用意*/
+       SDL_Surface* black = SDL_CreateRGBSurface(      SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,
+                                                                                               surf->w+slide,
+                                                                                               surf->h+slide,
+                                                                                               32,
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+                                                                                                   0xff000000,
+                                                                                                   0x00ff0000,
+                                                                                                   0x0000ff00,
+                                                                                                   0x000000ff
+                                                                                               #else
+                                                                                                   0x000000ff,
+                                                                                                   0x0000ff00,
+                                                                                                   0x00ff0000,
+                                                                                                   0xff000000
+                                                                                               #endif
+                                                                                               );
+       SDL_Rect rect = {slide,slide};
+       SDL_SetAlpha(surf,0,0xff);//一回alpha合成を切る
+       SDL_BlitSurface(surf,NULL,black,&rect);
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);
+       if(is_black){//黒であれば、周りをしろで囲む
+               setRGB(black,0xffffffff);
+       }else{
+               setRGB(black,0);
+       }
+       setAlpha(black,0.6f);
+       shadowBlitSurface(surf,NULL,black,NULL);
+       SDL_FreeSurface(surf);
+       return black;
+}
+
+//散らすのではなく、囲ってしまう。
+SDL_Surface* likeOld(SDL_Surface* surf,int is_black,int is_fix_size){
+       /*スライド幅の確定*/
+       int slide = SHADOW_SIZE;
+       if(is_fix_size){
+               slide <<= 1;
+       }
+       int w = surf->w;
+       int h = surf->h;
+       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,
+                                                                                               w+(slide<<1),
+                                                                                               h+(slide<<1),
+                                                                                               32,
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+                                                                                                   0xff000000,
+                                                                                                   0x00ff0000,
+                                                                                                   0x0000ff00,
+                                                                                                   0x000000ff
+                                                                                               #else
+                                                                                                   0x000000ff,
+                                                                                                   0x0000ff00,
+                                                                                                   0x00ff0000,
+                                                                                                   0xff000000
+                                                                                               #endif
+                                                                                       );
+       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,
+                                                                                               w+(slide<<1),
+                                                                                               h+(slide<<1),
+                                                                                               32,
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+                                                                                                   0xff000000,
+                                                                                                   0x00ff0000,
+                                                                                                   0x0000ff00,
+                                                                                                   0x000000ff
+                                                                                               #else
+                                                                                                   0x000000ff,
+                                                                                                   0x0000ff00,
+                                                                                                   0x00ff0000,
+                                                                                                   0xff000000
+                                                                                               #endif
+                                                                                       );
+       SDL_Rect rect = {slide,slide};
+       SDL_SetAlpha(surf,0,0xff);
+       SDL_BlitSurface(surf,NULL,shadow,&rect);
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);
+       if(is_black){//黒であれば、周りをしろで囲む
+               setRGB(shadow,0xffffffff);
+       }else{
+               setRGB(shadow,0);
+       }
+       SDL_SetAlpha(shadow,0,0xff);
+       SDL_BlitSurface(shadow,NULL,shadow2,NULL);
+       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);
+       int x,y,z;
+       int nw = shadow->w;
+       int nh = shadow->h;
+       int *pix;
+       int *pix2;
+       int pitch = shadow->pitch;
+       int bps = shadow->format->BytesPerPixel;
+       Uint32 Amask = shadow->format->Amask;
+       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);
+       Uint32 Ashift = shadow->format->Ashift;
+       Uint32 Aloss = shadow->format->Aloss;
+       SDL_Surface* tmp;
+       SDL_LockSurface(shadow);
+       SDL_LockSurface(shadow2);
+       int zmax = 1;
+       if(is_fix_size){
+               zmax = 2;
+       }
+       for(z=0;z<zmax;z++){
+               char *pixels = (char*)shadow->pixels;
+               char *pixels2 = (char*)shadow2->pixels;
+               for(y=0;y<nh;y++){
+                       pix = (int*)(&pixels[pitch * y]);
+                       pix2 = (int*)(&pixels2[pitch * y]);
+                       for(x=0;x<nw;x++){
+                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));
+                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));
+                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));
+                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));
+                               int my = *pix2;
+                               //周りが空白でない
+                               if(((right | left | up | down | my) & Amask) != 0){
+                                       *pix2 &= Mask;
+                                       *pix2 |= (((0xff/(z+1)) >> Aloss) << Ashift) & Amask;
+                               }
+                               pix = (int*)(((char*)pix)+bps);
+                               pix2 = (int*)(((char*)pix2)+bps);
+                       }
+               }
+               tmp = shadow2;
+               shadow2 = shadow;
+               shadow = tmp;
+       }
+       SDL_UnlockSurface(shadow);
+       SDL_UnlockSurface(shadow2);
+       shadowBlitSurface(surf,NULL,shadow,&rect);
+       SDL_FreeSurface(surf);
+       SDL_FreeSurface(shadow2);
+       return shadow;
+}
+
+
+//定義
+SDL_Surface* (*ShadowFunc[SHADOW_MAX])(SDL_Surface* surf,int is_black,int is_fix_size) = {
+       noShadow,
+       likeNicoNico,
+       likeNovel,
+       likeOld
+};