VideoDisplay fullscreen - apache-flex

How does one do fullscreen with VideoDisplay?
I am using:
stage.fullScreenSourceRect = new Rectangle(video.x, video.y, video.width, video.height);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.displayState = StageDisplayState.FULL_SCREEN;
But this does not allow me to go back to normal screen, not even i use:
stage.displayState = StageDisplayState.NORMAL
Thanks,

I cannot test this right now but you have written stage.displayState == StageDisplayState.NORMAL with == instead of =.
Instead of assigning the value StageDisplayState.NORMAL to stage.displayState you simply compare the two.

From the playbook dev support forums, you do not use StateDisplay in playbook for video maximization because the screen already runs in StageDisplay.FULLSCREEN_INTERACTIVE so it doesn't work - set the video dimensions to the size of the screen. And then back again to reduce.

Related

GDI compatiable with direct2d not working when using pushlayer and poplayer

I am working on a project, and try to convert GDI rendering into direct2d rendering.
Sometimes I need to use ID2D1GdiInteropRenderTarget interface to rendering some GDI content to direct2d's render target.
Here is the problem:
If I use GetDC() ReleaseDC() between PushLayer and PopLayer. The content rendered to the HDC is gone, not composited into rendertarget. But If I use GerDC() ReleaseDC between PushAxisAlignedClip and PopAxisAlignedClip, it works correctly.
Why It doesn't work between PushLayer and PopLayer, I need to use pushlayer to clip a round rect regeion.
Code is like as follows:
ID2D1HwndRenderTarget* render_target = NULL;
ID2D1GdiInteropRenderTarget* gdi_render_target = NULL;
//create ID2D1HwndRenderTarget and query ID2D1GdiInteropRenderTarget...
render_target->BeginDraw();
D2D1_LAYER_PARAMETERS params = D2D1::LayerParameters(round_rect, round_rect_geometry);
render_target->PushLayer(params, render_layer_);
HDC hdc = NULL;
gdi_render_target->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &hdc);
// Draw Line with hdc. some code is Omit.
::MoveToEx(hdc, rc.left, rc.top, &ptTemp);
::LineTo(hdc, rc.right, rc.bottom);
gdi_render_target->ReleaseDC(0);
render_target->PopLayer();
render_target->EndDraw();

Awesome WM - Application's fullscreen mode without taking whole screen

i'm looking for a way to let applications using their own fullscreen mode but without resizing their own windows.
For example, i want to watch a video on a web browser in fullscreen mode to hide all other bars/content of the browser/website except the video but i want to keep my display layout to see other apps at the same time.
Any ideas?
Thanks !
I did not test the following, but it might work. The idea of the rule is that it is used to detect which windows should not be fullscreend. It is a normal awful.rules-rule. All clients which do not match the rule are handled normally by awful.ewmh.geometry.
local rule = { class = "Firefox" }
client.disconnect_signal("request::geometry", awful.ewmh.geometry)
client.connect_signal("request::geometry", function(c, context, ...)
if context ~= "fullscreen" or not awful.rules.match(c, rule) then
awful.ewmh.geometry(c, context, ...)
end
end)
Edit: To toggle this behaviour I suggest the following:
local no_fullscreen = true
local rule = { class = "Firefox" }
client.disconnect_signal("request::geometry", awful.ewmh.geometry)
client.connect_signal("request::geometry", function(c, context, ...)
if not no_fullscreen or context ~= "fullscreen" or not awful.rules.match(c, rule) then
awful.ewmh.geometry(c, context, ...)
end
end)
Then add a key binding with callback function function() no_fullscreen = not no_fullscreen end.

No restore button in maximised window

When I maximise one of my mdi client windows. I am then stuck with it maximised, I need to be able to restore it to view the other windows.
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = CWindowHandler::MsgRouter;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = childClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
hChild = CreateMDIWindow(childClassName, "Segments", WS_OVERLAPPEDWINDOW, m_winRect.left, m_winRect.top, m_winRect.right - m_winRect.left, m_winRect.bottom - m_winRect.top, CWindowHandler::GetInstance()->GetMDIClient(), m_hInstance, (LPARAM)this);
i fixed this by calling return DefMDIChildProc(m_Hwnd, msg, wParam, lParam); in the case WM_SIZE: of the wndprocs of the child window. god knows why but it worked.
I believe you're going to have to add the style MDIS_ALLCHILDSTYLES in order to get the window styles you want. From MSDN...
The style of the MDI child window. If the MDI client window is created
with the MDIS_ALLCHILDSTYLES window style, this parameter can be any
combination of the window styles listed in the Window Styles page.
Otherwise, this parameter is limited to one or more of the following
values.

Applying blur filter to BitmapData

