[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
www.undertowsoftware.com • View topic - How to set opacity?

How to set opacity?

A forum made available for users of the MapPro OCX SDK to exchange ideas, ask each other questions, etc.

How to set opacity?

Postby FletcherJ » Tue Jan 31, 2012 2:42 pm

Hi all,

I did a search on opacity, but didn't find any results... If I am drawing a polygon (using .CAD.Polygon() ), I can set colors, modes, styles, etc. I have looked at the docs on p. 191 and 201, but I can't find enough information.

I simply want to specify the opacity of the fill. So instead of having a solid color, I want a faint overlay that makes it easy to see the polygon, but doesn't obscure what is beneath. I know this is easy to do as it is done with counties, states, etc. I just can't figure out what combination of .brush (or .pen?) settings I need to use to do it.

My prior experience was that I would set the opacity to a value that allowed most of the background to show through. That doesn't seem to be the case here.

Thanks,

me
User avatar
FletcherJ
Active User
Active User
 
Posts: 36
Joined: Fri Jan 20, 2012 5:33 pm

Re: How to set opacity?

Postby Gyrotech » Tue Jan 31, 2012 3:21 pm

I believe the way to do that is by using one of the windows raster operations, that are exposed through the control's CAD interface. At least that's what I get reading the manual.

This is what I would do:

Set the CAD object's brush color to a distinguishable color, so you can see the results immediately, e.g., RGB(255,0,0);
Set the CAD object's brush style to 0 (solid)
Set the CAD object's brush mode to 2 (Opaque)
Set the CAD object's Pen ROP to something like 3 (MaskNotPen)

I'm pretty sure that should give you the transparent polygon you are looking for.
User avatar
Gyrotech
Frequent User
Frequent User
 
Posts: 52
Joined: Mon May 03, 2010 11:23 pm

Re: How to set opacity?

Postby FletcherJ » Wed Feb 01, 2012 6:50 pm

Gyrotech,

That works, thank you.

But it would be nice if there were an explanation somewhere about what these values do. Style=2 (Opaque) is clear, but what is the effect of ROP? I wish the book was just a tad more clear - or at least had an index so it is easy to find where things like ROP are defined....

Also, is there a way to set the amount of opacity (very tranparent to just barely transparent)?

Thanks again,

me
User avatar
FletcherJ
Active User
Active User
 
Posts: 36
Joined: Fri Jan 20, 2012 5:33 pm

Re: How to set opacity?

Postby Gyrotech » Wed Feb 01, 2012 10:43 pm

Raster Operations (ROP) and what they do are part of Windows, not of the SDK, so you'd have to consult a Windows graphics book.

I don't think there is a way to set the amount of transparency, other than to set a different ROP, which would give you a different effect.
User avatar
Gyrotech
Frequent User
Frequent User
 
Posts: 52
Joined: Mon May 03, 2010 11:23 pm

Re: How to set opacity?

Postby Kevin_T » Fri Feb 03, 2012 12:02 pm

Gyrotech, you are right. However, nowadays, the expectation is that the user would not have to be familiar with the Windows GDI. They expect all that to be handled by the IDE or by whatever tool they are using. I am not saying it's right or wrong. Simply saying that my observation is users don't want to have to understand the GDI in order to write applications using its features, just like they don't expect to have to understand how to do base conversions, they expect the IDE, or whatever tool they are using, to have a function to do it for them.
User avatar
Kevin_T
Senior User
Senior User
 
Posts: 265
Joined: Fri Apr 30, 2010 9:13 am


Return to MapPro OCX

Who is online

Users browsing this forum: No registered users and 2 guests

cron