Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Icon pixels

Posted on 1997-02-28
11
487 Views
Last Modified: 2013-11-19
When drawing icons with the graphic icon editor, you can designate some pixels as "transparent" or "opaque" by selecting one of the two monitors at the middle top portion of the color palette.  The pixels are then drawn red (opaque) or dark cyan (transparent).  But when the icons are displayed (in list view or explorer window), the meaning of "transparent" and "opaque" are not intuitive.  Example: in a list view, transparent pixels are black and opaque pixels are white (opposite of what I expected).

Can you clarify this topic?
0
Comment
Question by:lgrove
11 Comments
 

Expert Comment

by:rsantossio
ID: 1300190
I'm not sure of what you're asking... the "transparent-ness" of a displayed icon is always that; transparent.  To set transparency, in a ListCtrl/TreeCtrl, use the mask to designate the color you want to be transparent.  You can pass it a COLORREF or a CBitmap.  If you send a CBitmap, it will take whatever color is at pixel 0,0, and make that the transparent.

I'm still not sure what you were originally asking, but that's what I know about them... I was just working on them this morning.

Randy

0
 

Author Comment

by:lgrove
ID: 1300191
Edited text of question
0
 

Author Comment

by:lgrove
ID: 1300192

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:mrosen
ID: 1300193
Actually, there is transparent, and then inverse. The greenish blue is transparent and will show up white on a while background (such as in a list view with the default win95 colors). The pinkish-red one will invert the background color. Therefore, on the while list view background, the color looks black.
0
 

Author Comment

by:lgrove
ID: 1300194
The answer from mrosen is what I stated as intuitive.  My question is why is it acting the opposite in the list view?
0
 
LVL 1

Expert Comment

by:MFCGuy
ID: 1300195
I don't understand the actions you are seeing.

Please explain further.

My listview works as expected.  Perhaps you are setting the
colormask wrong?

Regards,
MFCGuy
0
 

Author Comment

by:lgrove
ID: 1300196
Colormask? Please explain.  I'm just editing the icon with the icon editor.  Where do I manipulate the colormask?
0
 

Author Comment

by:lgrove
ID: 1300197
Colormask? Please explain.  I'm just editing the icon with the icon editor.  Where do I manipulate the colormask?
0
 

Expert Comment

by:JohnWeidner
ID: 1300198
I believe the transparent/opaque commands in the icon editor only effect how cut and paste operations will occur while you are editing the bitmap.  I didn't think they would control how the bitmap was displayed.
0
 

Author Comment

by:lgrove
ID: 1300199
No. It does not work this way
0
 
LVL 1

Accepted Solution

by:
MFCGuy earned 150 total points
ID: 1300200
When you say "list view", are you referring to a CListView control you have in a program or just the "list view" in Explorer?

I created an icon as you described and the transparent pixels ("special" dark cyan in icon editor) were white on a white background.  The opaque pixels ("special" light red in icon editor) were black on my white background.  This was in Windows NT 4.0 Explorer.

If you are using a CListCtrl, I recommend using the following code for icon usage where I have a single bitmap that has all the images I need for a given CListCtrl.  Everything I want to make transparent is painted red (like the background):
.h
--
CImageList m_TheImageList;

.cpp
----
in c'tor
--------
//Initialize image list
m_TheImageList.Create(IDB_MY_BITMAP, 16, 12, RGB(255,0,0));
//The RGB(255,0,0) is what I referred to in my earlier
//comment as the "mask".

In OnInitDialog() or OnInitialUpdate of MDI/SDI child
-----------------------------------------------------
m_ListCtrl.SetImageList(&m_TheImageList,LVSIL_SMALL);

I then just insert the CListCtrl items normally, specifying the index into the image list that I want for each row, usually with a switch statement to do the image index logic for the insert.

Of course, you can individually add icons to the image list using CImageList::Add() but it's a pain compared to having one single image list as a bitmap in your resources.

If you want more information on how the system uses the transparent and opaque icon pixels, search on CreateIcon in VC++.

Here's an excerpt:
To create the icon, CreateIcon applies the following truth table to the AND and XOR bitmasks.
AND bitmask      XOR bitmask      Display
0      0      Black
0      1      White
1      0      Screen             (Transparent)
1      1      Reverse screen     (Opaque)

Regards,
MFCGuy
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
Shell script to login to remote m/c and execute commands 10 78
move a line in eclipse 3 107
ffmpeg - "rtsp://...... Operation not permitted" 4 86
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question