Here's the code I am using to blur an image using BitmapData. The function is called on a Slider_changeHandler(event:Event):voidevent and the value of the slider is passed to the function as blurvalue.
The problem is the function works but seems to be cummalative (if that's the correct word!), that is, suppose I slide it to the maximum and after that try to reduce the blur by sliding it back towards the front the blur still keeps increasing. How do I make it to work so when I will slide it up blur increases and when I slide it back blur decreases and when slider is at 0, no blur is applied.
var blur:BlurFilter = new BlurFilter();
blur.blurX = blurvalue;
blur.blurY = blurvalue;
blur.quality = BitmapFilterQuality.MEDIUM;
bitmapdata.applyFilter(bitmapdata,new
Rectangle(0,0,bitmapdata.width,bitmapdata.height),new Point(0,0),
blur);
return bitmapdata;
how about returning a clone of the original bitmapData with the filter applied ?
e.g.
var result:BitmapData = bitmapdata.clone();
var blur:BlurFilter = new BlurFilter();
blur.blurX = blurvalue;
blur.blurY = blurvalue;
blur.quality = BitmapFilterQuality.MEDIUM;
result.applyFilter(result,new
Rectangle(0,0,bitmapdata.width,bitmapdata.height),new Point(0,0),blur);
return result;
Also, if you're using the BlurFilter, you might need a larger rectangle, depending on the amount of blur. For that, you can use the generateFilterRect() method to get correct sized rectangle for the filter.
If I were you, I'd take the BitmapData and put it in a Bitmap object, then add the filters:
var bitmap:Bitmap = new Bitmap(bitmapData);
var blur:BlurFilter = new BlurFilter();
blur.blurX = blurvalue;
blur.blurY = blurvalue;
blur.quality = BitmapFilterQuality.MEDIUM;
bitmap.filters = [blur];
By doing this (interchanging the filters array), you're not making the filters cumulative.

Mystery coordinate offset on getCharBoundaries

I've ran into a weird problem with getCharBoundaries, I could not figure out what coordinate space the coordinates returned from the function was in. What ever I tried I could not get it to match up with what I expected.
So I made a new project and and added simple code to highlight the last charater in a textfield, and all of a sudden it worked fine. I then tried to copy over the TextField that had been causing me problems, into the new project. And now the same weird offset appeared 50px on the x axis. Everything else was spot on.
So after some headscracthing comparing the two TextFields, I simply can not see a difference in their properties or transformation.
So I was hoping that someone might now what property might affect the coordinates returned by getCharBoundaries.
I am using Flash CS4.
I've just had exactly the same problem and thought I'd help out by offering what my findings are. With a help from this thread, I tried to find everything that wasn't 'default' about the textfield I was using. I found that when I had switched my TextFormatAlign (or 'align' in the IDE) and TextFieldAutoSize properties to 'LEFT' as opposed to 'CENTER', it solved the problem.
A little late in the game perhaps, but worth knowing for anyone running into the same problem. This was the only thread I could find that raised the right flag...
Well the getCharBoundaries returns the boundaries in the textfield coordinate system. Where the origin is topleft corner of the textfield.
getCharBoundaries does not take into consideration the scrolling. you need to check if there are scrollbars on its parent (textarea) and if so relocate. One quick way of doing it is using localtoglobal and globaltolocal. Use the first to translate from the textfield coordinate system to the application coordinate system and then use the second to translate from the app coordinate system to the coordinate system of the parent of the textfield which is the textarea. I'm fine tuning a my method to get char boundaries i will publish it today on my blog
http://flexbuzz.blogspot.com/
Works For Me(tm) (Flex Builder AS3 project):
[Embed(systemFont="Segoe UI", fontWeight="bold", fontName="emb",
mimeType="application/x-font")]
private var EmbeddedFont:Class;
public function ScratchAs3()
{
stage.scaleMode = 'noScale';
stage.align = 'tl';
var m:Matrix = new Matrix(.8, .1, -.1, 1.1, 26, 78);
var t:TextField = new TextField();
t.autoSize = 'left';
t.wordWrap = false;
t.embedFonts = true;
t.defaultTextFormat = new TextFormat("emb", 100, 0, true);
t.transform.matrix = m;
t.text = "TEST STRING.";
addChild(t);
var r:Rectangle = t.getCharBoundaries(8);
var tl:Point = m.transformPoint(r.topLeft);
var tr:Point = m.transformPoint(new Point(r.right, r.top));
var bl:Point = m.transformPoint(new Point(r.left, r.bottom));
var br:Point = m.transformPoint(r.bottomRight);
graphics.beginFill(0xFF, .6);
graphics.moveTo(tl.x, tl.y);
graphics.lineTo(tr.x, tr.y);
graphics.lineTo(br.x, br.y);
graphics.lineTo(bl.x, bl.y);
graphics.lineTo(tl.x, tl.y);
}
To literally answer your question, it returns the coordinates in the TextField's coordinate system, not it's parent, and it is affected by DisplayObject.transform.matrix, which is the backing for the .x, .y, .scaleX, .scaleY, .width, .height, and .rotation properties.
What ever it was the solution was simple to add a new TextField, never found out what property screwed everything up.
The first answer is correct in most cases. However if your field is parented to another movie clip it may still return the wrong y coordinate. try this code:
//if this doesn't work:
myTextFormat = new TextFormat();
myTextFormat.align = TextFormatAlign.LEFT;
myFieldsParent.myField.autoSize = TextFieldAutoSize.LEFT;
myFieldsParent.myField.setTextFormat( myTextFormat);
//try this:
var x = myFieldsParent.myField.getCharBoundaries(o).x;
var y = myFieldsParent.myField.getCharBoundaries(o).y;
var myPoint:Point = new Point(myField.getCharBoundaries(o).x,myField.getCharBoundaries(o).y);
var pt:Point = new Point(myFieldsParent.myField.getCharBoundaries(o).x, myFieldsParent.myField.getCharBoundaries(o).y);
pt = myFieldsParent.myField.localToGlobal(pt);
//pt is the variable containing the coordinates of the char in the stage's coordinate space. You may still need to offset it with a fixed value but it should be constant.
I didn't test this code as I have adapted this example from code that is embedded into my project so I apologize if I'm missing something...

Resources