Swift returns 'UInt32' is not convertible to 'CGImage'
I got this error message based on code below:
Error message
/Users/MNurdin/Documents/iOS/XXXXX/HAHA.swift:534:38: 'UInt32' is not convertible to 'CGImage'
My code
let context : CGContextRef = CGBitmapContextCreate(nil, CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage),
CGImageGetBitsPerComponent(image.CGImage),
CGImageGetBytesPerRow(image.CGImage),
CGImageGetColorSpace(image.CGImage),
CGImageGetBitmapInfo(UInt32(image.CGImage)).rawValue)!;
CGContextConcatCTM(context, transform);
ios swift
add a comment |
I got this error message based on code below:
Error message
/Users/MNurdin/Documents/iOS/XXXXX/HAHA.swift:534:38: 'UInt32' is not convertible to 'CGImage'
My code
let context : CGContextRef = CGBitmapContextCreate(nil, CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage),
CGImageGetBitsPerComponent(image.CGImage),
CGImageGetBytesPerRow(image.CGImage),
CGImageGetColorSpace(image.CGImage),
CGImageGetBitmapInfo(UInt32(image.CGImage)).rawValue)!;
CGContextConcatCTM(context, transform);
ios swift
add a comment |
I got this error message based on code below:
Error message
/Users/MNurdin/Documents/iOS/XXXXX/HAHA.swift:534:38: 'UInt32' is not convertible to 'CGImage'
My code
let context : CGContextRef = CGBitmapContextCreate(nil, CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage),
CGImageGetBitsPerComponent(image.CGImage),
CGImageGetBytesPerRow(image.CGImage),
CGImageGetColorSpace(image.CGImage),
CGImageGetBitmapInfo(UInt32(image.CGImage)).rawValue)!;
CGContextConcatCTM(context, transform);
ios swift
I got this error message based on code below:
Error message
/Users/MNurdin/Documents/iOS/XXXXX/HAHA.swift:534:38: 'UInt32' is not convertible to 'CGImage'
My code
let context : CGContextRef = CGBitmapContextCreate(nil, CGImageGetWidth(image.CGImage), CGImageGetHeight(image.CGImage),
CGImageGetBitsPerComponent(image.CGImage),
CGImageGetBytesPerRow(image.CGImage),
CGImageGetColorSpace(image.CGImage),
CGImageGetBitmapInfo(UInt32(image.CGImage)).rawValue)!;
CGContextConcatCTM(context, transform);
ios swift
ios swift
edited Jan 19 at 23:15
halfer
14.5k758111
14.5k758111
asked Sep 10 '15 at 9:18
Mohammad NurdinMohammad Nurdin
12.5k3193245
12.5k3193245
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
As the error states you are passing a UInt32 to a function which expects a CGImage.
CGImageGetBitmapInfo expects a CGImage as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
add a comment |
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage into a UInt32 before passing it into CGImageGetBitmapInfo. Just pass the CGImage in directly.
CGImageGetBitmapInfo(image.CGImage);
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
add a comment |
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32497832%2fswift-returns-uint32-is-not-convertible-to-cgimage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As the error states you are passing a UInt32 to a function which expects a CGImage.
CGImageGetBitmapInfo expects a CGImage as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
add a comment |
As the error states you are passing a UInt32 to a function which expects a CGImage.
CGImageGetBitmapInfo expects a CGImage as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
add a comment |
As the error states you are passing a UInt32 to a function which expects a CGImage.
CGImageGetBitmapInfo expects a CGImage as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
As the error states you are passing a UInt32 to a function which expects a CGImage.
CGImageGetBitmapInfo expects a CGImage as it's argument and returns CGBitmapInfo
You are probably looking for:
UInt32(CGImageGetBitmapInfo(image.CGImage).rawValue)
answered Sep 10 '15 at 9:28
Midhun MPMidhun MP
62.9k24129175
62.9k24129175
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
add a comment |
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
please check my edited question.
– Mohammad Nurdin
Sep 10 '15 at 9:34
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
@Dato'MohammadNurdin: Still you are using the old way, did you changed that code as mentioned in my answer ?
– Midhun MP
Sep 10 '15 at 9:35
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
I got this error message, 'UInt32' is not convertible to 'CGBitmapInfo'
– Mohammad Nurdin
Sep 10 '15 at 9:46
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
@Dato'MohammadNurdin Remove that UInt32 conversion from above code
– Midhun MP
Sep 10 '15 at 9:51
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
I got 'UInt32' is not convertible to 'CGImage'.
– Mohammad Nurdin
Sep 10 '15 at 10:00
add a comment |
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage into a UInt32 before passing it into CGImageGetBitmapInfo. Just pass the CGImage in directly.
CGImageGetBitmapInfo(image.CGImage);
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
add a comment |
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage into a UInt32 before passing it into CGImageGetBitmapInfo. Just pass the CGImage in directly.
CGImageGetBitmapInfo(image.CGImage);
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
add a comment |
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage into a UInt32 before passing it into CGImageGetBitmapInfo. Just pass the CGImage in directly.
CGImageGetBitmapInfo(image.CGImage);
It's exactly as the error states, you can't convert a number to a CGImage
I'm not sure why you're trying to convert a CGImage into a UInt32 before passing it into CGImageGetBitmapInfo. Just pass the CGImage in directly.
CGImageGetBitmapInfo(image.CGImage);
answered Sep 10 '15 at 9:23
Steve WilfordSteve Wilford
7,03942760
7,03942760
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
add a comment |
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
2
2
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
I got 'UInt32' is not convertible to 'CGBitmapInfo'.
– Mohammad Nurdin
Sep 10 '15 at 9:26
add a comment |
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
add a comment |
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
add a comment |
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
Raw value is returning UInt32 so try:
CGImageGetBitmapInfo(image.CGImage).rawValue
answered Sep 21 '15 at 15:00
gattshjotygattshjoty
33937
33937
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32497832%2fswift-returns-uint32-is-not-convertible-to-cgimage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown