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


ADVERTISEMENT

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++ :: 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++ :: 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++ :: 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 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++ :: Combine Two Program Into One?

Jan 13, 2015

i tried to combine two programs into one.. in my first program it has one class object and main() and my second program it has only one main()

i want to combine these two into one

View 5 Replies View Related

C# :: How To Combine Two SQL Queries Into One

May 21, 2014

update Tag_Master set flag='Inactive' where Tag_no=10;

update Tag_Master set flag='Assigned' where Tag_no=12;

I had these two queries, I just want both of these will fire on same event. Is any other way to write both queries in single query instead of writing two different queries ....

View 4 Replies View Related

C++ :: How To Combine Inputs Using If Statements

Jul 19, 2013

How to combine the if statements?

cout<<"Enter a sale number"<<endl;
cin>>rec.sale;
if(cin.fail())
{
cout<<"Enter a number"<<endl;
cin>>rec.sale;
}

[Code]...

View 13 Replies View Related

C++ ::  how To Combine A Function Call And Inputting A Value

Mar 15, 2014

We're working on classes in my programming class, and I have a question about function calls.

Bascially, I have all my set and get functions set up and ready to go.

I was wondering if it was possible to have the user input a variable while calling a function.

for example

cin >> getname();

the user inputs a value that gets passed into getname.

Or does it have to be something like

cin >> name;
getname(name);

mind you all, this isn't code from my program i'm just spitballing here.

View 4 Replies View Related

C# :: Combine Query To Show All Data

Sep 22, 2014

So I've been working on this for awhile and FINALLY got it to work. This is my code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

[Code] ....

As you can see I will have the Name and total right next to eachother.. Problem is I dont want to make a million MySQLCommands for each ID.. Is there a Way I can list all data in each label?

For instance the Select from Text will show all the text from each different ID
and the Select from STOCK-USED as total will show all the total for each ID

Instead of having to list them individually.

Even if I leave it to this

"Select text FROM `parts`";

It selects the 2nd ID in my database and displays its text.. Forgets about the first one completely ...

View 2 Replies View Related

C# :: How To Combine Two Bytes In Int32 To Get Original Value

Jan 6, 2015

how to combine two bytes (each byte is 8 bits wide) in order to get the original value. I am displaying values(from 0 to 500)sent from my microcontroller on the GUI.I can successfully display values from 0 to 255 as this requires just sending a byte. However sending values from 256 to 500 requires sending two bytes. The problem I am having is that I was unable to re-combine the received two bytes in order to get the original value. Below are my lines of code:

int main( void ) // this is the main function inside the microcontroller {
sei();
USI_TWI_Master_Initialise();
Spi_Master_Init();
while(1) // I am using this loop to send 500(111110100) {
Transmitt_Receive(244);//this function sends LOW BYTE of 500(11110100)
_delay_ms(1000);

[code]....

When I combined the two bytes using the above arrangements, instead of getting 500 my GUI displayed 62708.I got the same result when I used BitConverter.

value3 = BitConverter.ToInt32(val,0);

View 7 Replies View Related

C# :: How To Combine 2 Methods To Make SQL Class

Jun 17, 2014

I am given 2 methods and they want me to create a stand alone class for sql that will change the sql string.

my question is how can i take these 2 methods and make one class out of them that will used on various other forms.

#1

public string AuthenticateWithDB(CUiPontisDatabaseSpecification pdb, string sUserId, string sPassword,
bool bCreatePersistentCookie)

#2

public static void ChangeConnection(Util.ODBC.ODBCDSN odbcInfo, CPonDatabaseVendorType dbType, string uid, string password)

they want it so they can use it like

CUiHttpSessionManager.SimpleDataConnectionString = SomeNewClass.CreateSimpleDataConnectionString()

where some new class is my new class

View 5 Replies View Related

C++ :: Combine Multiple Vector Containing Binary Data To String?

Mar 16, 2012

Two questions:

1. I have some vector<unsigned char> containing binary data. I would like to combine them into one std::string. How is the correct way to accomplish this?

This is my best guess for sample code:

Code:
vector<unsigned char> data; //conatins some data
vector<unsigned char> data2; //contains more data
string temp(data.begin(), data.end());
temp.append(data2.begin(), data2.end());

Will this code work with binary data, or will it null terminate?

2. A similar problem.. I have some unsigned char* variables, and I want to combine them into one std::string. How can I accomplish this? will the member append() work here? or will it null terminate? Something like:

Code:
unsigned char* data; //conatins some data
unsigned char* data2; //contains more data
string temp(reinterpret_cast<const char*>(data));
temp.append(string(reinterpret_cast<const char*>(data2)));

Will the above sample code work without null termination?

View 4 Replies View Related

C++ :: Record User Input But Combine It With Command Line Arguments?

Aug 15, 2013

I want to be able to write a program where I can record user input but combine it with command line arguments. For example I do a simple getline(); and the user types test how to combine it so it could be like test /q and it gives a different output depending on what additional input was added. Can this be done with lots of different inputs?

View 8 Replies View Related







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