i have a problem with the WPF VisualBrush. Here you find two images from my application. The bigger on is a image which shows a control with text. The smaller one is a extract from the first on who i use a visual brush to make it. My problem is, that when the resolution of my Visual (the content for VisualBrush) would be smaller then the visual brush looks more blurred. I don't no why. I use the following code to declare the visual brush.
var blendBrush = new VisualBrush
{
Visual = Host.Viewer,
TileMode = TileMode.None,
AlignmentX = AlignmentX.Left,
AlignmentY = AlignmentY.Top,
Stretch = Stretch.None,
ViewboxUnits = BrushMappingMode.Absolute,
};
Host.Viewer is the control you see it on the big image. Everytime the control size is changed i update the ViewBox values with the following routine:
var viewBox = new System.Windows.Rect(topLeft, new Size(width, height));
visualBrush.Viewbox = viewBox;
topLeft is the start coordinates and the width and height values are the size of extract i needed.
I hope anyone can help how i can prevent that the control would be blurry!
Thanks
Daniel
Okay i found the problem. Host.Viewer contains in deeply part a canvas which contains a image object. Images could look blurry in .NET 4.0 and higher. The problem could resolve to set UseLayoutRounding = true; and BitmapScalingMode = BitmapScalingMode.NearestNeighbor; for the Canvas and the Rootparent-object.
Related
I am using vuforia video playback demo with cloud recognition.
I have combined both projects and it is working properly. But currently video dimension is according to detected object. But i need fixed width and height when video plays.
Can anyone help me ?
Thanks in advance.
Well apparently Vuforia fixes the width and height at the start of the game no matter what the size of the object is. I could not find when exactly this operation is conducted but it is done at beginning of your game. When you change the size of the ImageTarget in runtime it is not fixed anymore. Add these lines to your OnTrackingFound function of DefaultTrackableEventHandler.cs
if (this.name == "WhateverTheNameOfYourRelatedImageTarget"&& !isScaled)
{
//Increase the size however you want i just added 1 to each dimension
this.transform.localScale += Vector3.one;
// make isScaled true not to scale every time it is found initially it shoud be false
isScaled = true;
}
Good luck!
What i usually do is , instead of Videoplayback , i play the video on canvas object and hook this object to Defaulttrackableeventhandler script. So when target is found, gameobject.setactive(true) and gameobject.setactive(false) when target is lost. By this method the size of the gameobject is fixed and it stays in a fixed location .
I just made an example you can get here (have to import it to any project and open the scene Assets/VideoExample/Examples). You can see there a bit clearer what the ScreenSpace - Overlay does ... it might be better to just switch to ScreenSpace - Camera in general
First let me say I'm coming from the iOS world and am trying to make my first OSX app. So apologies for the question if the answer is obvious. :)
I'm trying to setup an NSTextView to resize according to the amount of text in it. I've been successful at getting the NSTextView to resize properly but it's superview (NSScrollView) won't resize.
This is what I have so far...
[self.messageBodyTextView setVerticallyResizable:YES];
[self.messageBodyTextView.layoutManager ensureLayoutForTextContainer:self.messageBodyTextView.textContainer];
[self.messageBodyTextView.layoutManager boundingRectForGlyphRange:NSMakeRange(0, [self.messageBodyTextView.layoutManager numberOfGlyphs]) inTextContainer:self.messageBodyTextView.textContainer];
NSRect rect = [self.messageBodyTextView.layoutManager usedRectForTextContainer:self.messageBodyTextView.textContainer];
[self.messageBodyTextView.textContainer setContainerSize:rect.size];
[self.messageBodyTextView setMaxSize:NSMakeSize(self.messageBodyTextView.bounds.size.width, rect.size.height)];
[self.messageBodyTextView.textContainer setHeightTracksTextView:YES];
[self.messageBodyScrollView.documentView setFrameSize:rect.size];
[self.messageBodyScrollView.documentView setFrame:rect];
[self.messageBodyScrollView setFrameSize:rect.size];
self.messageBodyTextView resizes just fine with all this code (I have a feeling a have a bunch of redundant code in there). But self.messageBodyScrollView either doesn't resize at all or if I try to use setBounds then it not only resizes messageBodyTextView to messageBodyScrollView's full size but it also stretches out the text inside.
note: messageBodyTextView and messageBodyScrollView are both attached to my IB doc as IBOutlets.
My code used to be a lot shorter but this is where I've gotten to by adding in anything I can find to make these two views match up.
Any help would be very much appreciated!
As the title says, the height of my tabs is not increasing as it should, my code looks like this:
JTabbedPane jtp = new JTabbedPane();
JLabel iconInTab = new JLabel(new ImageIcon("myImage.png"));
iconInTab.setPreferredSize(new Dimension(100,80)); // is the size of my Image, I've also try to do this using getSize
jtp.addTab(null,new JPanel());
jtp.setTabComponentAt(0,iconInTab);
I've also try this using html but it did not work either:
jtp.addTab("<html><p><p><p></html>",new ImageIcon("myImage.png"),new JPanel());
with the first code the problem is not the change of the size horizontally (the width change correctly), the problem is only on the height, with the second code, if I add multiple lines inside the html code, the text appear incomplete (just show the middle line) (also the width behaves as expected, the problem is the height). . .
why is this happening? or how could I get this done?
Note: S.O.: Mac OS X 10.8.1
Solved!!! The problem was that the default UI over MAC OS X (com.apple.laf.AquaTabbedPaneContrastUI), you only need to change it to the basicTabbedPaneUI (or the one of your preference), in my particular case I need to extend this class (it was a pain in the *, because what I wanted was really complex) to get the look & feel that I was expecting, if you have the same trouble just do this before adding your tabs:
myTabbedPane.setUI(new BasicTabbedPaneUI());
Note: Checking the default UI of your TabbedPane, may solve many different problems.
Trying to get these 2 raphael elements to both change color when hovered over one or the other. Here is the code I have. Any help would be appreciated.
var loge_1 = rsr.set();
loge_1a = rsr.rect(235.457, 287.645, 32.523, 45.486),
loge_1b = rsr.rect(235.139, 277.626, 32.933, 6.701);
loge_1.push(loge_1a,loge_1b);
loge_1.attr(logeFill);
I assume you got the code from ReadySetRaphael .... no doubt they have a very good algorithm for Raphael conversion ... try some large SVG files sometime and they will give you a good result .... anyways try this ...
loge_1.mouseover(function(){
loge_1.attr({'fill':'your Desired Color'});
}
loge_1.mouseout(function(){
loge_1.attr({'fill':'original color'});
}
this should change the color of both your rects .... Hope it helps.
Well after searching I didn't find much on the subject. So I have read up on svg elements and changed my "rect" to "path". Here is the W3C svg documentation
And here is the jsfiddle with "path"
To find my rectangles paths I just opened the svg file in Adobe AI. Then made sure my documents units was set to pixels. From there I opened my info window and just copied the my anchor points of my rectangles x & y coordinates into my "path" and presto I have 2 shapes acting as one.
I am creating a WC_COMBOBOXEX on Windows Vista and adding strings to it, but they don't show up in the control. The same strings show up fine if I use the old WC_COMBOBOX with CB_ADDSTRING.
I am calling InitCommonControlsEx with ICC_USEREX_CLASSES and creating the comboboxex using CreateWindowEx with style WS_CHILD|WS_CLIPSIBLINGS|CBS_SIMPLE|CBS_SORT|CBS_HASSTRINGS (no extended styles). I am adding the strings using
COMBOBOXEXITEM cbem = {0};
cbem.mask = CBEIF_TEXT;
cbem.iItem = -1;
cbem.pszText = L"hello";
SendMessage(hWnd_, CBEM_INSERTITEM, 0, TOLPARAM(&cbem));
The combobox comes up empty but when I move the cursor up and down in the editcontrol/listbox, I see funny block characters sometimes.
Eventually, I want to add it as a CBS_DROPDOWNLIST to a rebar control but I read somewhere that comboboxex works a lot better in there than the old combobox.
Thanks.
From MSDN:
ComboBoxEx controls support only the following ComboBox styles:
CBS_SIMPLE
CBS_DROPDOWN
CBS_DROPDOWNLIST
WS_CHILD
So CBS_SORT and CBS_HASSTRINGS may be messing up the style bits.
Does it help if you send CBEM_SETUNICODEFORMAT?