<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
List *delSpaces(List *p) {
while (p && p->c == ' ')
{
p = p->next;
}
struct L *head = p;
struct L *prev = p;
p = p->next;
while (p)
{
if (p->c == ' ')
{
prev->next = p->next;
}
else
{
prev = p;
}
p = p->next;
}
return head;
}
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[]) {
const NSUInteger WIDTH = 100;
const NSUInteger HEIGHT = 200;
const NSUInteger COMPONENTS_PER_PIXEL = 4;
const NSUInteger BITS_PER_COMPONENT = 8;
const NSUInteger BUFFER_LENGTH = WIDTH * HEIGHT * COMPONENTS_PER_PIXEL;
char *buffer = (char *) malloc(BUFFER_LENGTH);
for (NSUInteger i = 0; i < BUFFER_LENGTH; i += 4) {
buffer[i + 0] = 0x00;
buffer[i + 1] = 0x00;
buffer[i + 2] = 0xFF;
buffer[i + 3] = 0xFF;
}
CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, buffer, BUFFER_LENGTH, NULL);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGImageRef image = CGImageCreate(WIDTH, HEIGHT, BITS_PER_COMPONENT, BITS_PER_COMPONENT * COMPONENTS_PER_PIXEL, COMPONENTS_PER_PIXEL * WIDTH, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaLast, dataProvider, NULL, false, kCGRenderingIntentDefault);
NSString *filePath = @"~/test.png";
NSURL *url = [NSURL fileURLWithPath:[filePath stringByExpandingTildeInPath]];
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithURL((__bridge CFURLRef) url, kUTTypePNG, 1, NULL);
CGImageDestinationAddImage(imageDestination, image, NULL);
CGImageDestinationFinalize(imageDestination);
CGImageRelease(image);
CGColorSpaceRelease(colorSpace);
CGDataProviderRelease(dataProvider);
free(buffer);
return 0;
}
NSWindowsCP1251StringEncoding
+ stringWithUTF8String: