Browse Source

Fix for updated DPF; Use extended fillColor

pull/1/head
falkTX 10 years ago
parent
commit
db91550066
5 changed files with 19 additions and 17 deletions
  1. +1
    -1
      dpf
  2. +1
    -1
      examples/demo.cpp
  3. +8
    -7
      examples/nanovg2.cpp
  4. +2
    -2
      examples/widgets/ExampleTextWidget.hpp
  5. +7
    -6
      examples/widgets/NanoPerfWidget.hpp

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit f1f5853c924593335a6afe374bcc4f3fdcea4ba8
Subproject commit 17393403bf03049a8178cd217f691c149017ec80

+ 1
- 1
examples/demo.cpp View File

@@ -121,7 +121,7 @@ protected:
nvg.textAlign(NanoVG::ALIGN_LEFT|NanoVG::ALIGN_TOP); nvg.textAlign(NanoVG::ALIGN_LEFT|NanoVG::ALIGN_TOP);
//nvg.textLineHeight(20.0f); //nvg.textLineHeight(20.0f);


nvg.fillColor(nvg.RGBA(220,220,220,220));
nvg.fillColor(220,220,220,220);
nvg.textBox(10, 420, iconSize, "Haha,", nullptr); nvg.textBox(10, 420, iconSize, "Haha,", nullptr);
nvg.textBox(15, 440, iconSize, "Look!", nullptr); nvg.textBox(15, 440, iconSize, "Look!", nullptr);




+ 8
- 7
examples/nanovg2.cpp View File

@@ -29,6 +29,7 @@
// use namespace // use namespace


using namespace DGL; using namespace DGL;
using namespace DISTRHO;


// ------------------------------------------------------ // ------------------------------------------------------
// NanoVG Example Widget // NanoVG Example Widget
@@ -75,7 +76,7 @@ protected:
void onNanoDisplay() override void onNanoDisplay() override
{ {
const int width = getWidth(); const int width = getWidth();
const int height = getHeight();
//const int height = getHeight();
const double t = gTime.getTime(); const double t = gTime.getTime();


if (premult) if (premult)
@@ -135,14 +136,14 @@ private:
float br = (ex < ey ? ex : ey) * 0.5f; float br = (ex < ey ? ex : ey) * 0.5f;
float blink = 1 - std::pow(std::sin(t*0.5f),200)*0.8f; float blink = 1 - std::pow(std::sin(t*0.5f),200)*0.8f;


bg = linearGradient(x,y+h*0.5f,x+w*0.1f,y+h, RGBA(0,0,0,32), RGBA(0,0,0,16));
bg = linearGradient(x,y+h*0.5f,x+w*0.1f,y+h, Color(0,0,0,32), Color(0,0,0,16));
beginPath(); beginPath();
ellipse(lx+3.0f,ly+16.0f, ex,ey); ellipse(lx+3.0f,ly+16.0f, ex,ey);
ellipse(rx+3.0f,ry+16.0f, ex,ey); ellipse(rx+3.0f,ry+16.0f, ex,ey);
fillPaint(bg); fillPaint(bg);
fill(); fill();


bg = linearGradient(x,y+h*0.25f,x+w*0.1f,y+h, RGBA(220,220,220,255), RGBA(128,128,128,255));
bg = linearGradient(x,y+h*0.25f,x+w*0.1f,y+h, Color(220,220,220,255), Color(128,128,128,255));
beginPath(); beginPath();
ellipse(lx,ly, ex,ey); ellipse(lx,ly, ex,ey);
ellipse(rx,ry, ex,ey); ellipse(rx,ry, ex,ey);
@@ -159,7 +160,7 @@ private:
dy *= ey*0.5f; dy *= ey*0.5f;
beginPath(); beginPath();
ellipse(lx+dx,ly+dy+ey*0.25f*(1-blink), br,br*blink); ellipse(lx+dx,ly+dy+ey*0.25f*(1-blink), br,br*blink);
fillColor(RGBA(32,32,32,255));
fillColor(32,32,32,255);
fill(); fill();


dx = (mx - rx) / (ex * 10); dx = (mx - rx) / (ex * 10);
@@ -172,16 +173,16 @@ private:
dy *= ey*0.5f; dy *= ey*0.5f;
beginPath(); beginPath();
ellipse(rx+dx,ry+dy+ey*0.25f*(1-blink), br,br*blink); ellipse(rx+dx,ry+dy+ey*0.25f*(1-blink), br,br*blink);
fillColor(RGBA(32,32,32,255));
fillColor(32,32,32,255);
fill(); fill();


gloss = radialGradient(lx-ex*0.25f,ly-ey*0.5f, ex*0.1f,ex*0.75f, RGBA(255,255,255,128), RGBA(255,255,255,0));
gloss = radialGradient(lx-ex*0.25f,ly-ey*0.5f, ex*0.1f,ex*0.75f, Color(255,255,255,128), Color(255,255,255,0));
beginPath(); beginPath();
ellipse(lx,ly, ex,ey); ellipse(lx,ly, ex,ey);
fillPaint(gloss); fillPaint(gloss);
fill(); fill();


gloss = radialGradient(rx-ex*0.25f,ry-ey*0.5f, ex*0.1f,ex*0.75f, RGBA(255,255,255,128), RGBA(255,255,255,0));
gloss = radialGradient(rx-ex*0.25f,ry-ey*0.5f, ex*0.1f,ex*0.75f, Color(255,255,255,128), Color(255,255,255,0));
beginPath(); beginPath();
ellipse(rx,ry, ex,ey); ellipse(rx,ry, ex,ey);
fillPaint(gloss); fillPaint(gloss);


+ 2
- 2
examples/widgets/ExampleTextWidget.hpp View File

@@ -52,11 +52,11 @@ protected:
textLineHeight(20.0f); textLineHeight(20.0f);


beginPath(); beginPath();
fillColor(RGBA(220,220,220,255));
fillColor(220,220,220,255);
roundedRect(10, height/4+10, width-20, height/2-20, 3); roundedRect(10, height/4+10, width-20, height/2-20, 3);
fill(); fill();


fillColor(RGBA(0,200,0,220));
fillColor(0,200,0,220);
textBox(10, height/2, width-20, "Hello World!", nullptr); textBox(10, height/2, width-20, "Hello World!", nullptr);
} }




