C++ :: Detect Colors In The Black Rectangle?

Oct 5, 2013

I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?

View 7 Replies


ADVERTISEMENT

C :: Creating PPM Image - Black Rectangle With A Circle

Mar 12, 2013

I'm trying to create a PPM image for a class assignment. A black rectangle with a circle at the point 225, 175 with a radius of 75. I have to use certain specific methods, so I can't use like Bresenham's really famous method for creating a circle.

The problem is that it compiles fine, and transfers to an image fine, but always says that I have a negative or zero image size.

Code:

#include "shapes.h"
int main () {
int i, j, x, y;

fprintf(stdout,"P6 width height 255
");

[Code] ....

And my header is:

Code:
#include <stdio.h>#include <math.h>
#define height 480
#define width 640
#define cy 175
#define cx 225
#define radius 75

The circle has to be filled in. I made it white. Also, i and j are unsused so far, so just ignore them.

View 1 Replies View Related

C++ :: Send Rectangle To A Function Which Takes A Rectangle Argument

May 13, 2014

Consider I have a rectangle like this:

Point p1(100,100);
Point p2(300,200);
Graph_lib::Rectangle r(p1,p2);

And also I have a function that takes a rectangle and returns a Point of that, say, top-left corner of that rectangle. For example:

Point N(Graph_lib::Rectangle R1);

My question is that, first, how to send that Rectangle r(p1,p2) to the Point N(Graph_lib::Rectangle R1) function? And then, how to return a Point from that function?

My IDE is visual studio 2012.

View 19 Replies View Related

C++ :: Red Black Tree - SFML

May 17, 2014

How to make a red and black tree using SFML ....because i really need...I really don't know how to use SFML i only know how to use win32 console.

View 3 Replies View Related

C/C++ :: Red Black Tree - App Keeps Crashing

Dec 8, 2014

Red Black Trees. [URL] .....

My app keeps crashing after about the 49th insert.

I tried debugging and it keeps pointing to this area in the Fixup:

if (z->parent == z->parent->parent->left) {
y = z->parent->parent->right;

View 13 Replies View Related

Visual C++ :: Red / Black Trees Value Deletion

Nov 26, 2013

I've been working on my deletion function for Red and Black trees but can't seem to get it to work. From what I can tell, the remove function, instead of deleting the single value that will my prompt by the user, will delete all the values that are in the red and black tree.

Code:
bool RedBlackTree::remove(int x) {
if(!search(x)){
return false;
} else {
Node* z = new Node(x);
rbremove(z);

[Code] ....

View 4 Replies View Related

C :: Creating Black Bitmap - How To Set Color Of Individual Pixel

Nov 2, 2014

creating a bitmap. Our professor wants us to creat a black 100*100 bitmap.

Code:

#include <stdio.h>
#include <stdlib.h>
#pragma pack(push,2)
typedef struct{

[Code].....

I dont even know where to start. I spend the last 7h infront of my computer and i'm so frustrated cause my professor gave us no information what so ever. At the moment its more of a trial and error process than anything else.

How would i set the color of an individual pixel for examplel or how would i save the file ?

View 1 Replies View Related

C :: Strings To Be Printed In Different Colors

Aug 21, 2013

I am currently using Dev-C++ 4.9.9.2 compiler for creating a C project. I need few strings to be printed in a different color.

Code:
#include<stdio.h>
#include<conio.h>
int main(void)
{ textcolor(RED);
cprintf("Hello world
");
system("pause");
}

While I use " textcolor(RED) " it says: 'RED' undeclared, first use in this function.

If i make it: " textcolor(3) ", it says: [Linker error] undefined reference to textcolor & undefined reference to cprintf.

have been searching for a solution on google since morning. At last I could make out that it is not the correct compiler with suitable library or outdated <conio.h> header file.

I had switched from turbo(or borland, I don't remember) to Dev-C++ compiler due to some kind of library issue. Now I guess I'll have to switch to some other IDE. Which one is that, I don't know yet. There was another thread also about this topic, but didn't provide any solution.

Is there any method to upgrade certain header file (I don't think so)? What would be the best IDE with updated libraries?

View 7 Replies View Related

C++ :: How To Draw Lines With Different Colors

Nov 8, 2014

I want to write a function called DrawLineSegments.This function must change the color of lines at every corner where the corner angle is greater than 60 deg (Assume that there is a function called checkangle). The color sequence must be black, red, green, blue, and repeat this sequence after the fourth color.

View 1 Replies View Related

C# :: Colors - Integer Value For Alpha

Jul 14, 2014

I want to use a new color for BaseColor in iTextSharp.

I can easily set a new color using RGB values from 0 to 255.

However, if I want to adjust the alpha value (and I know alpha ranges from 0 to 1), I can't make the alpha 0.5 because it's not an integer in the definition of BaseColor.

public BaseColor(int red, int green, int blue, int alpha);

So I can set my BaseColor like below:

static BaseColor newColor = new BaseColor(192, 192, 192);

but I can't use a non-int value for alpha. How can I easily convert double alpha values to integer values? What would be the range for alpha in int values and how do I, e.g., set the alpha value to 0.5 in int values?

EDIT: btw, I found online something like this: int alpha = (pixel >> 24). I don't understand why 24 and how can I break that into chunks I understand?

View 5 Replies View Related

C :: Calculate Black Body Spectra Over User-entered Range Of Wavelength And Temperatures

Jul 29, 2013

I tried to write a code to calculate black body spectra over an user-entered range of wavelength and temperatures. The equation I'm trying to code is the second one this image (stolen from Wikipedia)The syntax to run it is bbgrid lambda_inic lambda_final temp_inic temp_final inc_T inc_lambda

where bbgrid is the name of the program, lambda_inic and lambda_final are the limits of the wavelenght range (in units of angstroms, 1A=10⁻⁰m), temp_inic and temp_final are the limits of the temperature range (in Kelvins) and inc_T and inc_lambda are the increments. What I want to do is, given the ranges of temperatures and wavelengths, to run the code over the lambdas and the temperatures.

The problem is that the behaviour of the intensities (what I'm calculating) is erratic. Sometimes it is highly positive, sometimes immensely negative and turning between those two. As an example of an output file, I'm getting things like this:

3100 1915076038
3110 -1233496775
3120 1741010116
3130 1229780625
3140 421722788
3150 -1874760945
3160 1654746252
3170 1062468321
3180 -795217626
3190 -1141129750
3200 -1570716956
3210 539385985

While I was trying to debug the code, I found the problem may reside in the exponential factor in the denominator. I wrote some lines to calculate and print on the screen only the exponential, and it was oscillating like crazy. The output file should produce curves like this:

Code:

#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<string.h>

[code]....

View 14 Replies View Related

C :: Check How Many Colors Terminal Supports

Feb 17, 2013

I'm generating all ncurses color pairs like this

Code:

void generate_all_color_pairs(){ int foreground;
int background;
int i = 0;
for(foreground=0; foreground<8; foreground++){
for(background=0; background<8; background++){
i++;

[code]....

but according on several sources, some terminals suport more colors.Is there any way to determine how many colors the current terminal supports?

View 3 Replies View Related

C# :: Manipulating Images Colors With ColorMatrix?

Feb 6, 2015

I found this elegant looking code on the net that claims to be able to manipulate an images colors using ColorMatrix.

When I run it, it does nothing! I used the code exactly as is with no editing, except to feed it my own image to do its work.

private void ApplySaturation(float saturation) {
float rWeight = 0.3086f;
float gWeight = 0.6094f;
float bWeight = 0.0820f;
float a = (1.0f - saturation) * rWeight + saturation;

[code].....

View 8 Replies View Related

C++ :: Make Colors Transparent Using 3rd Party Library

Jan 19, 2014

I'm trying to make colors transparent in c++ using a 3rd party library. I've successful made my background transparent but I feel I'm cheating by not understanding how I entered the value.

"0xff, 0xff, 0xff" is the color white but i'm not sure how it's the color white like with RGB values.

View 5 Replies View Related

C++ :: Assigning Colors To Individual Characters In Array?

Aug 31, 2014

Basically I am making a console RPG (isn't every beginner nowadays?) and I am having an incredible amount of trouble assigning specific characters their own color. e.g. monsters being red, cash being green, etc.

I took out Left, Right, and Down controls because of character constraint.

#include <iostream>
#include <windows.h>
//%%%%%%%%%%%%%% COLOR CALL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void setcolor(unsigned short color) {
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);

[code]....

View 8 Replies View Related

Visual C++ :: Moving Mouse Cursor To Certain Colors On Monitor

Apr 22, 2013

I am currently starting to attempt to make a program that can move my cursor to certain colors on my monitor. The problem is this seems like it will be 10x harder than I first thought.

View 4 Replies View Related

C++ :: Print To Console Contents Of A File Using Foreground Colors And Other Attributes

Jun 29, 2013

Suppose I have a txt file that I want the contents printed to the console in such a way that every five words are colored blue and the following five are red. How do I accomplish such a task? I am currently only able to print the contents of the file in regular color using ifstream.

View 1 Replies View Related

C# :: Customize Font Styles / Colors / Size In Custom Message Box

Jul 15, 2014

I made my own custom message/dialog box.

I have a template mock up view using xaml. I have a viewmodel that raises the message property. I binded the message property to a textblock inside my xaml.

Since my messages are different for every viewmodel I have.

E.g.in every viewmodel, I have something like

messagewindow.Message = "This is a new message";
dialogService.ShowDialog(Success, messageWindow);

In one of my messages, I want to make the font bold and different color for a specific message segment.

How can I do that without messing up with the other messages that inherit from the xaml or code behind?

Currently, I'm not using any code behind and a lot of the examples online I've seen use code behind and/or don't have dynamic message textboxes.

View 5 Replies View Related

C++ :: SDL Won't Detect Debugger

Sep 2, 2013

Current compiler doesn't have correctly defined debugger!

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

Create new parser for project 'Test'

Project 'Test' parsing stage done!

View 4 Replies View Related

C :: How To Define The Lock Detect

Feb 24, 2013

It is my first time in use lock detect so i didn't now how to start.

how to define the lock detect?

View 4 Replies View Related

C :: Detect Mouse Movement

Aug 17, 2013

i was trying to write a program in c language which can detect mouse movement, but the program which i have written can only detect the mouse click or scroll the program which i have written given below..

Code:

#include<stdio.h>
#include<string.h>
#include <ncurses.h>
int main() {
}

[code]....

run the programme with linked-lncurses. improve my program which also detect when the mouse moves.

View 1 Replies View Related

C++ :: Using Gdb To Detect Segmentation Fault In Sh?

Jan 16, 2015

I am using scientific linux. In the directory user/project/Build, after I ran 'make' to compile and link all the cpp files,I had no problems. But then, when I went to directory user/run/run.sh, which runs the project binary in user/project/Build/bin/project, I get a segmentation fault error. In the directory user/run, I enter 'gdb' in the command prompt and get the message "*** No targets specified and no makefile found. Stop." What am I supposed to do to detect the segmentation fault?

View 2 Replies View Related

C++ :: Detect If A Letter Key Is Pressed?

May 11, 2014

How would I detect if any letter key is pressed. Would I have to use GetAsyncKeyState() for every letter key? Or could I have some kind of loop going through all the hexadecimal values for every letter? I don't know how I would go through hexadecimal values with a loop.

View 6 Replies View Related

C++ :: How To Detect Memory Leaks

Mar 16, 2015

i build an application, that makes the used memory growing. i don't get any error(unless, i believe, that i use some memory value(i don't know the value), but i see the memory growing very slowly. how can i detect the memory leak?

View 4 Replies View Related

C/C++ :: Put A Number In Rectangle?

Oct 4, 2014

the code draws rectangle or square it depends on you (column,row) then, put number in the center of the rectangle i don't want to extra space after putting one,two,three or four digits number in the center of the rectangle

#include <stdio.h>
int main(){
int i,j;

[Code]....

View 3 Replies View Related

C++ :: How To Detect And Change Word Endings

Jul 2, 2013

Is it possible to create a programme which would detect and change word endings? I would like to write a simple verb conjugator, i.e.:

If you enter a word ending with AAA then I would like the programme to show, say, six modified words:

Word with the replaced ending, for example QWERTYAAA changes into QWERTYBBBQWERTYAAA changes into QWERTYCCCQWERTYAAA changes into QWERTYDDD etc.

Is it possible to do it? If so, how?

View 9 Replies View Related







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