IconView and lots of Images GTK - c

I have question to GTK users, in my program I will need a lot of images and I wonder if I can somehow connect iconview with images? Because some of these images are going to be big and I want to show ther dwarfs in one window and full size in another. Or do I have to use table and then making small icons from images, place them inside table, save somewhere original dimensions and then just restore original dimensions in that another window where I want to have full dimensions of pictures?
Sorry for bothering and thanks in advance.

You have to first load the image manually (using gdk_pixbuf_new_from_file() or gdk_pixbuf_new_from_file_at_size()). Then manually create the different sizes you need (using gdk_pixbuf_scale() or gdk_pixbuf_scale_simple()). To add the images to the icon view you have to create a 'GtkListStore' (or any other object implementing the GtkTreeModel interface) and add your scaled down pixbuf to it. It would be a good idea to do this in a separate thread since it will probably take some time for the images to load and you don't want your application to lock up.

Related

Efficiently display multiple markers on WPF image

I need to display many markers on a WPF image. The markers can be lines, circles, squares, etc. and there can be several hundreds of them.
Both the image source and the markers data are updated every few seconds. The markers are associated with specific pixels on the image and their size should be absolute in relation to the screen (i.e. when I move the image the markers should move along with it, but if i zoom in, they should take the same space of the screen as before).
Currently, I've implemented this using the AdornerLayer. This solution has several problems but the most significant one is that the UI doesn't fare well under the load even for 120 such markers.
I wanted to ask what would be the best way to go about implementing this? I thought of two solutions:
Inherit from Canvas and make sure it is invalidated not for every
added marker but for a range of markers at once
Create a control that holds an image and change its OnDraw to draw all the markers
I would appreciate some pointers from someone with experience with a similar problem.
Your use case looks quite specialized, so a specialized solution seems in order. I'd try a variant of your second option — extend Image, overriding its OnRender method.

ios6 UIImageView - Loading -568h image

