From Gill Peacegood, "In the attached file I have changed the colour space used for writing images to match the one used for reading images. Also this color space does not make subtle changes to the original colours which i think is probably what most people intend when writing an image and is more consistent with other plugins.
The effect is that an image that is written does not have a noticeably different colour when it is read back."
This commit is contained in:
@@ -501,7 +501,8 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image)
|
||||
{
|
||||
bitmap_info = kCGImageAlphaNone;
|
||||
target_bytes_per_row = (image_width * 8 + 7)/8;
|
||||
color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
|
||||
//color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
|
||||
color_space = CGColorSpaceCreateDeviceGray();
|
||||
if(NULL == color_space)
|
||||
{
|
||||
return NULL;
|
||||
@@ -584,8 +585,9 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image)
|
||||
{
|
||||
bitmap_info = kCGImageAlphaNoneSkipFirst;
|
||||
target_bytes_per_row = (image_width * 8 * 4 + 7)/8;
|
||||
color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
if(NULL == color_space)
|
||||
//color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
color_space = CGColorSpaceCreateDeviceRGB();
|
||||
if(NULL == color_space)
|
||||
{
|
||||
OSG_WARN << "In CreateCGImageFromOSGData, CGColorSpaceCreateWithName failed" << std::endl;
|
||||
return NULL;
|
||||
@@ -638,7 +640,8 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image)
|
||||
{
|
||||
bitmap_info = kCGImageAlphaPremultipliedLast;
|
||||
target_bytes_per_row = osg_image.getRowSizeInBytes();
|
||||
color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
//color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
color_space = CGColorSpaceCreateDeviceRGB();
|
||||
if(NULL == color_space)
|
||||
{
|
||||
OSG_WARN << "In CreateCGImageFromOSGData, CGColorSpaceCreateWithName failed" << std::endl;
|
||||
@@ -686,7 +689,8 @@ CGImageRef CreateCGImageFromOSGData(const osg::Image& osg_image)
|
||||
}
|
||||
|
||||
target_bytes_per_row = osg_image.getRowSizeInBytes();
|
||||
color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
//color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
color_space = CGColorSpaceCreateDeviceRGB();
|
||||
if(NULL == color_space)
|
||||
{
|
||||
OSG_WARN << "In CreateCGImageFromOSGData, CGColorSpaceCreateWithName failed" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user