Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
void CreateMaskFromColor(const Color col, ubyte alpha) { const Color new_col = col.Modify(Color.Spectrum.Alpha, alpha); ubyte[] color_data; foreach (const Color pixel_col; this._colors) { if (pixel_col != col) { color_data ~= pixel_col.Export(); } else { color_data ~= new_col.Export(); } } //this.LoadFromPixels(&color_data[0], this._width, this._height, this._deepth, this._format); this.Update(&color_data[0]); } |
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
// Wenn es schon eine Textur gibt... if (this._format != Format.None) { // Alte löschen... this._Delete(); } // neu generieren. this._Create(); if (pixels !is null) { const ubyte* col_pixels = cast(ubyte*)(pixels); //writefln("R: %d, G: %d, B: %d, A: %d", pixels[0], pixels[1], pixels[2], pixels[3]); this._colors.clear(); const uint len = width * height; for (uint i = 0; i < len; ++i) { ubyte[4] col; for (ubyte j = 0; j < 4; ++j) { col[j] = col_pixels[i * 4 + j]; } this._colors ~= new Color(col); } } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Architekt« (31.05.2012, 14:24)
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Surface SubSurface(const Rect rect = null) const { if (rect is null) { return this.GetCopy(); } Surface copy = new Surface(); copy.Create(rect.Width, rect.Height, 32); assert(copy.CountBits() == 32); copy.Blit(this, null, rect); return copy; } |
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Surface SubSurface(const Rect rect = null) const { if (rect is null) { return this.GetCopy(); } Surface copy = new Surface(); copy.Create(rect.Width, rect.Height, 32); assert(copy.CountBits() == 32); copy.Fill(Color.White); // <-- auffüllen mit weiß statt schwarz, wie es automatisch geschieht. copy.Blit(this, null, rect); return copy; } |
Quellcode |
|
1 |
glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Quellcode |
|
1 |
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR); |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Werbeanzeige