I know SkiaSharp exists, but it is not supported in Xamarin.Forms.
Can I simply draw using 1x1 BoxViews? But I think drawing a signature (with touchevent) may impact performance. Is there any better option?
If you just want a signature, you can try to use https://github.com/xamarin/SignaturePad and create a custom Control that is using it. Or you can have a look at https://github.com/aritchie/acr-xamarin-forms that is basically a translation of the first one for Xamarin.Forms. Unfortunately it is outdated, but you could use it as a guideline for your own implementation.
Related
I have a requirement where I need to highlight the buildings around my current location on a map. I am using Xamarin and was wondering if anyone can point me to a correct library or control that can fulfill my requirement.
I am currently using Mapsui for Xamarin but I don't think it has the feature I am looking for.
If you have access to the geometries of the buildings there are many ways you could implement highlighting.
One way that comes to mind. Create a layer on top of your background layer with the same geometries as data source. Use a ThemeStyle to show only the selected geometry. The ThemeStyle class is created with a callback method which determines the style. In that method you should return no style unless the feature id is the same as selected feature id.
You can take a look at the ThemeStyle sample for a more general use of themes (no highlighting).
Also you could look at Mapsui.Sample.Wpf.Editing. Here is a screenshot of that sample:
I just started to use gtk3, and I overwhelmed. I want to draw a pixel rendering (a function graph, drawn in realtime) in a window. I was able to create a window, following some examples, but I can't find information on pixel drawing. I need keywords to google (is it called 'canvas'? Pixel map? Drawing area?), and some advises on how to do it right. Should I keep a separate buffer and do copy every time I need to update window? Or can I just draw into existing gtk object?
For the examples you can generally check the documentation page of the crate itself. There are examples shown in crate documentation.
You can check the documentation of the crate from here.
You can draw your shapes on to the drawing area which is shown as example here on the documentation itself
As far as I have seen, it is pretty much ported with same function and struct names for GTK 3.0.
I need keywords to Google
You can basically google for the GTK library itself and the examples to get the insight about GTK and the easily implement with the help of documentation.
Getting started with GTK 3.0
The image component allows Free Ratio cropping out of the box. I'm a bit baffled at why there is no Aspect Ratio option (keeping height and width constrained to each other), which would work much better for us. Is this an existing feature that can be enabled, or a custom task in Java?
I am using CQ 5.4.
This is OOTB since 5.4 (atleast), though not well documented.. Set up your smart image widget like so:
<image-16x10
jcr:primaryType="cq:Widget"
allowFileReference="{Boolean}true"
cropParameter="./image-16x10/imageCrop"
fileReferenceParameter="fileReference"
name="./image-16x10/file"
requestSuffix=".img.png"
rotateParameter=""
title="16x10"
xtype="html5smartimage">
<cropConfig
jcr:primaryType="nt:unstructured">
<aspectRatios
jcr:primaryType="nt:unstructured">
<aspectRatio-16x10
jcr:primaryType="nt:unstructured"
text="16x10"
value="16,10"/>
</aspectRatios>
</cropConfig>
</image-16x10>
The cropConfig node structure is what youre interested in. text="16x:10" is what will appear in the Crop dropdown, value="16,10" is the actual fixed Crop size for the tool. You can add as many predefined crops you want per html5smartimage widget.
The image-16x10 and aspectRatio-16x10 names aren't required, but not a useful convention to help in maintainability of the config.If you allow multiple aspectRatios then the image-16x10 naming probably doesnt make as much sense tho its not a bad idea to provide semantic naming to your aspectRatio definition node.
If you'd like to generate images with different aspectRatios, try this...
http://experience-aem.blogspot.com/2013/09/cq-image-custom-aspect-ratios-crop.html
The crop parameters are saved in different properties and not "cropParameter" of the html5smartimage widget
That would be a custom JavaScript widget: the one you're using (smart image) does not have an aspect ratio functionality (or just I never seen one), even in 5.6.
You could extend the existing widget, and provide this functionality in your own, using Javascript though -- it's not trivial, but not rocket science either -- see source code for smart image to see how it extends smart panel, and then registers itself into the framework.
I have an existing component that draws Direct2D content to an ID2D1RenderTarget and I would like to save that drawing to an image file. The questions here, here and here, although they helped me, did not provide a clear answer as how to do it.
My nullth idea was to try the official MSDN method. Unfortunately, it is not available in Win7.
My first idea was to modify the drawing routine to make it accept the RenderTarget as a parameter and use ID2D1Factory::CreateWicBitmapRenderTarget to draw directly into a IWICBitmap, but it turns out to be quite difficult for me (because it would be necessary to modify not only the drawing routine itself, but also the drawing callbacks of all users of that component (the code, written in Delphi, uses Embarcadero's TDirect2DCanvas, and thus did not need to manage all Direct2D resources, like render target or brushes)).
My second idea was to create an ID2D1Bitmap, fill it with what is already drawn using ID2D1Bitmap::CopyFromRenderTarget and then draw that ID2D1Bitmap to a WicBitmapRenderTarget (this is about what was done here). I had the same kind of problems as those who asked the questions I link to: different resources affinities, as briefly explained Kenny Kerr.
So is it possible under Win7 without having to implement my first idea, and how would you do it?
Direct2D 1.1 is supported on Windows 7 if you install the Platform Update. Unfortunately, that doesn't solve your problem without first creating two more of them: 1) it's still pre-release/beta, and 2) it adds another installation dependency for you to worry about.
I'm in the concept phase of a Mac application that should let the user easily select and layout images for printing. It's a document-based app and a document can have multiple pages with lots of pictures in different sizes and rotations on it. The UI would kind of be like the UI of Pages.app.
Those pictures can possibly be large hi-res images. The user should also be able to print them in the best quality that the images offer.
I have re-watched some WWDC sessions about Quartz, 2D drawing optimization and NSView.
I know that there are a few different ways of accomplishing what I want to do, namely:
Use a custom view for a "page" and draw the images in drawRect: with Core Graphics/Quartz. Use CG transforms to rotate and scale images.
Also use a custom view for a "page", but use NSImageView-subviews to display the images. Use Core Animation and layer transforms to scale/rotate images.
What is the best practice for this? Drawing with Core Graphics or using NSViews? Why?
Thank you so much!
Johannes
Depends on how interactive these pages should be. If there is a lot of mouse interaction, e.g. dragging, selecting etc. I'd go with views. If you want fluid animations I'd even use plain CALayers with their content set to one image. This would also let you zPosition the images in case they overlap. A view based solution makes z-ordering hard.
The drawRect method should be fastest but you have hard times integrating user interaction and you must z-order manually.
This is a reply I got from opening one of my two Apple Technical Support Incidents:
Hi Johannes,
Thanks for contacting Apple DTS regarding your question about printing
and the different ways to construct your applications general UI (with
views).
There is a trend toward using layer-backed views in OS X (utilizing
Core Animation layers) which is motivated by the ability to easily
animate your application's user interface, with little work, when
needed. However in terms of printing, you would be better off to
implement drawRect for custom views so that the view contents can be
drawn at "full resolution" when rendered into the context for
printing.
If instead you use layer backed views at as those layers to
"renderInContext" the layer contents would be used to render, which
commonly will not be set to the full resolution of your source
documents/images. This is because layer backed views take additional
memory to store those bitmaps (cached layer contents), and because of
that, they are recommended to be sized appropriately for the screen
(which may not necessarily be sized appropriately for the printed
page).
Does this help guide your application architecture? Please let me
know.
So basically this means that using layer-backed views might result in sub-optimal printing quality. I've replied with some follow-up questions ("How setting wantsLayer = NO on the rootView right before printing help?") and will post the answers as soon as I get them.
All three approaches should work. Since you should be using scaled-down representations of large images anyway, I don't think there will be much difference. Do what you feel most comfortable doing.
My guess is just using layer-backed NSViews (one par draggable image) will probably work best for starters. If you find performance lacking, you can always micro-optimize. Note that you may have to make your views a tad larger than the images so you can draw the selection handles outside them.
This is all assuming that you will never want to do a more complex drawing.