Here's a function to create a widget (currently a wibox) based on screen #1. The floutage.sh script creates a blur image of a current screenshot of this screen.
When using this function, it's always the same blurred image showed: 1st blurred image processed, yet screen.png content changes.
function widget.createWidget(args)
local w = nil
local file = "/tmp/screen.png"
awful.spawn.easy_async_with_shell(
"sh /home/david/.config/awesome/widgets/floutage.sh " .. file,
function()
w = wibox({
x = 0,
y = 0,
width = 1200,
height = 1920,
border_width = 0,
screen = screen[1],
bgimage = file,
ontop = true,
visible = true
})
--
w:buttons(
gears.table.join(
awful.button({}, 1,
function()
w.visible = false
w = nil
end
)
)
)
--
end
)
--
return w
end
If I change file variable using a different name, the correct blurred image is shown:
local file = "/tmp/" .. os.date("%Y%m%d-%H%M%S") .. ".png"
How can I simply use "/tmp/screen.png"? (refresh image memory?)
bgimage = gears.surface.load_uncached(file),
I am making Uber like application. when user select pick up and destination address, then i draw route between these two addresses.
I have two separate info windows for both Source address and destination address.
This is working fine on my iphone 7 pluse and iphone 6s. But when i try to draw route on iPhone x, the route is drawn successfully but one of the info window is always incorrect.
I have tried every solution. I checked constraints too. everything is fine.
//Destination info window
let infoWindow1 = DestinationInfoWindow.instanceFromNib() as! DestinationInfoWindow
dest.iconView = infoWindow1
infoWindow1.DestinationLabel.text = locationStringwithDetail
infoWindow1.lblRemainingDistance.text = String(self.estimatedDistance.rounded(toPlaces: 1))
self.destinationName = locationStringwithDetail
self.destinationCoordinate = destinationCoordinate
dest.zIndex = 0
dest.position = destinationCoordinate
dest.map = self.mapView
// Source info window
let infoWindow = MapMarkerWindow.instanceFromNib() as! MapMarkerWindow
infoWindow.remaingDriverTimelbl.pushTransition(0.4)
if self.estimatedITime != 0 && self.estimatedITime < 30*60 {
var inMinuts:Int = self.estimatedITime/60
if inMinuts == 0{
inMinuts = 1
};infoWindow.remaingDriverTimelbl.text = "\(inMinuts)"
} else { infoWindow.remaingDriverTimelbl.text = "~" }
self.sourceName = locationName
self.sourceAdress = locationAdress
mySrc.iconView = infoWindow
mySrc.zIndex = 1
infoWindow.sourceTitle.text = locationStringwithDetail
mySrc.position = sourceCoordinate
mySrc.map = self.mapView
There is no error. the issue is only on `iPhone X` device and simulator.
Here is screen shot for `iPhone 7+`:
Here is xib file
I'm trying to implement some simple screen mirroring in my swift application but I'm getting undesired behavior. When my code executes, the external display gets the phone view but the iphone screen goes black. Also in the external view it's filled in with black. Here's a screenshot:
Here's my code to setup the external view:
func initializeExternalScreen(external: UIScreen){
self.mirroredScreen = external;
// Find max resolution
var max = CGSize()
var maxScreenMode = UIScreenMode()
for current in self.mirroredScreen.availableModes {
if (current.size.height > max.height || current.size.width > max.width) {
max = current.size;
maxScreenMode = current;
}
}
self.mirroredScreen.currentMode = maxScreenMode;
self.mirroredWindow = UIWindow(frame: self.mirroredScreen.bounds)
self.mirroredWindow.hidden = false
self.mirroredWindow.layer.contentsGravity = kCAGravityResizeAspect
self.mirroredWindow.screen = self.mirroredScreen
self.mirroredScreenView = UIView(frame: self.mirroredScreen.bounds)
self.mirroredScreenView.addSubview(self.view)
self.mirroredWindow.addSubview(self.mirroredScreenView)
}
Any ideas?
I am allowing users to select their profile picture, but when I import it and cut the borders and make it round, it looks very weird. Is there a proper way to do this?
propic.layer.borderWidth = 2
propic.layer.masksToBounds = false
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.clipsToBounds = true
Try this
propic.layer.borderWidth = 2
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.layer.masksToBounds = true
I am trying to move a display object that is hiding over the right side of the screen, into the scene. It works wonderfully with images (i.e. the background), but not with texts (the coords seem correct from debugging them with print(), but they never display, I already tried the obj:toFront).
I thought that they may work inside display objects, so I put everything in a display Object: Nothing. Just the text? Neither. Anyone knows why/how to override this?
function tscreen:init()
local textGroup = display.newGroup()
local menuBackground = self:getBtn("src/bgMenu.png")
menuBackground.isVisible = false
menuBackground.anchorX = 0.5
menuBackground.anchorY = 0.5
self.menuBackground = menuBackground
local optionsText = {
parent = textGroup,
text = "Hello World",
x = centerX,
y = centerY,
width = 128,
font = native.systemFontBold,
fontSize = 14,
align = "center"
}
local workText = display.newText( optionsText )
workText:setFillColor( 1, 0, 0 )
setPos(textGroup, W, 0)
--setPos() is a custom function that assigns x and y coords
textGroup.isVisible = false
self.textGroup = textGroup
end
function tscreen:show()
local menuBackground = self.menuBackground
local textGroup = self.textGroup
local inTime = 1200
setPos(menuBackground, 2*W + centerX, centerY)
menuBackground.isVisible = true
setPos(textGroup, W, 0)
textGroup.isVisible = true
self:cancelTween(menuBackground)
self:cancelTween(textGroup)
menuBackground.tween = transition.to(menuBackground, {time = inTime, transition = easing.outExpo, x = centerX,
onComplete = function()
tscreen:cancelTween(menuBackground)
end
})
textGroup.tween = transition.to(textGroup, {time = inTime, transition = easing.outExpo, x = 0,
onComplete = function()
tscreen:cancelTween(textGroup)
print(getPos(textGroup), textGroup.width, textGroup.height)
end
})
end
I have the starters edition of Corona, so I don't have the recently implemented Composer API.
Maybe this isn't the most appropriate site to post this query since there already is a Corona SDK forum, but I'm trying anyway.
I'm not seeing anything wrong, but a group should not be necessary. Verify that the text can be seen ever: in the init(), do
local optionsText = {
text = "Hello World",
x = 0,
y = 100,
}
local workText = display.newText( optionsText )
workText:setFillColor( 1, 1, 1 )
If you can't see the text then something else is going on, maybe your init() is not being called or such. Once you see it, change the parameters to what you want (fill color etc), and test. If still works, add a transition, right after, in the init():
local easeXto100 = {
time = 2000,
transition = easing.outExpo,
x = 100,
onComplete = function() print('did you see text move from x=0 to 100?') end
}
transition.to(workText, easeXto100)
If you see it move, then move the relevant parts of code to your show(), if now it disappears this will give you clue.