I've seen a couple posts about the UIImage automatically loading the filename-568.png image in the new iOS6, but I can't seem to recreate it in the UIImageView class.
I'm using the Storyboard (not my app, just having to do some checks), and I've a simple layout with just the Image View scaled to fit, no code in the view controller, and I've sure the filename.png and filename-568h.png exist (as well as -568#2x.png just in case) but when I load it up in the iOS6 simulator. This has been for iOS 4 and 5, loading the #2x image for retina, doesn't seem to work in iOS6 though. Any ideas?
The image happens to be called Default.png since it is the same as the launch image, could this be the issue?
Thanks for any help in advance
iOS6 does NOT automatically load -568h as it does with the #2x images. The only exception is the default screen, but further than that you have to manually set you 568h image yourself.
I created some code to mimic the loading behavior for -568h images when using the [UIImage imageNamed:#""] method, but from the IB I do not know the way. If you are interested in such a solution, check it out at http://angelolloqui.com/blog/20-iPhone5-568h-image-loading
Typically, you should only use 568h for the launch image. If you notice yourself using different image assets within your app for the new display height, you should consider that you might be making your UI too static.
The most obvious place people want to use 568h for images is for background images. An alternative is to just have one asset that has the largest possible dimensions and align it properly using the contentMode property of UIView.
But perhaps you have something floating in the image at the top and the bottom, so contentMode doesn't solve it. You could consider that the top and bottom floaters should probably be separate views anyway.
Remember, we have always been making apps with variable heights. Every time a keyboard pops up, its as if the size of the screen has shrunk.

How should I use .ico files in a Winforms Application?

I'm developing a WinForms c# 3.0 application. Our designer created quite a lot of .ico files containing all the needed art. The choice of .ico was made because quite often, the same image is needed in several places in different dimensions.
Now, it seems .ico files are really annoying to use in visual studio. The only way to use those images seems to be through images list (which aren't supported by all controls).
Compared to other resources, you can't write this :
foo.Image = global::RFQHUB.RFQHUBClient.Properties.Resources.foo; // Cannot implicitly convert type 'System.Drawing.Icon' to 'System.Drawing.Image'
Here are the options I'm considering :
create ImageLists of all possible sizes referencing all my icons in my main window. Link these ImageLists from other windows and find a way to export Image objects from the ImageList when I can't use it directly ; since ImageList contains a Draw() method, this should probably be possible.
convert all the x.ico I've got in several x16.gif ...x48.gif, and use those through resources.
I'd be interested to know if some people have been successfully using .ico resources in a Winform application. In so, how did you set up things ?
ICO isn't quite an obsolete format, but it's close. It's still useful for your application icon, but for almost everything else, it's better to use an ImageList for each size that you need. And it's much faster to populate an ImageList from a bitmap that contains multiple images layed out in a grid.
You also want to use an Alpha channel transparency in your bitmaps to get the best result, so storing them as .PNG files in your resources is the best way to go, since PNG supports an alpha channel. ICO and GIF files support only single bit for transparency - every pixel is either fully opaque or fully transparent. An 8 bit alpha channel for transparency looks much nicer.
If you can send your artist back to the drawing board then you should do so, and have him/her do full anti-aliased images with alpha. If you can't, then I suggest that you write a small program to convert all of your icon files into bitmaps suitable for loading into ImageLists.
Convert the images into PNG. Point. Whoever decided to use .ico files to start with should get talked to in private - the argument holds no ground.

Get path geometry from image

If i have a logo, let's say done as a jpg or even a png. Any suggestion for how I can use that to define a path geometry? It would be really good if any suggestions could be provided for how i can do it in blend.
Thanks
Yes - I just tackled this problem for an LOB application two days ago.
I can't offer advice for Blend (though I've read that it can be done in Expression Designer). However, the best free tool I've found for this is called InkScape (http://www.inkscape.org).
It's opensource, and while it's intended primarily for editing SVG vector-based images, it has two key features that are useful to us WPFers:
It can vectorize (i.e. "trace") raster images like bitmaps and jpegs, albeit not as well as one would hope, and
It can export the vector image as XAML
You'll invariably find that you get better results from loading vector formats (like SVG, EMF, WMF, etc) and saving to XAML, than if you try to convert a bitmap/jpeg... simply because the process of vectorizing a raster image is error prone at best. So if you want to bring a company logo into XAML, try to get hold of the source files used to create the logo (perhaps done in Illustrator?) and import that into InkScape.
If this post is helpful, please be kind and give it a one-up.
Jasema is a terrific tool right for the job.
Also, don't be shy to use Blend - it is somewhat more difficult to use (drawing shapes using pen) but it gets easier pretty fast. Switch on gridlines and optionally snap to them for good results.
What both Jasema and Blend are lacking, is the ability to easily create shapes with a central symmetry (like stars), so I took parts from Jasema and created my own tool (named Radius) that works a bit like a combination of a ruler and compass.
I have a good idea but you're png, bmp, jpg or other non vector file is must be very simple because we need best scan results and only use inkscape.
Step: Drag and drop your file workspace on Inkscape, download free.
Tip: If your image is color white, Top menu item File->Document Properties-> heck Checkerboard Background and if you want uncheck Page border show.
Step: Top menu item Path-> Trace Bitmap-> Mode check what you want property, i usually use color property and if your file is png check Remove Background then click OK, then wait again Ok button is Enable and close window.
Step: Now you have a two layer, top layer vektor file and bottom layer your file. Select vector file and top menu item Edit-> XML Editor-> select svg path and look side column, d name propery in your data path value.
But this method may not always work or may not give the desired results and draw your own shapes with the scape so you can get the path data from the XML editor.
Example, my first tests this like:
and after working on it some more:
I've solved my problem (export an image as XAML) using Microsoft Expression Design 4 (Free Version). I've downloaded from the link
http://www.microsoft.com/en-us/download/confirmation.aspx?id=36180
As input, I had Adobe Ilustrator files.
Adobe Illustrator / CorelDraw is perhaps the best tool out there for these operations that I have used.
Personally, I prefer illustrator for on-screen media. These tracings can be exported into several formats such as EPS, SVG, AI, or even XAML (with this plugin)
Best of Luck !!!!
I have recently been struggling with this myself. I had a set of icons done in data and needed to update them to look nicer.
I tried everything, manually typing them out. drawing in svg, converting svg to xaml.
in the end i found a list of open source icons from google material icons.
I then used this to convert from the svg files to data
https://github.com/BerndK/SvgToXaml
It works well but not for the icons i drew myself.
I decided to place all the icons data i convert into an app i built myself that will give you the data and a preview of the icon. feel free to use and contribute. I will keep updating as much as i can.
https://github.com/sgreaves1/XamlIcons
Convert your image from png to svg in online converter, then drop file into this site http://inloop.github.io/svg2android/ and you will see pathData of your image like below shown in my image.

What's the max size I should use for a WinForm dialog?

I'm designing some dialog boxes, and I'm having a hard time to fit everything. (and it has to fit on a single dialog box by design, so please don't tell me I should make two dialogs instead of one:))
I'm wondering what's the max size a dialog can have before being annoying for the end user. Of course it should't be bigger than his resolution, but are there any other boundaries to consider?
I'm trying to limit at 800x580 (so that it can display fine on a 800x600 screen without hiding the taskbar), but I expect my users to be on 1024x768 or better screen resolutions.
Is a 800x580 dialog box ok, or is it too big?
Have you considered using a tabbed layout?
Also, I believe the smallest main-stream screen resolution is 1024x600.
I'd say anything over that is too big. I try to stick below 1000x500.
I'm writing this on a netbook (ASUS) with resolution 1024 x 600. I've also noticed this is a defacto standard for most other netbooks too.
Another option: you could create a dialog that resizes itself automatically to fill the current desktop (except for the task bar).
It could also enforce a "flow" style layout for it's child controls. This would ensure the best use of the available space is made.
To get "flowing" in Windows forms you can use either the flow layout control or (for a richer interface) the WebBrowser control.
By the way, modal dialogs seem to be less popular as a way of user interaction these days. Especially large dialogs containing a lot of information/controls. This article has some good alternatives.
I think that if the user NEEDS to see all data on screen at the same time... and you can fit everything in 800x580... I think that it's a fine size.
If you know all users have bigger resolutions so don't struggle... that size is OK.
However... a way of showing lots of information and being able to edit it... could be a PropertyGrid control (an example here)... may be that could shrink a bit the form if you don't feel confortable with it being so big. Don't know if it a possibility given the needs of your client/user.
Just hope that no-one ever tries using your app on a media center running through a standard definition display. That's 640x480 for NTSC. I've suffered this problem with quite a few apps.
Whatever your pixel by pixel size, if it takes more than a few seconds for skilled users to complete the use of your window, then it shouldn’t be a dialog. Anything longer is annoying. You’d be asking your users to do too much work that is too easy to lose (e.g., by hitting Cancel accidentally) and too hard to re-entered (e.g., between sessions). If you have so many controls that the dialog needs to be 800 by anything, then it’s too many controls. 200,000 square pixels and 40 controls is the very most you should consider for a dialog. And tabs are nature’s way of saying your dialog is too complex.
Dialogs are for entering parameters to execute a single command on one or more data objects visible in the primary window for the dialog, which is why dialogs need to be small and simple. I suspect that’s not what you’re doing. Instead, you’re using a “dialog” to represent the main data objects and carry out a major task, not a single command.
What you want is a primary window, not a dialog, with all the support necessary for the complicated task you’ve set up for the user. That includes providing a means for users to save, retrieve, and copy their work. That means a menu bar and toolbar with all the standard commands, including help. The window should absolutely be modeless, and be resizable, maximizable, and minimizable.
Primary windows should be designed to work best at the size of most (over half) of your users’ screens. 1024x768 is generally fine for today’s laptop/desktop screens, not that you should use that much space if you don’t have to. If the user’s screen is smaller, or the user for any reason resizes your window below the design size, then scrollbars should appear to allow full access to all controls and content in the form –just like any primary window. The experience on the web indicates that scrolling is not a showstopper for forms.
Beyond that, tabs may be used in a primary window to increase the number of controls on it. You said you don’t want to hear about multiple windows, but multiple windows should be used instead of tabs if the user will be comparing data across tabs/windows. You can also fit more in a given primary window size by using a compact presentation (I describe this at http://www.zuschlogin.com/?p=42), but test such an approach on your users before committing to it.

Resources