|
From top of my head, there is a LR_CREATEDIBSECTON flag you will have to pass to LoadImage to ensure that you get a DIB back. Good thing about getting back a DIB is that bitmap has the same color resolution as contained in the bitmap file without going through the color transformations when creating a DDB compatible to screen.
|
|
|
|
|
I thought about that, but I thought if I am going to understand this at all, i need to get down to the bytes. So a created a function to load from the file directly. Now I can be absolutely certain about what sort of bitmap I am dealing with.
|
|
|
|
|
If it is a bitmap file, I suggest you to read the bits of the file using the file operations rather than GDI functions. If I remember there is a sample in sdk for this.
|
|
|
|
|
In this instance, yes it is a bitmap file. But I am creating a function which is able to go through the pixels of any of the bitmap formats. So really, I don't need a function to load from a file, but for testing purposes it is probably the best way.
|
|
|
|
|
I use photoimpact for all of my drawing needs, this program allows me to save a bitmap into any given format. Now I know that bitmaps can be either 1,4,8,16,24 or 32 bits per pixel. Photoimpact only gives me the option to save the 16bbp as grayscale. Am I right in assuming all 16bit bitmaps are grayscale? And, it allows me to save as '48bit true colour' for which I am unable to find any documentation about how the bytes are structured.
|
|
|
|
|
First of all - a DIBSection is a HBITMAP that also has a pointer to the underlying bits. GetBitmapInfo is the name of the method that returns the pointer, but you need for the HBITMAP passed to it to be a DIBSection. Certainly taking a close look at any DIBSecton wrapper will help you to work this all out.
No, 16bpp are certainly not all greyscale, there is no greyscale only format, although any format apart from 8 bit is a waste of space, there are only 256 shades of grey.
48 bit is obviously a construct of Photoimpact, and if it's inventing a way to store more color info than your monitor/PC is capable of displaying, perhaps it's doing that for grey as well. In fact, non PC systems do display greater color depth and 16 bit grey is common in medical applications. This does not change that your PC has no way of displaying more than 8 bit grey, although tone mapping algorithms exist to improve the quality of 16 bit images when shown on an 8 bit system.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
G'Day I'am having a problem with a program that I'm working on for class. I do not expect to be given the solution. If someone could just steer me in the right direction.
An employee's gross wage is computed at the regular pay rate for the first 40 hours and 1.5 times the regular rate for each hour over 40.Thus, an employee who worked 50 hours at $5 per hour would have a
gross pay of $275.
For this part of the program I used an if/else statement:
if (hoursWorked <= 40)
{
grossPay = (hoursWorked * payRate);
}
else if (hoursWorked > 40)
{
grossPay = (hoursWorked * payRate) * 1.5;
}
This code compiles but does not give me the correct output. Any suggestions would be appreciated.
Thank - you,
billy73
|
|
|
|
|
you need to write like this,
if (hoursWorked <= 40)
{
grossPay = (hoursWorked * payRate);
}
else if (hoursWorked > 40)
{
int nHoursWithextraWage=hoursWorked-40;
grossPay = ( 40* payRate) + nHoursWithextraWage * payRate * 1.5;
}
I suggest following code will do,
int nHoursWithextraWage=hoursWorked-40;
nHoursWithextraWage= (nHoursWithextraWage < 0 ) ? 0 : nHoursWithextraWage;
grossPay = ( 40* payRate) + nHoursWithextraWage * payRate * 1.5;
|
|
|
|
|
If hours worked is neither less than or equal to 40 then it must be greater than 40 so the statement
else if (hoursWorked > 40)
is redundant. Just "else" will do
|
|
|
|
|
Wow. A one vote.
So whoever voted a one... so are you suggesting you program like this...?
if (true) {
} else if (false) {
}
how silly are we getting here. Sheesh!
|
|
|
|
|
billy73 wrote: grossPay = (hoursWorked * payRate) * 1.5;
Your problem is here. Do you really mean to pay 1.5x salary for every hour worked?
|
|
|
|
|
Hello guys.
I recently purchased a mouse for my laptop (MS notebook wireless optical 4000) it has a freat little feature, the mouse has a zoom button on the side of it, when its clicked a transparent window appears around the mouse pointer, and everything inside the window is magnified to the users preference. If you hold down the button, it gives you the ability to increase the zoom windows size and magnification via moving the mouse and the scroll wheel.
I also have a Intel Mac Mini dual Boot connected to my 32" HDTV, with this I use an Ione 2.4ghz wireless keyboard which has a little joystick to use as a mouse. The setup works great as a HTPC but when I do general windows tasks like browsing etc sometimes viewing can be alittle small from the couch potato position I sit at.
I recently connected my laptop to the screen and tried the MS mouse zoom from the same distance and it was a joy to use on the 32", however it wasnt really practical in the long run having my loptop connected up.
So im thinking what if I could take the features of ms zoom and create a small application to work with my wireless keyboard?
I know there are other 3rd party appz on the market, but none of them act quite like ms is one.
I have not been into my programming in a while, but I have just purchased VS2005 and will attempt the project in VC++ as its the only language I really know and I have the entire v6 reference Set gathering dust so I might aswell get some use out of it
Have any of you used a microsoft mouse with zoom onboard?
Im looking for tips on how to go about the project, Im very rusty and dont want to start off going down a dead end
|
|
|
|
|
wow thanks for all your help
|
|
|
|
|
hi, please comment if anyone knows or has encountered the following problems in VC++. ( i seriously doubt it though)
1. I have built an app with UNICODE enabled, and it has a treectrl. Strangely, when i set the text of items using any of the standard ways [ example text: (My group)]
the display shows the text as [((My group], that is, the bracket comes back in first place. This behaviour happens with almost all non-alphanumeric characters.
ALSO THIS HAPPENS ONLY on systems which have additional regional languages support installed from the control panel (Supplemental language support)
if you edit the item, or gettext,the text returns correctly. Build the MBCS version
or uninstall additional languages support, the problem goes away. I thought of reporting BUG to Microsoft in TreeCtrl, but before being called a stupid by MS people ...
2. When i call HttpSendRequest() using MBCS version, everything is fine, but building teh unicode application makes the POST data NULL. the data is passed correctly to the function, but on the server i get nothing in POST or GET or REQUEST. Serious help needed as i think i am missing some important clue here.
Thanks in advance.
|
|
|
|
|
Hello everyone!
(Note: I first posted this question here)
But I'll repost it, hopefully more clearly...
So let's say I have an error-free Player class... It's located on the files Player.h and Player.cpp . But there's a problem, the files don't include correctly... I've tried putting the class along with another class in Game.h/cpp , and that compiled, but not otherwise... Here's the code at the top of my files:
[Main.cpp]<br />
#include "Includes.h"<br />
<br />
[Includes.h]<br />
#pragma once<br />
<br />
#include <iostream><br />
#include <string><br />
#include <stdlib.h><br />
#include <time.h><br />
#include <vector><br />
using namespace std;<br />
<br />
#include "SDL.h"<br />
#include "SDL_image.h"<br />
<br />
#include "Defines.h"<br />
#include "Structures.h"<br />
#include "HelperFuncs.h"<br />
#include "Vehicle.h"<br />
#include "Player.h"<br />
#include "Game.h"<br />
<br />
[Game.h]<br />
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
[Game.cpp]<br />
#include "Game.h"<br />
<br />
[Player.h]<br />
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
[Player.cpp]<br />
#include "Player.h"
I tried everything on the previous thread, nothing worked... The error in VC++ 2005 is:
1>c:\incoming\war game\Game.h(10) : error C2146: syntax error : missing ';' before identifier 'mainPlayer'<br />
1>c:\incoming\war game\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<br />
1>c:\incoming\war game\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(Note: The 10th line doesn't matter, as I said the thing works if I merge Game and Player...)
If you can help me, I'll give you a cookie! Thanks!
PS: At first, I thought it was a problem with SDL not being compatible with VC++ 2005 because SDL download page says VC 5/6/7, not 8, but it doesn't compile under Code::Blocks (MinGW) either, it gives a similar error...
Windows Calculator told me I will die at 28.
|
|
|
|
|
I assume that mainPlayer is an instance of player ? You're not using precompiled headers ? I'd put all these includes in the stdafx, if you were using them.
Does it have to be an instance of Player ? Could it be a pointer ? class Player; at the top of game.h, and the include of player.h in the CPP would then work fine.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
In game.h get rid of
class Player;
because you are not using Player as a pointer and you
#include "Player.h"
in the next line.
John
|
|
|
|
|
Choose[^] any kind you want! Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I'm a bit slow to reply today, I am sick. Has your problem been solved ? I thought so, from reading the replies, but if not, then yell.
Lord Kixdemp wrote: PS: Christian Graus, do you live here at CP?
Pretty close.
One other possible problem I thought of, does Player have a default constructor ( one that takes no arguments and is public ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
From that description, you need to clean up your include situation. For starters, your "includes.h" (analagous to stdafx.h in wizard-generated code) should not be included in other header files, only cpp files. The way it is now, if you're not using precompiled headers, you're seeing much longer compile times than necessary.
|
|
|
|
|
|
Each compiler has predefined symbols specific to it, so you can have conditionally-compiled code for different compilers. For example, VC has _MSC_VER which also tells you the compiler version.
|
|
|
|
|
|
Hi,
I am curious abt shortcuts to copying data from two buffers into one.
let's say I have an integer and a buffer of LPVOID type. Now i want to copy these two, int first and then all contents of LPVOId buffer( size known ) into the buffer supplied by the user(LPVOID type). memcpy or memmove will do only wholesale copy, no way to specify from what byte to start. is there any way other then byte by byte copy??
how do u do this kinda thing anyways?
any pointers will help, thnx
will something like this work
mydata is allocated and is of LPVOID type
myDataSize is UINT and have correct size( hopefully ) of myData
void copy( LPVOID buff, size )
{
memmove_s( buffer, size, (LPVOID)&someint, sizeof(int) );
buff += sizeof( int );
memmove_s( buffer, ( size - sizeof( int ) ), myData, myDataSize );
//return the input pointer to original value
buff -= sizeof( int );
}
//this could be totally laughable thing, but am jsut new to this kinda thing
//please excuse me if this code seems ridiculous
thnx for help.
|
|
|
|