C++ :: How To Read Pixels From X / Y Coordinate Using VGA Register Values

Aug 4, 2013

How to read pixels from an x,y coordinate using the VGA register values?

byte readVRAMdirect(VGA_Type *VGA, uint_32 start, uint_32 offset) //Used in 256 color mode!
{
if (!VGA->VRAM_size) return 0; //No size!
return VGA->VRAM[SAFEMOD((start*4)+offset,VGA->VRAM_size)]; //The full protected offset!

[code]....

getVRAMScanlineStart(VGA,y) gives the offset register multiplied by 2 (shl 1), multiplied with the current memory address size (byte, word or dword) multiplied by the scanline. 256-color mode is already working. GETBIT gives a bit #(0-7) of a specified byte.

writeVRAMplane & readVRAMplane are used by the CPU to write data to VRAM (address 0xA000:xxxx-0xBFFF:xxxx), determined by the memory read and write modes(working) and the odd/even, planar or chain4 enable mode (working).how to get the 16 color and interleaved shift mode working?

ZIP with screen captures: URL....

View 2 Replies


ADVERTISEMENT

C++ :: Read All Pixels From Bitmap Into One Big Array

Oct 21, 2013

I need to be able to take a bitmap e.g. "untitled.bmp" (bit depth: 24) and loop through every pixel from top left to bottom right and find the rgb (or hex) value for each pixel e.g. (255,255,255) for white and store this rgb (or hex) value in a two-dimensional array depending on its [column]and[row].

How to read bitmap data in in c++ . Also, I'm reluctant to use windows header files as I'd prefer it to be cross-platform.

View 1 Replies View Related

C++ :: Cash Register Program - Reinitializing Values With Subprograms

Dec 7, 2014

I'm trying to make a cash register program, but first I need to reinitialize ones, fives, tens, and twenties to their correct dollar amount. However, whenever I try to pass the user inputted values to the function that calculates the correct dollar amount, it just prints the same number.

Here's my code:

#include <iostream>
#include <string>
using namespace std;
//dollarAMT - recalculates the actual dollar amount
void dollarAMT(int ones, int fives, int tens, int twenties){

[Code] ....

View 2 Replies View Related

C/C++ :: Cash Register Program - Reinitializing Values With Subprograms

Dec 7, 2014

I'm trying to make a cash register program, but first I need to reinitialize ones, fives, tens, and twenties to their correct dollar amount. However, whenever I try to pass the user inputted values to the function that calculates the correct dollar amount, it just prints the same number.

Here's my code:
#include <iostream>
#include <string>
using namespace std;
//dollarAMT - recalculates the actual dollar amount
void dollarAMT(int ones, int fives, int tens, int twenties){

[Code] ....

View 1 Replies View Related

C++ :: Linear Buffer Coordinate - Printing Onto Screen Coordinate

Mar 24, 2013

I have a linear buffer coordinate, i am to print onto a screen coordinate.

Say maxy = 20, maxx = 10, bufferx = 20, y, x,
Buffer coordinates to screen coordinates:
Algorithm: So for each maxx'th of bufferx, y will +1 and x will reset.
Mathematical: y = int bufferx / maxx,
const double averageIncr = int (maxx+1/maxx) - double (maxx+1/maxx);
So the amount of averageIncr in (int bufferx / maxx - float bufferx / maxx)
is the screen x coordinate. Then
(int bufferx / maxx - float bufferx / maxx) / averageIncr = x

Screen coordinates to buffer coordinates:
bufferx, y = 21, x = 10, maxy = 20, maxx = 10,

y * x would be the case if bufferx <= max screen coordinate.
There is no max bufferx.

How to find the transition from screen coordinates to buffer coordinates? Also, if the algorithm within a for loop, or that the mathematical way would be slower or not? I rarely touch floating point stuff.

View 3 Replies View Related

C++ :: Read Unknown Number Of Integer Values And Then Print Count Sum And Average Of Odd Values

Apr 9, 2014

write a c++ program that reads an unknown number of integer values and then print count, sum and average of odd values, even values, positive values, negative values!!

View 1 Replies View Related

C++ :: Combine RGB (A) Pixels Into One?

Jan 14, 2013

I have a buffer which has a virtual width of 1024 pixels with virtual height 768 pixels (actual width stored in GPU.GPU_screenxsize, height in GPU.GPU_screenysize (both uint_32)).

I currently use the following function to plot the pixels to the screen:

inline void GPU_defaultRenderer() //Default renderer {
uint_32 pixel;
int bufferx; //Buffer's x!
int buffery; //Buffer's y!
int bufferxstart; //Buffer's x start!
int bufferystart; //Buffer's y start!
int pspx;

[Code] ...

How to combine the pixels together (blend them into one goal pixel) to get a better view? (Currently it takes the bottom right pixel of the area that represents the goal pixel).

So (x1,y1,x2,y2)->(pspx,pspy) = (bufferystart,bufferxstart,buffery,bufferx)->(pspx,pspy).
Atm this is (x2,y2)->(pspx,pspy)

Btw the pixel format is uint_32 RGBA (only RGB used atm). The psp_graphics_putpixel draws it onto the real VRAM. PSP_SCREEN_ROWS and PSP_SCREEN_COLUMNS represent the destination screen (the real screen)'s height and width in pixels.

View 7 Replies View Related

C/C++ :: How To Use Register Selectively

Feb 15, 2013

I am looking for a way to create a virtual registry and force only certain programs to use this one? Or to create a virtual Registry but which i can shut down (this registry will be only used while i activate it)?

Or redirect all querys to another place in the registry I've seen similar issues. But there is no answer how to use the register selectively!

View 16 Replies View Related

Visual C++ :: How To Register ATL Exe COM

Apr 4, 2013

I created an EXE COM server with ATL.

and from the client (DLL COM with ATL) i want to create an instance of the EXE (CreateInstance(CLSID of the EXE)).

how do i register the exe so that i know the path to the com server.

View 2 Replies View Related

C :: Using File As Accumulator Register

Dec 4, 2013

I need to use a file as an accumulator of very large size.

I want to write one bit at a time. I have an iteration engine that applys so logic to either add 1, do nothing, or subtract 1 from the array, but it has to be much larger when dealing with multi-GB files.

So I either need to & the 8bit to 4K array value to a file or write it it one bit at a time.

But it is not that I want to write sequential bytes, I need the file to be written so it acts as accumulator.

I know its in front of my face, but I need to rethink this

View 1 Replies View Related

C# :: Display Average Value Of Pixels In The Image

Feb 4, 2013

I have a project which opens an image in PictureBox1, no problem. But the Public Static Color method at the bottom of the code is not working. I was hoping it would display the average value of the pixels in the image. why it is not working?

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Imaging;
using System.Drawing;

[Code]...

View 2 Replies View Related

C++ :: Load PNG Files And Extract RGB Pixels?

Apr 18, 2014

How to load png files and extract their rgb pixels? Library recomendations?

View 2 Replies View Related

C++ :: Exceeded 32bit Register Value Exceeds 4 Bytes

May 28, 2014

My question, What happens when with the 32 bit register value exceeds 4 bytes while programming in c++? Im interested in encryption.

Im programming and doing some calculations. The hex value "0xFA062F2F" multiplied by "6D" sends it over "0x6A74A21703", which exceeds 32bit.

My problem is while programming in C++, I do some calculations such as above, and I get the hex value "0xC0000001" which should be "0x6A74A21703". I made sure that I use long long as my interger type.

How can I overcome this problem with programming.

View 3 Replies View Related

C++ :: VGA VRAM Graphic Mode Reading / Writing Pixels?

Jan 21, 2013

tell me where the errors in the below code are?

Extra info:

getrowsize() gives the size of a row in bytes (see VGA CRTC register).
getVRAMMemAddrSize() gives the size of a pixel in memory (1=byte,2=word,4=dword)
set/getBitPlaneBit(startaddr,plane,offset,bit[,on when writing]) sets/gets a bit on a specific bit plane offset (start addr is the start address register from VGA,
plane is the plane to read/write,
offset is the offset within the plane,
bit is the bit to read/write (0-7),
[on(when writing) is the value of the bit)]

[code]....

View 2 Replies View Related

C++ :: Making A Menu System To Change The Color Of Pixels

Apr 10, 2013

im making a menu system to change the color of pixels in a gravity engine i made. the engine works fine, and the menu colors the particles, but will only ever turn them to red, no matter what color i tell it to change it to.

bool running = true;
bool colorChosen = false;
Uint32 particleColor;
Uint32 randomColor;

[Code]....

View 1 Replies View Related

C++ :: Moving From One Coordinate To Another

Feb 18, 2015

I have a character at a co-ordinate, say (3,4) for example, and I need to get him to (10,15). I would like him to move one block every tick or half a second, so that you can see him moving towards his destination. How to achieve this?

View 3 Replies View Related

C++ :: Printing Character At Certain Coordinate?

Jun 23, 2014

So, in a program I'm making, I have an idea, that I can print the character background first, then print another layer on top of the background. Can I do that? But I need to be able to place a single character at a certain position, what function does that?

View 5 Replies View Related

C++ :: How To Convert Pixel To Coordinate In OpenGL

May 23, 2013

How can i convert pixel to [-1..1]coordinate in opengl? Which function? I want to write a program that is work with

glutmousefunc(),

When I click on the screen a ball is appear on it where clicked. but mouse work with pixel and circle work with coordinate between -1 and 1 ....

View 4 Replies View Related

C++ :: Mouse Coordinate Position In Window

May 3, 2014

After searching on stackoverflow I got this

POINT p;
for (int i = 0;; ++i) {
HWND hwnd = GetConsoleWindow();
system("cls");
if (ScreenToClient(hwnd, &p)) {
//p.x and p.y are now relative to hwnd's client area
} cout << p.x << " " << p.y;
Sleep(200);
}

I'm looking for a function that gives current mouse position(x and y) in that particular console window. I've tried above code but it is not working.

View 5 Replies View Related

C++ :: Heading In Cartesian Coordinate System

Apr 15, 2012

I have 2 points in a cartesian coordinate system, where the first point is always (0,0). Given the second point and a heading in degrees, how would I write an algorithm to determine if the 2nd point is traveling in the general direction of (0,0) ?

For example:

Point a (0,0)
Point b (10,0)
Point b heading = 270 degrees

This would be true this 270 degrees points right and point b is 10 units right of point a. I would probably also want this is be fuzzy somewhat, in that anything from say + or - 30 degrees would also be true, or something like this.

View 6 Replies View Related

C :: Pointing To A Vectors X Coordinate Located Within A Structure

Feb 8, 2015

Cam is a pointer to a structure and viewpoint is a vector located within the struct. I am trying to read in from a file the coordinates for the vector. I have also tried &cam->view_point->x as well as &cam.view_point.x and it tells me that I am requesting something not in a struct

Code: count= fscanf(in,"%d %d %d", &cam->view_point.x, &cam->view_point.y,&cam->view_point.z);

View 14 Replies View Related

Visual C++ :: MFC Coordinate System - Drawing Of Angles?

Oct 11, 2013

I am drawing in a simple (square) MFC window. I realize that (0,0) starts in the upper left hand corner. I wanted to see how MFC handled drawing of angles, so I use this code:

Code:
double CompassDegreesToRadians(double compassDegrees) {
return((PI / 2.0f) - (compassDegrees * PI / 180.0f));
}
// Make pen
CPen penRed;
penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0));
// Test Angles

[Code] .....

Using this code, and changing the value of angle1 to these values (0, 90, 180, 270) I think MFC uses the coordinate system:

Code:
180 -y
|
|
-x 270---------------- 90 +x
|
|
0 +y

This seems like a strange coordinate system to use. Am I doing something wrong? If this is correct, how can I convert my calculations to this coordinate system? (compass degrees):

Code:
0 +y
|
|
-x 270---------------- 90 +x
|
|
180 -y

View 4 Replies View Related

C++ :: Read Values From File

May 26, 2013

So i have this .dat file:

############################################
# fonts.dat #
# stores the proportional values for fonts #
############################################

# amount of fonts to expect:
[TOTAL_FONTS]
1

#
# 1st font... GTA HEADER
#

[Code] .....

how can i read values like [FONT_ID] and save them to some variable in code?

View 3 Replies View Related

C :: Linked List Programming To Find Cartesian Coordinate

Jan 7, 2014

I am very much new to C programming. However, I have an assignment regarding linked list.

Problem Statement is: Using linked list store the coordinates of four cartesian points and then find the coordinates having longest distance from its origin.

View 1 Replies View Related

C++ :: How To Read Integer Values From CSV File

Mar 14, 2014

I read one csv file in which it contains different types of data like string, integer etc.I want to fetch only integer data from that file and store in vector.Below i copy some code that read line from file,store in vector.I tried to convert string to integer or double and do some operations on it as i know that string values,but how to identify only integer values and store that in vector?

#include<iostream>
#include<vector>
#include<string>
#include<fstream>
#include<sstream>
#include<iterator>
#include<algorithm>
using namespace std;
int main() {
string line;
int cnt=0,val1,val2;

[Code] ....

input file like
Employee Code:121AEmployee Name :David
DateInTimeOutTimeShiftTotal DurationStatus
01-Apr-139:5919:53FS 9:53 Present

View 1 Replies View Related

C/C++ :: Program To Read Values From A File?

Sep 18, 2014

I am trying to get my program to calculate what point goes in what quadrant using a file. But msy program is not reading the values from the file and also it is not running so im not sure what's wrong with it.

//This program uses a fstream object to write data that will read the values of a (x,y) point from a file.
//add the appropriate preprocessor
#include <fstream>
#include <iostream>

[Code].....

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved