break; case 2: //左下 x1 = 0; if( (sHeight-wHeight) > 0 ) //源图比水印图高 y1 = sHeight - wHeight; else y1 = sWidth; break; case 3: //右上 y1 = 0; if( (sWidth - wWidth) > 0) // 源图比水印图宽 x1 = sWidth - wWidth; else x1 = sWidth; break; case 4: //右下 //计算高度 if( (sHeight-wHeight) > 0 ) //源图比水印图高 y1 = sHeight - wHeight; else y1 = sWidth; //计算宽度 if( (sWidth - wWidth) > 0) // 源图比水印图宽 x1 = sWidth - wWidth; else x1 = sWidth; break; case 5: //居中 //计算高度 if( (sHeight-wHeight) > 0 ) //源图比水印图高 y1 = (sHeight - wHeight) / 2; else y1 = sWidth; //计算宽度 if( (sWidth - wWidth) > 0) // 源图比水印图宽 x1 = (sWidth - wWidth) / 2; else x1 = sWidth; break; } if( (sHeight-wHeight) > 0) h = wHeight; else h = sHeight; if( (sWidth - wWidth) > 0) w = wWidth; else w = sWidth; } else //源图比水印图小 { |