Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Icon pixels

Posted on 1997-02-28
11
Medium Priority
?
516 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
[X]
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
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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 450 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

721 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