Re: Unsupported format for CGBitmapContextCreate
- Subject: Re: Unsupported format for CGBitmapContextCreate
- From: "Felipe Monteiro de Carvalho" <email@hidden>
- Date: Fri, 1 Jun 2007 16:19:33 +0200
- Delivered-to: email@hidden
- Delivered-to: email@hidden
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oXQ+UsLOcvmSDceAb3NglaoQt31yzQQyT0e/2L+eRG+JDZKUhJsz1iO6MbFbrtzYuKBk2wDRTjLQMJJ6BSj/T6FOdIZ15v6ypV132jJO4SPJsIVWzIH9pcfbESk76KcymIaOPlglTSeqFjQ60KDV5tCtLkcQP/PiZsTJ7nxu5ck=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dR3BwpwO08UcFLcE4bgG+UAWRFz7ZETQznGnih7CYRGVL7SeR8xmuNsI5NHO2U/cvNNta4QKklSiInNEF4ra1pidz3KNIjUGYRiZe1Qp4uVjWGqMJLNy8/jlgg/aHnxLSijwTRbsbp8vpeK5+cyRVMSkvasIJiU2+rg0DJV9Jkg=
Hi,
I am trying to use CGBitmapContextCreate to create a context for a raw
image, but I get this error message:
CGBitmapContextCreate: unsupported parameter combination: 8 integer
bits/component; 32 bits/pixel; 3-component colorspace;
kCGImageAlphaFirst.
Here is how I create my color space
constructor TLCLBackend.Create;
var
loc: CMProfileLocation;
status: OSStatus;
begin
inherited;
........
{ Creates a generic color profile }
loc.locType := cmPathBasedProfile;
loc.u.pathLoc.path := STR_GenericRGBProfilePath;
status := CMOpenProfile(FProfile, loc);
if status <> noErr then raise Exception.Create('Couldn''t create the
generic profile');
{ Creates a generic color space }
FColorSpace := CGColorSpaceCreateWithPlatformColorSpace(FProfile);
if FColorSpace = nil then raise Exception.Create('Couldn''t create
the generic RGB color space');
end;
And how I finally use it to create the bitmap:
procedure TLCLBackend.InitializeSurface(NewWidth, NewHeight: Integer;
ClearBuffer: Boolean);
begin
{ We allocate our own memory for the image }
Stride := NewWidth * 4;
FBits := System.GetMem(NewHeight * Stride);
if FBits = nil then
raise Exception.Create('Can''t allocate memory for the DIB');
FContext := CGBitmapContextCreate(FBits,
NewWidth, NewHeight, 8, Stride, FColorSpace, kCGImageAlphaFirst or
kCGBitmapByteOrder32Little);
if FContext = nil then raise Exception.Create('Couldn''t create the
device context');
{ clear the image }
if ClearBuffer then
FillLongword(FBits[0], NewWidth * NewHeight, clBlack32);
end;
Any ideas about what is wrong? i looked at CGBitmapContextCreate's
docs here, but they say that it supports 32-bits images with 8 bits
per channel:
http://developer.apple.com/documentation/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/doc/c_ref/CGBitmapInfo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.