Click here to Skip to main content
15,883,955 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What wrong with this loop? Pin
CPallini15-Jan-11 2:39
mveCPallini15-Jan-11 2:39 
AnswerRe: What wrong with this loop? Pin
yu-jian15-Jan-11 3:43
yu-jian15-Jan-11 3:43 
Question(OpenGL/MFC/Win32) glReadPixels and CreateBitmap question... Pin
Maximilien14-Jan-11 7:57
Maximilien14-Jan-11 7:57 
AnswerRe: (OpenGL/MFC/Win32) glReadPixels and CreateBitmap question... Pin
User 742933814-Jan-11 10:03
professionalUser 742933814-Jan-11 10:03 
QuestionString Problem Pin
john563214-Jan-11 1:22
john563214-Jan-11 1:22 
AnswerRe: String Problem Pin
Stephen Hewitt14-Jan-11 1:34
Stephen Hewitt14-Jan-11 1:34 
AnswerRe: String Problem Pin
Maximilien14-Jan-11 1:59
Maximilien14-Jan-11 1:59 
Questioncreate dimmed icon with magick++ (ImageMagick) Pin
Thue Andersen13-Jan-11 22:10
Thue Andersen13-Jan-11 22:10 
I’m trying to use ImageMagick for what I believed would be a simple task.
I want to generate a dimmed version of an image/icon at runtime in the application.
I use the magick++ c plus api.

I have found some commands that give me an ok result when run from the command line.
Converting the commands to the c++ api was a bit challenging, and the result is then not as hoped.

// Command example
convert -size 32x32 xc:"#999999" gray32.png
composite -dissolve 50% logo32.png gray32.png dim_logo32.png


How would this look in c++?
I came up with this.
Magick::Image gray;
gray.size( Magick::Geometry(image.columns(), image.rows()));
gray.read( "xc:#999999");
gray.label( "gray" );

if(gray.isValid()) {
gray.opacity(QuantumRange/2);
image.composite(gray, Magick::Geometry(image.columns(),image.rows()), Magick::DissolveCompositeOp );


But the transparency in the picture is lost.


A other suggestion as to make a dimmed image, is to make the full image semi transparent.

convert input.png -channel Alpha -evaluate Set 50% output.png

This could work. The transparency is kept when I tried this from command line.
Changing this to c++ api confused me a lot.

I ended up with this single line.

image.opacity(QuantumRange/ 2);

Now the result from this confuses me. The image is semi transparent, but the background that was originally transparent is now magenta.
orginal icon


dimmed icon

AnswerRe: create dimmed icon with magick++ (ImageMagick) Pin
Chris Losinger14-Jan-11 3:04
professionalChris Losinger14-Jan-11 3:04 
AnswerRe: create dimmed icon with magick++ (ImageMagick) [modified] Pin
User 742933814-Jan-11 11:33
professionalUser 742933814-Jan-11 11:33 
GeneralRe: create dimmed icon with magick++ (ImageMagick) Pin
Thue Andersen16-Jan-11 5:00
Thue Andersen16-Jan-11 5:00 
GeneralRe: create dimmed icon with magick++ (ImageMagick) Pin
Rozis18-Jan-11 8:08
Rozis18-Jan-11 8:08 
GeneralRe: create dimmed icon with magick++ (ImageMagick) Pin
Thue Andersen18-Jan-11 22:13
Thue Andersen18-Jan-11 22:13 
QuestionIsalpha Function Issue. Pin
Mike Certini13-Jan-11 18:00
Mike Certini13-Jan-11 18:00 
AnswerRe: Isalpha Function Issue. Pin
Cool_Dev13-Jan-11 18:11
Cool_Dev13-Jan-11 18:11 
GeneralRe: Isalpha Function Issue. Pin
Andrew Brock13-Jan-11 18:15
Andrew Brock13-Jan-11 18:15 
GeneralRe: Isalpha Function Issue. Pin
Mike Certini13-Jan-11 18:28
Mike Certini13-Jan-11 18:28 
AnswerRe: Isalpha Function Issue. Pin
Luc Pattyn14-Jan-11 0:56
sitebuilderLuc Pattyn14-Jan-11 0:56 
GeneralRe: Isalpha Function Issue. Pin
Mike Certini13-Jan-11 18:28
Mike Certini13-Jan-11 18:28 
AnswerRe: Isalpha Function Issue. Pin
Richard MacCutchan13-Jan-11 22:00
mveRichard MacCutchan13-Jan-11 22:00 
Questionwcstok [modified] Pin
csrss13-Jan-11 2:40
csrss13-Jan-11 2:40 
AnswerRe: wcstok Pin
Cedric Moonen13-Jan-11 2:53
Cedric Moonen13-Jan-11 2:53 
GeneralRe: wcstok Pin
csrss13-Jan-11 3:20
csrss13-Jan-11 3:20 
GeneralRe: wcstok Pin
Luc Pattyn13-Jan-11 3:26
sitebuilderLuc Pattyn13-Jan-11 3:26 
GeneralRe: wcstok Pin
csrss13-Jan-11 3:29
csrss13-Jan-11 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.