How can I add a shadowed background to a TLayout or image, or any control for that matter ? What is the best way to do this, without having to stack images? I've found that a TPanel should have a border property but I am not finding that property. ? Am I missing something ? Or is there a different technique I should be using ?
I am working with Delphi Xe5 building an iOS application.
See a summary of effects in FireMonkey, FireMonkey Image Effects.
Quote:
"These effects are not limited to bitmap image data; effects can be applied to the pixels of any 2D control in the user interface."
In your case, the FMX.Effects.TShadowEffect is what you are looking for.
"Beside the properties provided by TEffect, TShadowEffect provides five specific properties: Direction, Distance, Opacity, ShadowColor, and Softness."
To learn how to apply an effect to your control, see Applying_FireMonkey_Image_Effects.
Related
When creating a custom FireMonkey style, you often run into style objects, such as TButtonStyleObject, that include one or more properties (such as TButtonStyleObject.NormalLink) that are collections of TBitmapLinks. Each individual TBitmapLink defines three properties, CapInsets, Scale, and SourceRect. SourceRect contains the coordinates of a segment of a bitmap that will be used to draw some aspect of the control (see Using TBitmapLinks with the FireMonkey Style Designer for more detail).
My question is, what does CapInsets do?
I think it is something related how to paint a resizable component using a single bitmap. The CapInsets should represent the stretchable portion of the bitmap leaving apart, in example, the borders so they do not get too thin or too large when you resize the component.
Think about a button and a 25x50 px bitmap to be the backround. Think it is a single color rectangle with a little border. What if you resize the button to be 25x500 px? The left and right border will become too large (and no more proportional to the top and bottom border).
I found no documentation except this article in russian (translation to italian is very bad, the english one isn't so clear to me as well), look for the "Background" section http://habrahabr.ru/post/137851/
HTH
How can change alphablend of a form without affect on control in form?
Delphi XE7
One solution to this problem is to use Multi-Device Application (if using VCL is not possible).
If you need to leave a transparent TForm just changing a property Transparency = True.
If you need to leave a semi-transparent component, all components have the Opacity property that can be assigned a more transparent value between 0 and 1, where 0 is closer to that component.
For example you could put the controls within a TLayout and change the Opacity of it as you see fit, and have no effect on the other components, or vice versa.
Actually the answer to this might be pretty simple...(for windows only)
The JEDI VCL library has a component (TJvTransparentForm) that allows you to take an Alpha blended PNG image (ie the gray background shown in your picture above) and use it to make a form control. The picture is actually stored in a TImage and you would need to place your "Icons" on the image itself. Then just respond to the mouse clicks on the TImage.
You have what your asking for (maybe?).
If you were tricky enough you could probably even track the mouse movement and change the Image to glow the correct "button" that the mouse was over.
You know how the iPad can invert colors? For the app I'm working on we wanted to have a button that would invert the colors for one of the views the same way. Does the sdk have any kind of support for something like that already?
I don't think that there is an easy way at the moment. CALayer has a compositingFilter property which is described as
A CoreImage filter used to composite
the receiver’s contents with the
background. Animatable.
It's available since iOS 2.0 but it also says:
While the CALayer class exposes this
property, Core Image is not available
in iOS. Currently the filters
available for this property are
undefined.
Core Image would have been ideal for that purpose, it does provide a filter (CIColorInvert) to invert colors.
Another apporach would be: Change the color properties of the UI controls you are using, though I doubt that everything will look they way you expect, as there may be gradients and such. You have to implement your own small algorithm to invert a given color.
I see only the hard way: You have to draw your controls manually with drawRect and invert the colors with your own algorithm there.
I have a form with an image as the background.
Now I need to put several transparent dark color areas in several areas off the form.
I need not to hide the background. How can I do this?
Standard Delphi control do AFAIK not support that kind of transparency. You therefore have two possiblities:
use third-party components
create your own component (you can derive from an existing one) and override the paint method. In the paint method just draw the correct part of the background image and darken every pixel to get the effect you want.
You can try Delphi 2009/2010 which supports using PNG images. The PNG image format allows for alpha layer transparency, which it sounds it what your looking for. This assumes that your wanting a fixed shape on your form.
EDIT-- For Delphi 2007, you can attempt to use the PNG Components which if I remember correctly do properly handle alpha transparency.
Is the background image and the darker areas the only thing that you want on your form, or do you have other components that should be blended too?
If it's only the background image and the dark areas, I would recommend that you check out Graphics32. It's an image control supporting layers. It should be fairly easy to archive what you want (or what I assume that you want...) from that.
I'm looking for ideas on how to draw a skinnable "button" in a game application. If I use a fixed sprite non-vector image for the button background, then I can't size the button easily. If I write code to draw a resizable button (like Windows buttons are drawn), then the programmer has to get involved -- and it makes skinning difficult. Another option is to break the button into 9 smaller images (3x3) and stretch them all -- kindof like rounded corners are done in HTML.
Is there another "easier" way? What's the best approach?
If you really want to accomplish this, the way to do it is with texture coordinates. Much like you would make a stretchable button/panel design in HTML with a table, you simply define the UV coordinates for the corners, the top stretchable area, the bottom stretchable area, the side stretchable areas, and then the middle.
For an example of this being implemented in an XNA engine (though it's a closed source engine), see this:
http://www.flatredball.com/frb/docs/index.php?title=SpriteFrame_Tutorial
Yes. I am working on an Editor. It's a XAML-like language (or OpenLaszlo-like, if you prefer) for XNA. So the buttons can be resized by the editor. The buttons might also be resized by a style sheet.
I guess you're right that it's likely that the buttons will all be the same size in a real design. But even in a window's app, you sometimes need to make a button wider to accomodate text.
It should be possible with shaders. You would probably have to do texel lookups, but it would cut down on the number of triangles in a complex UI.