?
Solved

Simple Q: What is a mask?

Posted on 1998-12-06
6
Medium Priority
?
175 Views
Last Modified: 2010-05-03
A very simple question.

When I talk about applying a mask to an image to make it transparent, is the mask the area which is going to be transparent, or is it the area of the image which is NOT going to be transparent. ???

I keep getting confused.
0
Comment
Question by:Minos111998
[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
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1448445
Masks Overview
Masks enable you to hide and reveal parts of a layer and to apply special effects with precision. Masks can be created from selections, from images, from the luminance values of images, and from scratch.
A Mask can cover a layer completely or with varying levels of opacity. It is 256 grey scale image, and the levels of grey correspond to the levels of masking. Because it is grey scale, a mask can be saved into an alpha channel.
0
 

Author Comment

by:Minos111998
ID: 1448446
Sorry, so is the mask the area which will be seen finally, or is it the area which is going to be removed?
0
 
LVL 2

Accepted Solution

by:
trillo earned 120 total points
ID: 1448447
Actually a mask is not the area that will be removed, nor the area visible... it's none of them or both, depending on how you see them.

A mask is a bitmap that will act as an intermediate between the background and the actual bitmap. Masks are always monochrome.
By now you'll be saying..."yes, it's everything ok but that doesn't answer my quetion...". The fact is that the visible or non visible parts of the bitmap combination depends on which RASTER OPERATIONS you are using.

As an easy example look at this: Supose that pixels are given in RGB values, with 8 bits per color. Supose you have a red pixel RGB(255,0,0) in the background and you want to draw a blue pixel RGB(0,0,255) over it:
If you have a AND raster operation the result is:
red     11111111 00000000 00000000
blue    00000000 00000000 11111111
--------------------------------
result  00000000 00000000 00000000 = black pixel

but with a XOR raster operation:
red     11111111 00000000 00000000
blue    00000000 00000000 11111111
--------------------------------
result  11111111 00000000 11111111 = magenta (more or less) pixel
These are called binary raster operations and there are more than 10 different types

When you want to combine two bitmaps you use ternary raster operations, and there are a lot of them, but only a few are usefull in practice and they have special names.

When using masks, you use foreground and background ternary ratser operations. Remember that masks are monochrome so each pixel can only hve tow possible vaues: 1 or 0.... And here's the secret: A value of 1 in the mask specified indicates that the foreground raster operation code specified should be applied at that location. A value of 0 in the mask indicates that the background raster operation code specified by dwRop should be applied at that location.

Trillo
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Expert Comment

by:trillo
ID: 1448448
I forgot to say that the ternary raster operations are so calles because they need: a source bitmap, a destination bitmap, and a brush. The Raster operation (ROP) code determines how they're combined.
What will you use this for?

Trillo
0
 

Author Comment

by:Minos111998
ID: 1448449
Bingo!

Now that really answered my question. Thanks. It's just that I seemed to have neglected that there are many ROPs available.

Thanks again.

And by the way, do you know if it is possible to somehow use a bitmap mask to generate a region? For clipping and so on, because the only region creating functions I know of uses RECTs or elipse and so on, eg CreateRectRgn, CreatePolygonRgnm CreateEllipticRgn etc.

Is it possible to use a bitmap mask to create a region instead?

0
 
LVL 2

Expert Comment

by:trillo
ID: 1448450
Actually I don't know how to use a bitmap as a region... but someone asked the same question one or two weeks ago and it's answered by someone, you can search in the <paq> questions, but I if I remember well I saw it in the C++ area.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

718 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