ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 function IERGB2CMYK has a mistake ?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
klausdoege Posted - Aug 24 2011 : 14:07:11
Hello,
a part of the function IERGB2CMYK looks so.

function IERGB2CMYK(const rgb: TRGB,: TCMYK;
var......
begin
.....
result.y:=255 - cmyk16.y shr 8;
result.k:=255 - cmyk16.k shr 8;
end
else
with rgb, result do
begin
k := imax(r, imax(g, b));
if k = 0 then
k :=1;
C := r * 255 div k;
M := g * 255 div k;
Y := b * 255 div k;
end;
end;

Then IERGB2CMYK(0,0,0) --> CMYK(0,0,0,1)
that is certain wrong i think.
I believe better, this function is, can maybe your that alters.

function IERGB2CMYK(const rgb: TRGB,: TCMYK;
var..........
begin
..................
result.y:=255 - cmyk16.y shr 8;
result.k:=255 - cmyk16.k shr 8;
end
else
with rgb, result do,
begin
k := imax(r, imax(g, b));
if k = 0 then
begin
C:=255;
M:=255;
Y:=255;
end
else
begin
C := r * 255 div k;
M := g * 255 div k;
Y := b * 255 div k;
end;
end;
end;

many greetings
Klaus


Klaus
1   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Aug 26 2011 : 02:11:14
Hello,
you're right and it will be fixed in next minor release.

Anyway I suggest to leave iegUseCMYKProfile=true, to have more accurate conversion.

Many thanks for your fix!