Hello
I am trying to resize images, but i cannot get it work
The Size is adjusted but then I only see the half of the image or it is too small
I do not want to use PictureBox.StretchImage because i want to draw it on a picture without being related to the size of the PictureBox
here my Code:
Code:
Public NeedRefresh As Boolean
Public ObjectHeight As Integer = frmMain.pctDraw.Height / 5
Public BackBufferBitMap As Bitmap
Public BackBuffer As System.Drawing.Graphics
Dim TempBitmap As New Bitmap(32, 32)
Dim TempImage As Image
Public Sub LoadImage()
Dim myGraphics As Bitmap
myGraphics = New Bitmap(AppPath & "\img\test.jpg")
TempBitmap.Dispose()
TempBitmap = Nothing
TempBitmap = New Bitmap(32, 32)
Dim tempGraphics As Graphics = Graphics.FromImage(TempBitmap)
tempGraphics.DrawImage(myGraphics, 0, 0, New Rectangle(0, 0, 32, 32), GraphicsUnit.Pixel)
tempGraphics.Dispose()
myGraphics.Dispose()
End Sub
Thanx
SciLor
Again,
MSDN FORUMS is your friend:
http://social.msdn.microsoft.com/Search/en-US/?Refinement=112&query=resize+image+
MSDN isnt my friend all routines wont work on .net compact framework
but thank you
Resize image?
Hi
Just wonder if you figured out how to do it?
Im trying to do a imageblog application...
/Sebulba_se
Take a look at my ScrollingDemo
http://forum.xda-developers.com/showthread.php?p=3041373
I just use a "ImageList" control to do this without thinking just put it in and get it from there again
another idea would be to do this with LockBits
http://msdn.microsoft.com/en-us/library/5ey6h79d(VS.80).aspx
but I still use the control..
Ok, so I'm trying to write a simple app to display the data from all of the sensors on a device. My problem is that whenever I try to instantiate my SensorManager object, my app's screen goes black, followed shortly by the Force Close / Wait dialogue.
My code:
Code:
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//initialize graphics
setContentView(R.layout.main);
xaccelDisplay = (TextView) findViewById(R.id.xaccelDisplay);
yaccelDisplay = (TextView) findViewById(R.id.yaccelDisplay);
zaccelDisplay = (TextView) findViewById(R.id.zaccelDisplay);
//set up sensor manager
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
/*sensorManager.registerListener(this,
sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0),
SensorManager.SENSOR_DELAY_GAME);*/
}
Anyone have suggestions? I've looked for demo programs for how to access the sensors, but they all seem to use the sensor functions labeled as deprecated by the official Android website... maybe I'm missing something obvious.
Hey guys,
I have a small app I have been working on that uses the front camera. The way I have been obtaining use of the front camera seems to work on most phones, but users have been reporting trouble on the S3 and various other new devices. The way I have been accessing the front camera is like so:
Code:
// Find the ID of the front camera
CameraInfo cameraInfo = new CameraInfo();
for(int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
defaultCameraId = i;
mCameraFound = true;
}
}
if(!mCameraFound)
displayDialog(8);
From some of the error reporting I've added into the app, I've noticed the S3 actually finds the front camera, but users report it only shows a blank screen? I was hoping someone here may have some experience with this or may be able to help me solve this issue. If you want to try the app out on your S3, check the link below. Thanks in advance.
it seems I have a single bug that I can't seem to clarify and fix
Code:
public static final class id {
public static final int Nexus 5 (5_0")=0x7f070001;
public static final int dummy_button=0x7f070003;
public static final int fullscreen_content=0x7f070000;
public static final int fullscreen_content_controls=0x7f070002;
public static final int switch2=0x7f070004;
in the second line, it underlines( Nexus 5 (5_0")=0x7f070001; ) and show it as a bug when I run the app. what did I do wrong, was renaming the device in the design section cause an error to happen in the code?
Hi,
I'm playing with a MTK ROM (4.2.2), I have to modify it in various ways, but I'm new to the whole area and I'm taking it one thing at a time. I'd really appreciate any help and advice I can get.
Currently I have to find out how to change the default rotation of the camera image/feed. The device has only one camera, the CameraInfo.orientation value is set to 90 and the image is upside-down. I want to find a way to set it to 270, so it would be ok.
So far I've found this in /frameworks.av.camera/ICameraService.cpp:
Code:
// get information about a camera
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) {
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeInt32(cameraId);
remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);
cameraInfo->facing = reply.readInt32();
cameraInfo->orientation = reply.readInt32();
return reply.readInt32();
}
and this in /frameworks/base/core/jni/android_hardware_Camera.cpp:
Code:
static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
jint cameraId, jobject info_obj)
{
CameraInfo cameraInfo;
status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo);
if (rc != NO_ERROR) {
jniThrowRuntimeException(env, "Fail to get camera info");
return;
}
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
env->SetBooleanField(info_obj, fields.canDisableShutterSound,
canDisableShutterSound);
}
Neither of those are actually the place where the CameraInfo.orientation is being set, which is what I'm looking for. Also I want to find out where can I set the camera to be facing front or back.
Again, I'd really appreciate any pointers you could give me. Thanks!
Chris_M. said:
Hi,
I'm playing with a MTK ROM (4.2.2), I have to modify it in various ways, but I'm new to the whole area and I'm taking it one thing at a time. I'd really appreciate any help and advice I can get.
Currently I have to find out how to change the default rotation of the camera image/feed. The device has only one camera, the CameraInfo.orientation value is set to 90 and the image is upside-down. I want to find a way to set it to 270, so it would be ok.
So far I've found this in /frameworks.av.camera/ICameraService.cpp:
Code:
// get information about a camera
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) {
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeInt32(cameraId);
remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);
cameraInfo->facing = reply.readInt32();
cameraInfo->orientation = reply.readInt32();
return reply.readInt32();
}
and this in /frameworks/base/core/jni/android_hardware_Camera.cpp:
Code:
static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
jint cameraId, jobject info_obj)
{
CameraInfo cameraInfo;
status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo);
if (rc != NO_ERROR) {
jniThrowRuntimeException(env, "Fail to get camera info");
return;
}
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
env->SetBooleanField(info_obj, fields.canDisableShutterSound,
canDisableShutterSound);
}
Neither of those are actually the place where the CameraInfo.orientation is being set, which is what I'm looking for. Also I want to find out where can I set the camera to be facing front or back.
Again, I'd really appreciate any pointers you could give me. Thanks!
Click to expand...
Click to collapse
Hello,
Please refer here [Guide]How To Port & Modify Roms For Mediatek[Everything] and read the entire thread carefully.
If you still run into queries please post in the thread itself, the experts there might be able to assist you.
Regards
Vatsal,
Forum Moderator.
Thanks, Vatsal!
Just to share - in the end I found that all the camera settings are in ../mediatek/custom/mt6572/hal/imgsensor/src/cfg_setting_imgsensor.cpp
Glad you found the fix mate.
Thread closed!