brightness

Programmatically change Mac display brightness

眉间皱痕 提交于 2019-11-28 19:19:01
问题 How to change Mac display brightness from cocoa application? 回答1: CGDisplayIOServicePort is deprecated in OS 10.9 – so you have to use IOServiceGetMatchingServices to get the service parameter for IODisplaySetFloatParameter . Here's a basic function that looks for services named "display" and changes their brightness. - (void) setBrightnessTo: (float) level { io_iterator_t iterator; kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IODisplayConnect")

Get preferred screen brightness in Android

懵懂的女人 提交于 2019-11-28 17:36:47
How do you get the preferred screen brightness in Android? To change the screen brightness I use WindowManager.LayoutParams.screenBrightness . According to the documentation: This can be used to override the user's preferred brightness of the screen. A value of less than 0, the default, means to use the preferred screen brightness. 0 to 1 adjusts the brightness from dark to full bright. When screenBrightness is less than 0 I would like to start with the preferred screen brightness. How can I get this value? I'll try to answer because I already searched for this some time ago. My short answer

JavaScript Calculate brighter colour

ε祈祈猫儿з 提交于 2019-11-28 06:12:11
I have a colour value in JS as a string #ff0000 How would I go about programatically calculating a brighter/lighter version of this colour, for example #ff4848 , and be able to calculate the brightness via a percentage, e.g. increase_brightness('#ff0000', 50); // would make it 50% brighter function increase_brightness(hex, percent){ // strip the leading # if it's there hex = hex.replace(/^\s*#|\s*$/g, ''); // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF` if(hex.length == 3){ hex = hex.replace(/(.)/g, '$1$1'); } var r = parseInt(hex.substr(0, 2), 16), g = parseInt(hex.substr(2, 2), 16), b

Brightness Screen Filter

懵懂的女人 提交于 2019-11-28 03:36:33
Does anyone have an idea how to implement an Brightness Screen Filter like the one here: http://www.appbrain.com/app/screen-filter/com.haxor I need a starting point and I can't figure out how to do it. Just make a transparent full screen activity that lets touches pass through. To make touches pass through use the following Window flags before setting the contentView: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow(); // Let touches go through to apps/activities underneath. window.addFlags(FLAG_NOT_TOUCHABLE); // Now set

Android 2.2: Adjusting screen brightness

亡梦爱人 提交于 2019-11-28 02:09:20
public void SetBright(float value) { Window mywindow = getWindow(); WindowManager.LayoutParams lp = mywindow.getAttributes(); lp.screenBrightness = value; mywindow.setAttributes(lp); } I want to adjust the screen brightness. But nothing happens when i try using this method. Could it be because i use the KEEP_SCREEN_ON flag? Make sure that "Auto Brightness" is not enabled prior to setting the screen brightness. You can do this manually in Settings>Display or using code if you are using Android 2.2 or above SDK. Something like: int brightnessMode = Settings.System.getInt(getContentResolver(),

Determining Image Luminance/Brightness

萝らか妹 提交于 2019-11-27 13:32:07
问题 My iphone application captures the realtime data from camera using AVFoundation's AVCaptureSession. I'm able to access that data in it's delegate method in runtime and create an image out of it. It can be CGImage, UIImage or just raw data (CMSampleBufferRef). What I'm trying to do is to calculate luminance, brightness of that data (image). Or it can be some other value that can indicate me how bright the input light is. Is there any standard way to get this value? Perhaps using OpenGL. Thanks

Android: detect brightness (amount of light) in phone's surroundings using the camera?

╄→гoц情女王★ 提交于 2019-11-27 07:42:58
The following applies to the Android operating system. I am trying to estimate how dark (or light) it is in the room where the phone is located using the camera. The idea is that the camera can return a certain brightness level, which I can use to determine the amount of light in the surroundings of the phone. My question is simple: how do I use the camera (either the front of back camera) to get this amount of brightness (the "amount of light")? Thanks in advance. kcoppock Here is how you register a listener on the light sensor: private final SensorManager mSensorManager; private final Sensor

Adjust brightness contrast and gamma of an image

99封情书 提交于 2019-11-27 07:42:39
What is an easy way to adjust brightness contrast and gamma of an Image in .NET Will post the answer myself to find it later. c# and gdi+ have a simple way to control the colors that are drawn. It’s basically a ColorMatrix. It’s a 5×5 matrix that is applied to each color if it is set. Adjusting brightness is just performing a translate on the color data, and contrast is performing a scale on the color. Gamma is a whole different form of transform, but it’s included in ImageAttributes which accepts the ColorMatrix. Bitmap originalImage; Bitmap adjustedImage; float brightness = 1.0f; // no

What API call would I use to change brightness of laptop (.NET)?

只愿长相守 提交于 2019-11-27 03:24:55
问题 I have Windows Server 2008 installed on a Sony laptop and the brightness control doesn't work. I'd like to write a program to allow me to change it. Currently what I have to do is open the Power control panel, click advanced settings, and fight through so many UAC boxes that anybody watching me must think I'm completely crazy. I just want a simple little program to do it but i dont know what API to call 回答1: I looked up John Rudy's link to WmiSetBrightness in MSDN and came up with this:

JavaScript Calculate brighter colour

我与影子孤独终老i 提交于 2019-11-27 01:13:32
问题 I have a colour value in JS as a string #ff0000 How would I go about programatically calculating a brighter/lighter version of this colour, for example #ff4848 , and be able to calculate the brightness via a percentage, e.g. increase_brightness('#ff0000', 50); // would make it 50% brighter 回答1: function increase_brightness(hex, percent){ // strip the leading # if it's there hex = hex.replace(/^\s*#|\s*$/g, ''); // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF` if(hex.length == 3){ hex =