1

CGContextRef次のコードを使用して画像を描画しようとしています:

UIGraphicsBeginImageContextWithOptions(size, false, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
// After getting the context i pass it to a C++ backend by an appropriate wrapper and do some drawing operations.

次に、次のコードを使用して、コンテキストから画像を取得しようとします。

CGImageRef image = [UIGraphicsGetImageFromCurrentImageContext() CGImage];

しかし、これはサイズ (0,0) の画像を返します。

私は画像を取得しようとしました:

CGImageRef image = CGBitmapContextCreateImage(context);

これにより、元のサイズに幅と高さの両方が 3 倍された空白のイメージが返されます。

助言がありますか?

4

0 に答える 0