When including a 3D plot inside a TabView, in my computer, the entire tab is grayed as if it was a giant button, leaving the Graphics with a white background:
To avoid the contrast between the gray and the white, I would prefer that the tab also had a white color.
Tried BaseStyle -> {Background -> White} but with no success (only the borders get restyled).
How can I change the Background color of the tab?
The default background is not white but transparent for graphics, so there's no harsh contrast. Background -> White makes the background white and leaves the borders, quite the opposite of what you said. BaseStyle doesn't seem to do anything.
This is what I get on Windows XP:
EDIT: An alternative is a custom TabView-implementation along the following lines:
objects = Table[Plot[f[x], {x, 0, 10}], {f, {Sin, Cos, Exp}}];
Column[
{SetterBar[Dynamic[x], Thread[objects -> Range#Length[objects]]],
Dynamic[x]}
]
This is unfinished, but the basics work, and it shows you how to do it yourself.
This seems to be an OS specific problem. On OS X, TabView does have a grey background (albeit very light), even with Background->White. For example
TabView[Table[Plot[Sin[i x], {x, 0, 2 Pi}, Background -> White], {i, 4}],
Background->White]
produces this
I can confirm Heike's assertion for Windows 7.
If you wish to always overwrite the system theme color for TabView boxes, you may evaluate:
SetOptions[$FrontEnd,
TabViewBoxOptions -> {Background -> GrayLevel[1]}
]
Using either the "Windows 7 Basic" or "Windows 7 Aero" theme, I see this:
However, using the "Windows Classic" theme I see this:
If, using the Classic theme, I open Window Color and Appearance and change the 3D Objects Color 1 to white, I see:
Related
I'm using iterm2 (v3.0.14) on Mac Sierra. How do I invert the color scheme on my terminal? That is, right now, the default is a black background with white lettering, and I would prefer a white background with black lettering. Note that I don't want to invert the color scheme for everything on my Mac (which I can do with a keyboard shortcut), I only want to invert the color scheme for iterm2.
If I understand you correctly, you want to change the color theme.
preferences>profile>colors>color presets, choose the scheme or import the scheme you download.
Or you can double click the .itermcolors files, then go preferences>profile>colors>color presets to find your scheme.
If you just want to change the background color and font color, it's more easy. Just adjust the color on preferences>profile>colors.
in my case this path helped: Profiles -> Open Profiles -> Edit Profile -> Colours.
Cheers!
I'm programming a cocoa app which uses scripting bridge to interact with menus in a specific frontmost application, but I don't want the user to see all the gibberish that scripting bridge is doing.
So I want to freeze the image of all monitors during that phase and I'm trying to use
CGCaptureAllDisplaysWithOptions(kCGCaptureNoFill);
which supposedly do that until i call the
CGReleaseAllDisplays();
But it won't, all the screens turn black.
I have tried the solution here "CGDisplayCaptureWithOptions (kCGDirectMainDisplay, kCGCaptureNoFill) still fills the screen with black" to capture the screen one by one but stills they turn black.
Someone know why? Is there some workaround?
I also tried a more complex approach, taking screenshots of every screen before capture, using CGDisplayCreateImage. But another problem arouse when i try to draw them directly to the screen context. I got the context using CGDisplayGetDrawingContext and call the CGContextDrawImage to draw the images for each one of the screens.
With only one or mirrored screens works fine but with extended screens only works on my main screen, the other show a sub image of the screenshot.
For example:
Main Screen:
CGDisplayBounds returns {{0, 0}, {1280, 800}}
CGRect rect1 = {{0, 0}, {CGImageGetWidth(screenshot1), CGImageGetHeight(screenshot1)}};
CGContextDrawImage(context1, rect1, screenshot1); //<- works fine
Other Screen
CGDisplayBounds returns {{1280, 0}, {1920, 1080}}
CGRect rect2 = {{0, 0}, {CGImageGetWidth(screenshot2), CGImageGetHeight(screenshot2)}};
CGContextDrawImage(context2, rect2, screenshot2); //<-Shows a sub image of my screenshot with origin at (1280, 0) and frame {{1280, 0}, {1280 - 1920, 1080}}
Sub image that appears on the monitor:
http://i.stack.imgur.com/zoUWe.jpg
Original Screenshot:
http://i.stack.imgur.com/KHjN6.jpg
Any suggestions?
When right clicking an Image in the front end, there's the option to display at its actual size (i.e. 1:1 screen to image pixel size).
How can images be forced to be shown like this? When making a Row or Column of Images, how can they be made to display at their actual size?
I was comparing image resampling methods to see which one gives the best result for a sharp edges when this came up. As a workaround I ImageAssembled all the images, so I had to right-click only once to get them to display at actual size.
Here is another method that works on version 7 at least.
img = ExampleData[{"TestImage", "Lena"}];
Row[{ Image[img, Magnification -> 1], Image[img, Magnification -> 1] }]
I only became aware of this context menu item a couple of months ago. It was probably added somewhere in v8.
I noticed Image-like output gets this item in their context menu, but bitmaps from Rasterize don't. You may try Rasterize[Plot[Sin[x], {x, -\[Pi], \[Pi]}], RasterSize -> 500] to test that. Put // Image behind it and you get a different context menu for the result.
I believe the presence of ImageSize in the containing Cell determine the scaling of images (of the second kind). No ImageSize means automatic scaling and ImageSize->Magnification[1] means actual size. So, you would need to manipulate the cell itself to change the behaviour.
Please try:
Show[image, ImageSize -> All]
Likewise:
Row[{ Show[img1, ImageSize -> All], Show[img1, ImageSize -> All] }]
I made 3D graphics, and using the known method of zooming, which is to hold the Ctrl and now slide the mouse up and down to zoom in and out as described here
http://reference.wolfram.com/mathematica/howto/RotateZoomAndPanGraphics.html
This works ok.
But now I issue the command Rotate[g,90 Degree], and try to zoom on the generate plot (in the new output cell). But the zoom no longer works on that new rotated image.
I see it blinking black each time I slide the mouse, but it does not zoom in nor out.
Here is the command
g=Graphics3D[ Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
AxesOrigin->{0,0,0},
PlotRange->{{-1,1},{-1,1},{-1,1}},
Axes->True,
AxesLabel->{"X","Y","Z"},
ViewPoint->Front,
Ticks->None]
now zoom works ok. Now type
Rotate[g,90 Degree]
Now try zoom on the result of the above command. It does not work.
version 8.0.1, windows 7
thanks
You are right, there is a bug in the interface.
After a few tries, pressing Ctrl and the mouse buttons, I was able to get a weird display:
And the zooming works (although inconsistently), but ... moving the mouse left to right!
I think this is either an abusive or unanticipated use of the Rotate command, depending on your perspective.
Rotate creates a RotationBox wrapper that instructs the FrontEnd (I believe) to rotate it's contents. When you apply this to an object with its own rotation controls, you have conflicting methods.
Generally speaking, Rotate should not be used on dynamic elements. Consider this modified example from the documentation:
DynamicModule[{p1 = {0, 0}, p2 = {1, 0}, p3 = {0, 1}},
{Framed#
Graphics[Polygon[{Dynamic[p1], Dynamic[p2], Dynamic[p3]}],
PlotRange -> 1],
Column[
{Slider2D[Dynamic[p1], {-1, 1}],
Slider2D[Dynamic[p2], {-1, 1}]~Rotate~(Pi/2),
Slider2D[Dynamic[p3], {-1, 1}]}]}]
Notice the strange behavior of the middle slider (try it), and also notice that its appearance is wrong. The latter is further indication that this use is noncanonical.
i've created a layered window by adding the the WS_EX_LAYERED extended style:
wndClass.ExStyle = wndClass.ExStyle | WS_EX_LAYERED;
Windows will use black as the chroma key color value. i'm going to leave a large border of black to make the problem obvious:
After the window is constructed, i tell it to use black as a chroma-key color:
SetLayeredWindowAttributes(hwnd, 0x00000000, 255, LWA_COLORKEY);
Now the popup layered window appears partially transparent:
The problem is the final step. i want to use CS_DROPSHADOW class style, available since Windows XP, to create a drop-shadow:
wndClass.Style = wndClass.Style | CS_DROPSHADOW;
The drop shadow appears, but the shadow surrounds the original rectangular window, and doesn't take into account the window's transparency provided by the layered window:
Does anyone know what magical option i've missed somewhere that will make the drop shadow honor the non-rectangular layered window?
Another example of where this issue appears is when you don't include the 6px padding/margin. The hint window as drawn by Windows® themes is non-rectangular. This leaves a small visible gap where the window is transparent, but the drop shadow does not appear:
Microsoft has managed to make it work, as you can see from this hint from Internet Explorer:
Looking closer at a Windows tooltips class hint window. Using SpyXX - i can get its window rect, and class styles:
SpyXX says:
Rectangle: (440, 229)-(544, 249), 104x20
Restored Rect: (440, 229)-(544, 249), 104x20
Client Rect: (0, 0)-(104, 20), 104x20
So everything points to the window itself being 104x20 pixels, with the drop shadow outside the window itself. (Which is consistent with CS_DROPSHADOW.)
Next i can look at the styles of the tooltips window class:
Windows Styles: 94000001
WS_POPUP 80000000
WS_VISIBLE 10000000
WS_CLIPSIBLINGS 4000000
TTS_ALWAYSTIP 1
Extended Styles: 00080088
WS_EX_LAYERED 80000
WS_EX_TOOLWIN 80
WS_EX_TOPMOST 8
Interestingly, it doesn't use CS_SAVEBITS (0x800); which is useful for small, short-lived, windows.
Nor does it use CS_DROPSHADOW (0x20000). So now i wonder how is it drawing outside its own window?
Note: Transparent layered windows is documented as the preferred technique over regions.
Edit: Layered Windows have been around with Windows 2000. CS_DropShadow was added with XP.
Transparent layered windows is documented as the preferred technique over regions.
However, CS_DROPSHADOW does pay attention to regions. If you crop or otherwise shape your window using a region, the drop-shadow will follow the new outline.
Fortunately, you can use regions with layered windows, and by combining the two get the effect you're looking for.
BTW: tooltips_class32 does use CS_DROPSHADOW - you won't see it in the window styles because it's a class style, not a window style.
Why don't you use LWA_ALPHA and build the shadow into the image?
Edit in reponse to your comment:
A) Doesn't stop you using an alpha channeled PNG for a shadow only. Blt the 2 images together and use as one single image.
B) Its not hard to generate a drop shadow. In the image you posted its black with 3 different alpha values.
C) But it doesn't work does it? ie Time to get creative.
D) Then don't try and get windows to do something it won't do for you.
E) Is entirely irrelevant. Layered windows handle that for you.
I strongly recommend you learn more about layered windows because they CAN help you to your goal.
Edit2: You have the bitmap. Its fairly easy to scan over the image and find which bits will be colour keyed (by identifying the black yourself) and hen modify that to have an alpha of 0 where everything else will have an alpha of 255 (Not: You may have to convert the image to a 32-bit image from a lower colour format, you can do this by creating a new DC and copying the image). This will give you the same effect with LWA_ALPHA as with LWA_COLORKEY. From there its fairly easy to identify the pixel at the edge, where the color changes to (R = 0, G = 0, B = 0, A = 0). You then change that first pixel to have a n alpha of 192, the one blow it to 128 and the one below to 64. You now have an alpha'd gradation below the image that will look like the shadow. You can adjust the alpha to get the effect you want.
CS_DROPSHADOW only works with standard rectangular windows. WS_EX_LAYERED windows don't support everything. They are more of a low-level, self-service method to draw exactly what you want.
To get a drop shadow, you'll have to generate the drop-shadow yourself from the alpha channel in the image.