+ 7
- 6
examples/widgets/NanoPerfWidget.hpp View File

@@ -26,6 +26,7 @@
// ------------------------------------------------------ // ------------------------------------------------------
// use namespace // use namespace


using DISTRHO::d_string;
using DGL::IdleCallback; using DGL::IdleCallback;
using DGL::NanoVG; using DGL::NanoVG;
using DGL::NanoWidget; using DGL::NanoWidget;
@@ -148,7 +149,7 @@ protected:


beginPath(); beginPath();
rect(0, 0, w, h); rect(0, 0, w, h);
fillColor(RGBA(0,0,0,128));
fillColor(0,0,0,128);
fill(); fill();


beginPath(); beginPath();
@@ -180,7 +181,7 @@ protected:
} }


lineTo(w, h); lineTo(w, h);
fillColor(RGBA(255,192,0,128));
fillColor(255,192,0,128);
fill(); fill();


fontFace("sans"); fontFace("sans");
@@ -189,7 +190,7 @@ protected:
{ {
fontSize(14.0f); fontSize(14.0f);
textAlign(ALIGN_LEFT|ALIGN_TOP); textAlign(ALIGN_LEFT|ALIGN_TOP);
fillColor(RGBA(240,240,240,192));
fillColor(240,240,240,192);
text(3, 1, fName, nullptr); text(3, 1, fName, nullptr);
} }


@@ -197,13 +198,13 @@ protected:
{ {
fontSize(18.0f); fontSize(18.0f);
textAlign(ALIGN_RIGHT|ALIGN_TOP); textAlign(ALIGN_RIGHT|ALIGN_TOP);
fillColor(RGBA(240,240,240,255));
fillColor(240,240,240,255);
std::sprintf(str, "%.2f FPS", 1.0f / avg); std::sprintf(str, "%.2f FPS", 1.0f / avg);
text(w-3, 1, str, nullptr); text(w-3, 1, str, nullptr);


fontSize(15.0f); fontSize(15.0f);
textAlign(ALIGN_RIGHT|ALIGN_BOTTOM); textAlign(ALIGN_RIGHT|ALIGN_BOTTOM);
fillColor(RGBA(240,240,240,160));
fillColor(240,240,240,160);
std::sprintf(str, "%.2f ms", avg * 1000.0f); std::sprintf(str, "%.2f ms", avg * 1000.0f);
text(w-3, h-1, str, nullptr); text(w-3, h-1, str, nullptr);
} }
@@ -211,7 +212,7 @@ protected:
{ {
fontSize(18.0f); fontSize(18.0f);
textAlign(ALIGN_RIGHT|ALIGN_TOP); textAlign(ALIGN_RIGHT|ALIGN_TOP);
fillColor(RGBA(240,240,240,255));
fillColor(240,240,240,255);
std::sprintf(str, "%.2f ms", avg * 1000.0f); std::sprintf(str, "%.2f ms", avg * 1000.0f);
text(w-3, 1, str, nullptr); text(w-3, 1, str, nullptr);
} }


Loading…
Cancel
Save