我面临的几个问题与使用iOS9 SDK进行裁剪有关.
我有以下代码来调整图像大小(通过在中间裁剪从4:3转换为16:9).这曾经很好地工作到iOS8 SDK.在iOS 9中,底部区域为空白.
(CMSampleBufferRef)resizeImage:(CMSampleBufferRef) sampleBuffer {
{
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer,0);
int target_width = CVPixelBufferGetWidth(imageBuffer);
int target_height = CVPixelBufferGetHeight(imageBuffer);
int height = CVPixelBufferGetHeight(imageBuffer);
int width = CVPixelBufferGetWidth(imageBuffer);
int x=0, y=0;
// Convert 16:9 to 4:3
if (((target_width*3)/target_height) == 4)
{
target_height = ((target_width*9)/16);
target_height = ((target_height + 15) / 16) * 16;
y = (height - target_height)/2;
}
else
if ((target_width == 352) && (target_height == 288))
{
target_height = ((target_width*9)/16);
target_height = ((target_height + 15) / …Run Code Online (Sandbox Code Playgroud) 我有名字的宏
CONSTANT_1
CONSTANT_2
CONSTANT_3
CONSTANT_4 etc..
Run Code Online (Sandbox Code Playgroud)
我有一个NSString变量从另一个类发送只包含宏名称,如何访问与此NSString匹配的宏变量的内容.
我的NSString变量定义为:
NSString *str=@"CONSTANT_3"
Run Code Online (Sandbox Code Playgroud)